Kobzol / hardware-effects

Demonstration of various hardware effects.
MIT License
2.83k stars 159 forks source link

Repetition count #17

Open VictorEijkhout opened 5 years ago

VictorEijkhout commented 5 years ago

I'm toying around with the cache-conflicts code, and I'm using a higher count than you did in your benchmark. However, the repetition count than makes the program run for absolutely forever. So maybe you could do:

#ifndef REPETITIONS
#define REPETITIONS 10000000
#endif

so that it becomes possible to override that count.

After that I can of course recompile by hand, but beats me if I can figure out how to use your build system and pass the -DREPETITIONS=1000 to the compiler.

Thoughts?

Kobzol commented 5 years ago

Hello, good point, I added the #ifndef check to all examples, thanks. Generally I tried to choose the repetition count to be high enough to make the effects reproducible and measurable, but low enough to still be interactive and take just a few seconds. But obviously it depends on your CPU and it may be a bit overtuned on some examples to stay on the safer side.

The build system is vanilla CMake and make by default, if you want to add a definition, you can use add_definitions(-Dfoo=bar) to the CMakeLists.txt file containing the example target. But I suppose it might be easier to just compile by hand in that case, there are no dependencies, so it should be a simple g++/clang call.