diff options
author | Tim Besard <tim.besard@gmail.com> | 2011-11-21 10:47:47 +0100 |
---|---|---|
committer | Tim Besard <tim.besard@gmail.com> | 2011-11-21 10:47:47 +0100 |
commit | 23582a8aff400cf0c698650b29a3a6e13f159de3 (patch) | |
tree | 5c015e87baa6e3b0fd4530ee4251d7d2f5eebc85 /src | |
parent | 393401b50f728ff5dc7a5d29c9c976eaff6a2a26 (diff) |
Default to a release build, and move some duplicate code out an inner loop.
Diffstat (limited to 'src')
-rw-r--r-- | src/run.cpp | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/src/run.cpp b/src/run.cpp index b990a4c..4eaa8cd 100644 --- a/src/run.cpp +++ b/src/run.cpp @@ -96,8 +96,8 @@ int Run::run() { #endif // initialize the chains and - // compile the function that - // will execute the tests + // select the function that + // will generate the tests generator gen; for (int i = 0; i < this->exp->chains_per_thread; i++) { if (this->exp->access_pattern == Experiment::RANDOM) { @@ -116,13 +116,14 @@ int Run::run() { } } - if (this->exp->iterations <= 0) { - // compile benchmark - benchmark bench = gen(this->exp->chains_per_thread, - this->exp->bytes_per_line, this->exp->bytes_per_chain, - this->exp->stride, this->exp->loop_length, - this->exp->prefetch_hint); + // compile benchmark + benchmark bench = gen(this->exp->chains_per_thread, + this->exp->bytes_per_line, this->exp->bytes_per_chain, + this->exp->stride, this->exp->loop_length, + this->exp->prefetch_hint); + // calculate the number of iterations + if (this->exp->iterations <= 0) { volatile static double istart = 0; volatile static double istop = 0; volatile static double elapsed = 0; @@ -164,15 +165,8 @@ int Run::run() { } this->bp->barrier(); } -#if defined(UNDEFINED) -#endif - - // compile benchmark - benchmark bench = gen(this->exp->chains_per_thread, - this->exp->bytes_per_line, this->exp->bytes_per_chain, - this->exp->stride, this->exp->loop_length, - this->exp->prefetch_hint); + // run the experiments for (int e = 0; e < this->exp->experiments; e++) { // barrier this->bp->barrier(); @@ -208,6 +202,7 @@ int Run::run() { this->bp->barrier(); + // clean the memory for (int i = 0; i < this->exp->chains_per_thread; i++) { if (chain_memory[i] != NULL ) delete[] chain_memory[i]; |