Advertisement
Guest User

Untitled

a guest
May 23rd, 2014
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.83 KB | None | 0 0
  1. --- a/stream_omp.c  2009-03-14 15:02:38.000000000 +0100
  2. +++ b/stream_omp.c  2014-05-23 12:22:05.878737562 +0200
  3. @@ -45,6 +45,8 @@
  4.  # include <float.h>
  5.  # include <limits.h>
  6.  # include <sys/time.h>
  7. +# include <omp.h>
  8. +# include <cpucounters.h>
  9.  
  10.  /* INSTRUCTIONS:
  11.   *
  12. @@ -54,8 +56,8 @@
  13.   *          that should be good to about 5% precision.
  14.   */
  15.  
  16. -# define N 2000000
  17. -# define NTIMES    10
  18. +# define N 60000000 // make sure we the matrices do not fit into caches
  19. +# define NTIMES    100 // increase the number of repetitions to increase measurement accuracy
  20.  # define OFFSET    0
  21.  
  22.  /*
  23. @@ -179,6 +181,9 @@ main()
  24.      printf("For best results, please be sure you know the\n");
  25.      printf("precision of your system timer.\n");
  26.      printf(HLINE);
  27. +
  28. +    PCM::getInstance()->program();
  29. +    long long unsigned readBytes = 0, writtenBytes = 0;
  30.      
  31.      /* --- MAIN LOOP --- repeat test cases NTIMES times --- */
  32.  
  33. @@ -216,6 +221,7 @@ main()
  34.     times[2][k] = mysecond() - times[2][k];
  35.    
  36.     times[3][k] = mysecond();
  37. +   SystemCounterState begin = getSystemCounterState();
  38.  #ifdef TUNED
  39.          tuned_STREAM_Triad(scalar);
  40.  #else
  41. @@ -224,6 +230,12 @@ main()
  42.         a[j] = b[j]+scalar*c[j];
  43.  #endif
  44.     times[3][k] = mysecond() - times[3][k];
  45. +
  46. +   SystemCounterState after = getSystemCounterState();
  47. +   if(k>0) { // skip the first iteration
  48. +       readBytes += getBytesReadFromMC(begin,after);
  49. +       writtenBytes += getBytesWrittenToMC(begin,after);
  50. +   }
  51.     }
  52.  
  53.      /* --- SUMMARY --- */
  54. @@ -237,6 +249,9 @@ main()
  55.         maxtime[j] = MAX(maxtime[j], times[j][k]);
  56.         }
  57.     }
  58. +
  59. +   printf("TRIAD read bw: %11.4f write bw: %11.4f\n",1.0E-06*readBytes/avgtime[3],1.0E-06*writtenBytes/avgtime[3]);
  60. +   PCM::getInstance()->cleanup();
  61.      
  62.      printf("Function      Rate (MB/s)   Avg time     Min time     Max time\n");
  63.      for (j=0; j<4; j++) {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement