Skip to content

Commit

Permalink
Merge branch 'master' of github.com:lapesd/libgomp-benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
ppenna committed Apr 12, 2017
2 parents f2f407d + bd9ada3 commit 96664e6
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/benchmark/benchmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ static long kernel_cpu(unsigned n, long load)
return (sum);
}

#if defined(_CACHE_BENCHMARK_)

/**
* @brief Cache intensive kernel.
*
Expand All @@ -74,12 +76,14 @@ static void kernel_cache(unsigned *a, unsigned off, unsigned n, long load)
}
}

#endif

/*============================================================================*
* Benchmark *
*============================================================================*/

/**
* @brief Dumps simulation statistics.
* @brief Dumps benchmark statistics.
*
* @param respvar Response variable.
* @param nthreads Number of threads.
Expand Down Expand Up @@ -117,12 +121,10 @@ static void benchmark_dump(const double *respvar, int nthreads, const char *pref
stddev = sqrt(stddev/(nthreads));

/* Print statistics. */
printf("%s_min: %lf\n", prefix, min);
printf("%s_max: %lf\n", prefix, max);
printf("%s_mean: %lf\n", prefix, mean);
printf("%s_stddev: %lf\n", prefix, 100*stddev/mean);
printf("%s_imbalance: %lf\n", prefix, 100*(max - min)/((double) total));
printf("%s_speeddown: %lf\n", prefix, max/((double) min));
printf("%s_total: %lf\n", prefix, total);
printf("%s_cov: %lf\n", prefix, stddev/mean);
printf("%s_slowdown: %lf\n", prefix, max/((double) min));
printf("%s_cost: %lf\n", prefix, nthreads*max);
}

Expand Down Expand Up @@ -185,6 +187,8 @@ static void benchmark_cpu(const unsigned *tasks, unsigned ntasks, int nthreads,
free(_tasks);
}

#if defined(_CACHE_BENCHMARK_)

#define CACHE_SIZE (256*1024)

/**
Expand Down Expand Up @@ -250,6 +254,8 @@ static void benchmark_cache(const unsigned *tasks, unsigned ntasks, int nthreads
free(_tasks);
}

#endif

/**
* @brief Synthetic benchmark.
*
Expand All @@ -268,5 +274,7 @@ void benchmark(const unsigned *tasks, unsigned ntasks, int nthreads, long load)

benchmark_cpu(tasks, ntasks, nthreads, load);

#if defined(_CACHE_BENCHMARK_)
benchmark_cache(tasks, ntasks, nthreads, load);
#endif
}

0 comments on commit 96664e6

Please sign in to comment.