Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CALL MPI_Comm_split_type(MPI_COMM_WORLD, MPI_COMM_TYPE_SHARED&
- , 0, MPI_INFO_NULL, hostcomm,ierr)
- CALL MPI_Comm_rank(hostcomm, hostrank,ierr)
- allocate(arrayshape(4))
- arrayshape=(/ nroot1,nroot1,nroot1,nroot1 /)
- if (hostrank == 0) then
- windowsize = int(nroot1**4,MPI_ADDRESS_KIND)*&
- 8_MPI_ADDRESS_KIND ! *8 since there are 8 bytes in a double
- else
- windowsize = 0_MPI_ADDRESS_KIND
- end if
- disp_unit = 1
- CALL MPI_Win_allocate_shared(windowsize, disp_unit, &
- MPI_INFO_NULL, hostcomm, baseptr, win,ierr)
- CALL MPI_Win_allocate_shared(windowsize, disp_unit, &
- MPI_INFO_NULL, hostcomm, baseptr2, win2,ierr)
- ! Obtain the location of the memory segment
- if (hostrank /= 0) then
- CALL MPI_Win_shared_query(win, 0, windowsize, disp_unit,&
- baseptr,ierr)
- CALL MPI_Win_shared_query(win2, 0, windowsize, disp_unit,&
- baseptr2,ierr)
- end if
- ! baseptr can now be associated with a Fortran pointer
- ! and thus used to access the shared data
- CALL C_F_POINTER(baseptr, matrix_elementsy,arrayshape)
- CALL C_F_POINTER(baseptr2, matrix_elementsz,arrayshape)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement