How can the program be made intensively load-store so that there is maximum memory references and negligible computation(not even looping overheads!)
A:
Use a lot of volatile
variables, which are stored in-memory but I'm not sure if that answers your question.
sybreon
2009-05-25 05:55:17
A:
Use huge arrays with a lot of scattered reads/writes to maximize cache misses. If your goal is to write a program that just exercises memory - write random values into an array at indices chosen randomly.
sharptooth
2009-05-25 06:00:52
hey thnks a ton...is there any way to flush cache?
2009-05-25 06:20:46
Haven't heard of, and if there is one, it is platform-dependent. However you don't really need it - scattered memory access does good job on its own.
sharptooth
2009-05-25 07:17:30
+2
A:
With gcc
use -funroll-loops
on this code:
int main (int argc, char** argv) {
int a = 5;
int b = 10;
int c;
int i;
while (1) {
for (i = 0; i <= 2147483647; i++) {
c = b;
b = a;
a = c;
}
}
return 0;
}
Chas. Owens
2009-05-25 06:02:09
A:
Make a map between possible inputs to your program and possible outputs.
Calculations on the inputs to make the outputs need to be done by another program or by hand, though.
strager
2009-05-25 06:04:09