Commit 8a504a01 authored by Jayesh Krishna's avatar Jayesh Krishna
Browse files

[svn-r4098] Prevent sending the same data twice - Since we are sending 2...

[svn-r4098] Prevent sending the same data twice - Since we are sending 2 MPI_INTS put/get 'SIZE/2 -2' elements from/to array A. The last two elements are used for Accumulate - No reviewer
parent 24fd4ba7
......@@ -48,19 +48,19 @@ int main(int argc, char *argv[])
MPI_Win_fence(0, win);
if (rank == 0) {
for (i=0; i<SIZE-1; i++)
for (i=0; i<SIZE-2; i+=2)
MPI_Put(A+i, 2, MPI_INT, 1, i, 1, contig_2ints, win);
}
else {
for (i=0; i<SIZE-1; i++)
for (i=0; i<SIZE-2; i+=2)
MPI_Get(A+i, 2, MPI_INT, 0, i, 1, contig_2ints, win);
MPI_Accumulate(A+i, 2, MPI_INT, 0, i, 1, contig_2ints, MPI_SUM, win);
MPI_Accumulate(A+SIZE-2, 2, MPI_INT, 0, SIZE-2, 1, contig_2ints, MPI_SUM, win);
}
MPI_Win_fence(0, win);
if (rank == 1) {
for (i=0; i<SIZE-1; i++) {
for (i=0; i<SIZE-2; i++) {
if (A[i] != B[i]) {
printf("Put/Get Error: A[i]=%d, B[i]=%d\n", A[i], B[i]);
errs++;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment