I just used mpi one-sided communication to write a simple demo, which is process 1 just fetch an integer from process 0.
here is the code
program main include "mpif.h" integer a(10), b(10) integer :: myid, numprocs, ierr integer :: win, data_win integer :: k, p integer size_of_window call MPI_INIT(ierr) call MPI_Comm_rank(MPI_COMM_WORLD, myid, ierr) call MPI_Comm_size(MPI_COMM_WORLD, numprocs, ierr) !print*, win if (myid .eq. 0) then call mpi_win_Create(a, 4*10, 4, mpi_info_null, MPI_COMM_WORLD,win,ierr) else call mpi_win_Create(null, 0, 1, mpi_info_null, MPI_COMM_WORLD,win,ierr) endif print*, win if (myid .eq. 0) then do i=1,10 a(i) = 99 enddo endif if(myid .ne. 0) then !print*, win call MPI_Win_lock(MPI_LOCK_SHARED,0,0,win,ierr) call MPI_Get(b,10,mpi_integer,0,0,10,mpi_integer,win,ierr) call MPI_Win_unlock(0,win,ierr) print *,"err", ierr call MPI_Win_free(win, ierr) print *,"myid ", myid, "get message", b else !print*, win call MPI_Win_free(win, ierr) endif call MPI_Barrier(MPI_COMM_WORLD, ierr) end program
but it doesn't work at all, I try so many ways it just don't reach the print message line, please can someone tell me what's going on
TCE Open Date:
Friday, March 6, 2020 - 19:00