Skip to content
Snippets Groups Projects
Commit 5922501a authored by Ladislav Laska's avatar Ladislav Laska
Browse files

Fix na setrideni dat.

Pri vice iteracich se predavalo stejne pole... Ted si ho predem
nakopiruju nekolikrat: velka data + hodne iteraci = smrt.
parent 4095353b
No related branches found
No related tags found
No related merge requests found
......@@ -39,6 +39,9 @@ asm: exercise-dbg.s exercise-opt.s
clean:
rm -f *.o *.s aim-opt aim-dbg output.pbm random
mkdata:
random `echo '10^6' | bc ` > random.in
benchmark: aim-opt
@{ echo; \
......@@ -48,10 +51,5 @@ benchmark: aim-opt
echo '>>> The measured mean time, its probable lower and upper bounds and S.D.'; \
echo '>>> are printed out. See the header of statistics.awk for details.'; } >&2
@(for i in `seq 1 $(RUNS)`; do \
./aim-opt $(ITERS) test16384.pbm output.pbm | tee /dev/stderr; \
./aim-opt $(ITERS) random.in random.out | tee /dev/stderr; \
done) | awk -f statistics.awk
evaluate: aim-opt
for s in 64 1024; do ./aim-opt 1 test$$s.pbm output.pbm; done >/dev/null
# Consider the optimistic estimate
make -s benchmark | { read m o p s; echo $$m $$o $$p $$s >&2; echo $$o; }
......@@ -4,6 +4,7 @@
#include <stdlib.h>
#include <sys/time.h>
#include <assert.h>
#include <string.h>
#include "aim.h"
......@@ -62,18 +63,27 @@ main(int argc, char *argv[])
return EXIT_FAILURE;
}
int iters = atoi(argv[1]);
int length;
int * seq = seq_load(argv[2], &length);
timestamp_t t0 = get_timer();
int **seqs = malloc(sizeof(int*)*iters);
seqs[0] = seq;
/* Hmm, copy the data!*/
for (int k = 1; k < iters; k++) {
seqs[k] = malloc(sizeof(int)*length);
memcpy(seqs[k], seq, sizeof(int)*length);
}
/* Pre-warm the CPU! Neccessary for benchmarking w/ dynamic
* cpufreq policy. */
while (get_timer() - t0 < 500000);
t0 = get_timer();
int iters = atoi(argv[1]);
for (int j = 0; j < iters; j++) {
exercise(seq, length);
exercise(seqs[j], length);
}
t0 = get_timer() - t0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment