#define USING_CRAY 0 #include #include #if USING_CRAY #include #else #include #endif #include #include #include #define MaxN 5000 #define LOOPS 1000 #define OVERHEAD_ITERATIONS 1000 /* number of iterations in overhead timing */ #define NumofHashValues 13 int hashsize[NumofHashValues]; #define MaxHashValue 128 shared int array[MaxN]; #if USING_CRAY upc_lock_t arrayflag[MaxN]; #else upc_lock_t *arrayflag[MaxN]; #endif #if USING_CRAY upc_lock_t threadflag[THREADS]; #else upc_lock_t *threadflag[THREADS]; #endif #if USING_CRAY upc_lock_t hashflag[MaxHashValue]; #else upc_lock_t *hashflag[MaxHashValue]; #endif int main () { struct timeval tpstart, tpstop; unsigned int overhead, measured; hashsize[0] = 1; hashsize[1] = 3; hashsize[2] = 4; hashsize[3] = 7; hashsize[4] = 8; hashsize[5] = 16; hashsize[6] = 17; hashsize[7] = 31; hashsize[8] = 32; hashsize[9] = 61; hashsize[10] = 64; hashsize[11] = 127; hashsize[12] = 128; { int i; overhead = 0; for(i=0; i < OVERHEAD_ITERATIONS; i++) { gettimeofday(&tpstart, NULL); gettimeofday(&tpstop, NULL); overhead += (tpstop.tv_sec-tpstart.tv_sec) * 1000000.0 + (tpstop.tv_usec-tpstart.tv_usec); } overhead/=OVERHEAD_ITERATIONS; } srand48((long) MYTHREAD); // Initialize Random Number Generator #define WHICHCASE 15 #if( WHICHCASE & 8 ) { int N, l, i; for(N=250; N<=MaxN; N+=250){ {int i; upc_forall(i=0; i