Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- a/stream_omp.c 2009-03-14 15:02:38.000000000 +0100
- +++ b/stream_omp.c 2014-05-23 12:22:05.878737562 +0200
- @@ -45,6 +45,8 @@
- # include <float.h>
- # include <limits.h>
- # include <sys/time.h>
- +# include <omp.h>
- +# include <cpucounters.h>
- /* INSTRUCTIONS:
- *
- @@ -54,8 +56,8 @@
- * that should be good to about 5% precision.
- */
- -# define N 2000000
- -# define NTIMES 10
- +# define N 60000000 // make sure we the matrices do not fit into caches
- +# define NTIMES 100 // increase the number of repetitions to increase measurement accuracy
- # define OFFSET 0
- /*
- @@ -179,6 +181,9 @@ main()
- printf("For best results, please be sure you know the\n");
- printf("precision of your system timer.\n");
- printf(HLINE);
- +
- + PCM::getInstance()->program();
- + long long unsigned readBytes = 0, writtenBytes = 0;
- /* --- MAIN LOOP --- repeat test cases NTIMES times --- */
- @@ -216,6 +221,7 @@ main()
- times[2][k] = mysecond() - times[2][k];
- times[3][k] = mysecond();
- + SystemCounterState begin = getSystemCounterState();
- #ifdef TUNED
- tuned_STREAM_Triad(scalar);
- #else
- @@ -224,6 +230,12 @@ main()
- a[j] = b[j]+scalar*c[j];
- #endif
- times[3][k] = mysecond() - times[3][k];
- +
- + SystemCounterState after = getSystemCounterState();
- + if(k>0) { // skip the first iteration
- + readBytes += getBytesReadFromMC(begin,after);
- + writtenBytes += getBytesWrittenToMC(begin,after);
- + }
- }
- /* --- SUMMARY --- */
- @@ -237,6 +249,9 @@ main()
- maxtime[j] = MAX(maxtime[j], times[j][k]);
- }
- }
- +
- + printf("TRIAD read bw: %11.4f write bw: %11.4f\n",1.0E-06*readBytes/avgtime[3],1.0E-06*writtenBytes/avgtime[3]);
- + PCM::getInstance()->cleanup();
- printf("Function Rate (MB/s) Avg time Min time Max time\n");
- for (j=0; j<4; j++) {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement