1 ! This file created from test/mpi/f77/rma/winfencef.f with f77tof90
2 ! -*- Mode: Fortran; -*-
4 ! (C) 2003 by Argonne National Laboratory.
5 ! See COPYRIGHT in top-level directory.
11 integer left, right, rank, size
13 parameter (nrows=25,ncols=10)
14 integer buf(1:nrows,0:ncols+1)
17 logical mtestGetIntraComm
18 ! Include addsize defines asize as an address-sized integer
19 integer (kind=MPI_ADDRESS_KIND) asize
23 call mtest_init( ierr )
25 call mpi_type_size( MPI_INTEGER, intsize, ierr )
26 do while( mtestGetIntraComm( comm, 2, .false. ) )
27 asize = nrows * (ncols + 2) * intsize
28 call mpi_win_create( buf, asize, intsize * nrows, &
29 & MPI_INFO_NULL, comm, win, ierr )
31 call mpi_comm_size( comm, size, ierr )
32 call mpi_comm_rank( comm, rank, ierr )
38 if (right .ge. size) then
42 ! Initialize the buffer
49 buf(i,j) = rank * (ncols * nrows) + i + (j-1) * nrows
52 call mpi_win_fence( MPI_MODE_NOPRECEDE, win, ierr )
55 call mpi_put( buf(1,1), nrows, MPI_INTEGER, left, asize, &
56 & nrows, MPI_INTEGER, win, ierr )
58 call mpi_put( buf(1,ncols), nrows, MPI_INTEGER, right, asize, &
59 & nrows, MPI_INTEGER, win, ierr )
61 call mpi_win_fence( MPI_MODE_NOSTORE + MPI_MODE_NOPUT + &
62 & MPI_MODE_NOSUCCEED, win, ierr )
65 if (left .ne. MPI_PROC_NULL) then
67 ans = rank * (ncols * nrows) - nrows + i
68 if (buf(i,0) .ne. ans) then
70 if (errs .le. 10) then
71 print *, rank, ' buf(',i,',0) = ', buf(i,0), &
77 if (right .ne. MPI_PROC_NULL) then
79 ans = (rank + 1)* (ncols * nrows) + i
80 if (buf(i,ncols+1) .ne. ans) then
82 if (errs .le. 10) then
83 print *, rank, ' buf(',i,',',ncols+1,') = ', &
84 & buf(i,ncols+1), ' expected ', ans
89 call mpi_win_free( win, ierr )
90 call mtestFreeComm( comm )
93 call mtest_finalize( errs )
94 call mpi_finalize( ierr )