uint64_t accumulate (size_t sndlen, int mytask, int origin, int target) { TRACE_ERR((stderr, "(%u) Do test ... sndlen = %zu\n", mytask, sndlen)); unsigned i; uint64_t t1 = GetTimeBase(); double scale = 1.0; if (mytask == origin) { for (i = 0; i < ITERATIONS; i++) { //fprintf(stderr, "(%u) Starting Iteration %d of size %zu dstaddr %p\n", mytask, i, sndlen, rcvbuf); A1_Get ( target, srcbuf, dstbuf, sndlen * sizeof(double) ); A1_Flush (target); } } A1_AllFence(); MPI_Barrier(MPI_COMM_WORLD); uint64_t t2 = GetTimeBase(); return ((t2 - t1) / ITERATIONS); }
void test_rmw (int mytask, int origin, int ntasks) { TRACE_ERR((stderr, "(%u) Do test ... \n", mytask)); int i = 0; int *outbuf = (int *) malloc (2*sizeof(int)); outbuf[0] = mytask; outbuf[1] = origin; int target = origin+1; if (target >= ntasks) target = 0; A1_AllFence(); if (mytask == origin) { for (i = 0; i < ntasks-1; i++) { A1_Rmw ( target, &outbuf[0], &outbuf[1], &outbuf[0], sizeof(int), A1_SWAP, A1_INT32 ); A1_Flush (target); target ++; outbuf[0] = outbuf[1]; //printf ("%d: current swap %d\n", i, outbuf[0]); } } A1_AllFence(); MPI_Barrier(MPI_COMM_WORLD); printf ("%d: My new task id %d\n", mytask, outbuf[0]); }