- for(i = 0; i < nproc; i++) {
- /* int target = (me + i) % nproc; */
- int target = i;
- for(j = 0; j < COUNT; j++) {
- if (verbose) printf("%2d -> %2d [%2d]\n", me, target, j);
- MPI_Win_lock(MPI_LOCK_EXCLUSIVE, target, 0, dst_win);
- MPI_Put(&src_buf[j], sizeof(double), MPI_BYTE, target,
- (me*MAXELEMS+j)*sizeof(double), sizeof(double), MPI_BYTE, dst_win);
- MPI_Win_unlock(target, dst_win);
+ MPI_Win_unlock(me, dst_win);
+
+ MPI_Barrier(MPI_COMM_WORLD);
+
+ for (i = 0; i < nproc; i++) {
+ /* int target = (me + i) % nproc; */
+ int target = i;
+ for (j = 0; j < COUNT; j++) {
+ if (verbose)
+ printf("%2d -> %2d [%2d]\n", me, target, j);
+ MPI_Win_lock(MPI_LOCK_EXCLUSIVE, target, 0, dst_win);
+ MPI_Put(&src_buf[j], sizeof(double), MPI_BYTE, target,
+ (me * MAXELEMS + j) * sizeof(double), sizeof(double), MPI_BYTE, dst_win);
+ MPI_Win_unlock(target, dst_win);
+ }