Comments (9)
Was this issue not finished by your commit on August 1?
from drampower.
Mainly because there are still some residual casts to double, and because the MemCommand class still uses doubles internally to store time (https://github.com/ravenrd/DRAMPower/blob/master/src/MemCommand.cc#L55).
from drampower.
We don't rely on double's anymore to represent time. I propose to remove the getTime() function from MemCommand in favor of the int64_t getTimeInt64() const;
function we now use.
https://github.com/ravenrd/DRAMPower/blob/master/src/MemCommand.h#L117
Any objections? If not, then I'll make this change and close the issue in 2 days.
from drampower.
I think that is totally valid. @efzulian, what do you think?
from drampower.
Hi guys, just wondering why not to use unsigned timestamps (uint64_t instead of int64_t). :)
from drampower.
Using unsigned numbers creates a few interesting opportunities for failure:
// If all of these variables are unsigned, then we might end up with
// an unexpectedly large value for 'a'
uint64_t a = max(zero, c-d);
The google style guide also agrees to some extent:
https://google.github.io/styleguide/cppguide.html#Integer_Types
from drampower.
Since we had this afternoon some discussions about using double or int for representing time in SystemC for DRAMSys, I'm curious to know: @Sv3n what is your motivation to represent time in int instead of double?
from drampower.
The input to DRAMPower is commands, which happen at integer multiples of the clock period. Expressing time as an integer number of clock cycles allows us to write down exactly when a command happens. Arithmetic on these clock cycles is guaranteed to produce an output that is another integer multiple of the clock period. With doubles you cannot guarantee that:
// Assuming the clock period is '1'
double now = current_time_cycles_to_double(0);
double eight_cycles_ago = now - 8;
double four_cycles_ago = now - 4;
// Now any of these expressions might be true, depending
// on the particular value of 'now':
eight_cycles_ago + 4 == four_cycles_ago;
eight_cycles_ago + 4 > four_cycles_ago;
eight_cycles_ago + 4 < four_cycles_ago;
At extremely large values, certain integer values can no longer be expressed in a double, and they will alias to other integers. For a demonstration of the effect (with less waiting time), you can use the smaller 'float' type:
for (float i = 0; i < 0xFFFFFFFF; i++) {
// This will never finish. It halts at the first point where
// the closest number expressible as a float for i + 1 == i
}
from drampower.
Thank you for that nice explanation. I had similar concerns, especially the rounding in the high dynamic ranges.
from drampower.
Related Issues (20)
- Does a memspec correspond to a chip or a rank? HOT 3
- Cherry-picking from my parallel CMake efforts HOT 3
- Unsafe reference to vector element HOT 1
- Operator == for MemCommand ignores command timestamp HOT 1
- Unused field in Energy struct in MemoryPowerModel HOT 1
- make: g++: Command not found HOT 7
- error in make file HOT 2
- energy of the memory HOT 3
- Deletion from vector while looping over the vector
- plans for new memory models HOT 3
- Energy and power measurements for WideIO HOT 7
- How to generate the .trace file? HOT 2
- I/O Energy HOT 1
- single bank power/energy simulation HOT 1
- Error in build phase in compilation HOT 3
- help with DRAM XMLs and using the tool HOT 3
- Unit of energy ? pJ or nJ? HOT 1
- Get stats of rank[0] only
- Does DRAMPower account for data-dependent power consumption or structural differences between bank/rows? HOT 1
- Request for clarification of queries regd. executing the simulation HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from drampower.