- for (loop=0; loop<2; loop++) {
- /* Perform several communication operations, mixing synchronization
- types. Use multiple communication to avoid the single-operation
- optimization that may be present. */
- MTestPrintfMsg( 3, "Beginning loop %d of mixed sync put operations\n",
- loop );
- MPI_Barrier( comm );
- if (crank == source) {
- MTestPrintfMsg( 3, "About to perform exclusive lock\n" );
- MPI_Win_lock( MPI_LOCK_EXCLUSIVE, dest, 0, win );
- MPI_Put( buf0, count0, MPI_INT, dest, 0, count0, MPI_INT, win );
- MPI_Put( buf1, count1, MPI_INT, dest, count0, count1, MPI_INT,
- win );
- MPI_Put( buf2, count2, MPI_INT, dest, count0+count1, count2,
- MPI_INT, win );
- MPI_Win_unlock( dest, win );
- MTestPrintfMsg( 3, "Released exclusive lock\n" );
- }
- else if (crank == dest) {
- /* Just delay a bit */
- delay( 0.0001 );
- }
-
- /* The synchronization mode can only be changed when the process
- memory and public copy are guaranteed to have the same values
- (See 11.7, Semantics and Correctness). This barrier ensures that
- the lock/unlock completes before the fence call. */
- MPI_Barrier( comm );
-
- MTestPrintfMsg( 3, "About to start fence\n" );
- MPI_Win_fence( 0, win );
- if (crank == source) {
- MPI_Put( buf0, count0, MPI_INT, dest, 1, count0, MPI_INT, win );
- MPI_Put( buf1, count1, MPI_INT, dest, 1+count0, count1, MPI_INT,
- win );
- MPI_Put( buf2, count2, MPI_INT, dest, 1+count0+count1, count2,
- MPI_INT, win );
- }
- MPI_Win_fence( 0, win );
- MTestPrintfMsg( 3, "Finished with fence sync\n" );
-
- /* Check results */
- if (crank == dest) {
- for (i=0; i<count0+count1+count2; i++) {
- if (winbuf[1+i] != i) {
- errs++;
- if (errs < 10) {
- fprintf( stderr, "winbuf[%d] = %d, expected %d\n",
- 1+i, winbuf[1+i], i ); fflush(stderr);
- }
- }
- }
- }
-
- /* End of test loop */
+ for (loop = 0; loop < 2; loop++) {
+ /* Perform several communication operations, mixing synchronization
+ * types. Use multiple communication to avoid the single-operation
+ * optimization that may be present. */
+ MTestPrintfMsg(3, "Beginning loop %d of mixed sync put operations\n", loop);
+ MPI_Barrier(comm);
+ if (crank == source) {
+ MTestPrintfMsg(3, "About to perform exclusive lock\n");
+ MPI_Win_lock(MPI_LOCK_EXCLUSIVE, dest, 0, win);
+ MPI_Put(buf0, count0, MPI_INT, dest, 0, count0, MPI_INT, win);
+ MPI_Put(buf1, count1, MPI_INT, dest, count0, count1, MPI_INT, win);
+ MPI_Put(buf2, count2, MPI_INT, dest, count0 + count1, count2, MPI_INT, win);
+ MPI_Win_unlock(dest, win);
+ MTestPrintfMsg(3, "Released exclusive lock\n");
+ }
+ else if (crank == dest) {
+ /* Just delay a bit */
+ delay(0.0001);
+ }
+
+ /* The synchronization mode can only be changed when the process
+ * memory and public copy are guaranteed to have the same values
+ * (See 11.7, Semantics and Correctness). This barrier ensures that
+ * the lock/unlock completes before the fence call. */
+ MPI_Barrier(comm);
+
+ MTestPrintfMsg(3, "About to start fence\n");
+ MPI_Win_fence(0, win);
+ if (crank == source) {
+ MPI_Put(buf0, count0, MPI_INT, dest, 1, count0, MPI_INT, win);
+ MPI_Put(buf1, count1, MPI_INT, dest, 1 + count0, count1, MPI_INT, win);
+ MPI_Put(buf2, count2, MPI_INT, dest, 1 + count0 + count1, count2, MPI_INT, win);
+ }
+ MPI_Win_fence(0, win);
+ MTestPrintfMsg(3, "Finished with fence sync\n");
+
+ /* Check results */
+ if (crank == dest) {
+ for (i = 0; i < count0 + count1 + count2; i++) {
+ if (winbuf[1 + i] != i) {
+ errs++;
+ if (errs < 10) {
+ fprintf(stderr, "winbuf[%d] = %d, expected %d\n", 1 + i, winbuf[1 + i], i);
+ fflush(stderr);
+ }
+ }
+ }
+ }
+
+ /* End of test loop */