/*************************************************************************** * * * OpenMP MicroBenchmark Suite - Version 2.0 * * * * produced by * * * * Mark Bull and Fiona Reid * * * * at * * * * Edinburgh Parallel Computing Centre * * * * email: markb@epcc.ed.ac.uk or fiona@epcc.ed.ac.uk * * * * * * This version copyright (c) The University of Edinburgh, 2004. * * All rights reserved. * * * **************************************************************************/ #include #include #include #include #include "arraybench.h" void delay(int, double*); int main (int argv, char **argc) { nthreads = 1; #pragma omp parallel { #pragma omp master { #ifdef _OPENMP nthreads = omp_get_num_threads(); #endif } } printf(" Running OpenMP benchmark on %d thread(s)\n", nthreads); delaylength = 500; innerreps = 100; /* GENERATE REFERENCE TIME */ refer(); /* TEST PRIVATE */ testprivnew(); /* TEST FIRSTPRIVATE */ testfirstprivnew(); #ifdef OMPVER2 /* TEST COPYPRIVATE */ testcopyprivnew(); #endif /* TEST THREADPRIVATE - COPYIN */ testthrprivnew(); delaylength = 500; innerreps = 100; } void refer() { int j,k; double start; double meantime, sd; double a[1]; double getclock(void); printf("\n"); printf("--------------------------------------------------------\n"); printf("Computing reference time 1\n"); for (k=0; k<=OUTERREPS; k++){ start = getclock(); for (j=0; j times[i]) ? maxtime : times[i]; totaltime +=times[i]; } meantime = totaltime / OUTERREPS; sumsq = 0; for (i=1; i<=OUTERREPS; i++){ sumsq += (times[i]-meantime)* (times[i]-meantime); } sd = sqrt(sumsq/(OUTERREPS-1)); cutoff = 3.0 * sd; nr = 0; for (i=1; i<=OUTERREPS; i++){ if ( fabs(times[i]-meantime) > cutoff ) nr ++; } printf("\n"); printf("Sample_size Average Min Max S.D. Outliers\n"); printf(" %d %10.3f %10.3f %10.3f %10.3f %d\n",OUTERREPS, meantime, mintime, maxtime, sd, nr); printf("\n"); *mtp = meantime; *sdp = sd; }