Hi,
I'm reading a little bit about RMA operations and I'm trying to play with. However, I do not find some working examples of FORTRAN code, so that I can progress. If someone has some simple working examples in FORTRAN, please share :)
For the moment I only found the subroutines SUM and MAPVALS from mpi-forum.org. And I have some difficulties:
program test_MPI_RMA use mpi integer, parameter :: m=10 INTEGER i,map(m),comm,ierr,nproc,rank REAL*8 A(m),B(m) call MPI_INIT(ierr) call MPI_COMM_SIZE(MPI_COMM_WORLD, nproc, ierr) call MPI_COMM_RANK(MPI_COMM_WORLD, rank, ierr) PRINT*,"nproc=",nproc,"rank=",rank do i=1,m A(i)=rank*0.1d0 B(i)=0.d0 if (rank==0) then map(i)=1 else map(i)=0 endif print*, 'node', rank, A(i), map(i) enddo call MPI_BARRIER(MPI_COMM_WORLD, ierr) call SUM(A, B, map, m, MPI_COMM_WORLD, nproc) call MPI_FINALIZE(ierr) end program test_MPI_RMA SUBROUTINE SUM(A, B, map, m, comm, p) USE MPI INTEGER m, map(m), comm, p, sizeofreal, win, ierr REAL*8 A(m), B(m) CALL MPI_TYPE_EXTENT(MPI_DOUBLE_PRECISION, sizeofreal, ierr) CALL MPI_WIN_CREATE(B, m*sizeofreal, sizeofreal, MPI_INFO_NULL, & comm, win, ierr) CALL MPI_WIN_FENCE(0, win, ierr) DO i=1,m j = map(i)/m k = MOD(map(i),m) CALL MPI_ACCUMULATE(A(i), 1, MPI_DOUBLE_PRECISION, j, k, 1, MPI_DOUBLE_PRECISION, & MPI_SUM, win, ierr) END DO CALL MPI_WIN_FENCE(0, win, ierr) CALL MPI_WIN_FREE(win, ierr) RETURN END
I compile this code with mpif90 and intel compiler 15.0.0 without problem. However, when I run it, I get this error:
Fatal error in MPI_Win_create: Invalid size argument in RMA call, error stack:
MPI_Win_create(201): MPI_Win_create(base=0x6a98a0, size=80, disp_unit=8, MPI_INFO_NULL, MPI_COMM_WORLD, win=0x7fff89a00384) failed
MPI_Win_create(146): Invalid size argument in RMA call (value is 80)
In others words I need help :)
Could someone tell me what is wrong in these lines of code?
Best regards,
Guillaume