From 23582a8aff400cf0c698650b29a3a6e13f159de3 Mon Sep 17 00:00:00 2001 From: Tim Besard Date: Mon, 21 Nov 2011 10:47:47 +0100 Subject: Default to a release build, and move some duplicate code out an inner loop. --- CMakeLists.txt | 2 ++ src/run.cpp | 27 +++++++++++---------------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0bc1120..366b4c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,8 @@ cmake_minimum_required(VERSION 2.6) project(pChase) +SET(CMAKE_BUILD_TYPE "Release") + set (pChase_VERSION_MAJOR 0) set (pChase_VERSION_MINOR 4) 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]; -- cgit v1.2.3