- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
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
링크가 복사됨
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
I reply to myself :)
I found an updated version of SUM with some difference in MPI_TYPE_GET_EXTENT. The previous error seems to be gone !?!
SUBROUTINE SUM(A, B, map, m, comm, p)
USE MPI
INTEGER m, map(m), comm, p, win, ierr
!REAL A(m), B(m)
REAL*8 A(m), B(m)
INTEGER (KIND=MPI_ADDRESS_KIND) lowerbound, sizeofreal
CALL MPI_TYPE_GET_EXTENT(MPI_DOUBLE_PRECISION, lowerbound, 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
However, if someone has other simple examples of code with MPI_WIN_CREATE, please share them :)
Regards