#ifndef BUPC_USE_UPC_NAMESPACE #define BUPC_USE_UPC_NAMESPACE 1 #endif #include #include #include #include #include #include "bupc_timers.h" #define ONE_DIMENSION 1 #define TWO_DIMENSIONS 2 #define THREE_DIMENSIONS 3 #define ONE_DIMENSION_BLOCKING 4 #define ONE_DIMENSION_SLOW 5 #define ARRAY_SIZE 1024*1024 double shared dataArray[4*ARRAY_SIZE][THREADS]; int main(int argc, char *argv[]) { double tStart, tStop, totalTime; int i, j; upc_barrier; int communicationMode; int numberOfIterations; long chunkSize, memoryStride, chunkCount; long transferRange; int left, right; upc_handle_t leftHandle, rightHandle; double *leftShadowRegion, *rightShadowRegion; long currentLocation; printf("argc=%d \n argv: ", argc); if (argc != 6) { printf("upc-sc \n"); exit(0); } for (i=0; i ARRAY_SIZE) { printf("Transfer range %ld exceeds array size %ld\n", transferRange, (long) ARRAY_SIZE); upc_global_exit(-1); } if (chunkSize == 0 || chunkCount == 0 || chunkSize > memoryStride) { printf("Incorrect parameters\n"); upc_global_exit(-1); } } if (MYTHREAD == 0) { timer_clear(1); timer_start(1); tStart = timer_read(1); } upc_memset( & dataArray[0][MYTHREAD], 0, 4*ARRAY_SIZE*sizeof(double)); switch (communicationMode) { case ONE_DIMENSION: left = (MYTHREAD+THREADS-1)%THREADS; right = (MYTHREAD+1)%THREADS; leftShadowRegion = (double*) &dataArray[0*ARRAY_SIZE][MYTHREAD]; rightShadowRegion = (double *)& dataArray[3*ARRAY_SIZE][MYTHREAD]; for (i=0; i