/* A simplification of the Stream benchmark for OpenMP Original code developed by John D. McCalpin */ #include #include #include #include #include #include #include //#define N 2*4*20000000 #define N 80000000 //#define N 1200000 //#define N 120000 #define NTIMES 50 #define OFFSET 0 # if !defined(MIN) # define MIN(x,y) ((x)<(y) ? (x) : (y)) # endif # if !defined(MAX) # define MAX(x,y) ((x)>(y) ? (x) : (y)) # endif static double a[N+OFFSET],b[N+OFFSET],c[N+OFFSET]; static double mintime = FLT_MAX; static double bytes = 3 * sizeof(double) * N; int main(int argc,char **argv) { MPI_Init(&argc,&argv); const static double scalar = 3.0; #pragma omp threadprivate(scalar) double times[NTIMES],rate; int size; char *env; FILE *fd; env = getenv("OMP_NUM_THREADS"); if (!env) env = (char *) "1"; sscanf(env,"%d",&size); #pragma omp parallel for schedule(static) for (int j=0; j