Advertisement
Guest User

Untitled

a guest
Jan 10th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     CALL MPI_Comm_split_type(MPI_COMM_WORLD, MPI_COMM_TYPE_SHARED&
  2. , 0, MPI_INFO_NULL, hostcomm,ierr)
  3.     CALL MPI_Comm_rank(hostcomm, hostrank,ierr)
  4.  
  5.     allocate(arrayshape(4))
  6.     arrayshape=(/ nroot1,nroot1,nroot1,nroot1 /)
  7.     if (hostrank == 0) then
  8.         windowsize = int(nroot1**4,MPI_ADDRESS_KIND)*&
  9. 8_MPI_ADDRESS_KIND ! *8 since there are 8 bytes in a double
  10.     else
  11.         windowsize = 0_MPI_ADDRESS_KIND
  12.     end if
  13.     disp_unit = 1
  14.  
  15.     CALL MPI_Win_allocate_shared(windowsize, disp_unit, &
  16. MPI_INFO_NULL, hostcomm, baseptr, win,ierr)
  17.     CALL MPI_Win_allocate_shared(windowsize, disp_unit, &
  18. MPI_INFO_NULL, hostcomm, baseptr2, win2,ierr)
  19.  
  20.     ! Obtain the location of the memory segment
  21.     if (hostrank /= 0) then
  22.         CALL MPI_Win_shared_query(win, 0, windowsize, disp_unit,&
  23.  baseptr,ierr)
  24.         CALL MPI_Win_shared_query(win2, 0, windowsize, disp_unit,&
  25.  baseptr2,ierr)
  26.     end if
  27.  
  28.     ! baseptr can now be associated with a Fortran pointer
  29.     ! and thus used to access the shared data
  30.     CALL C_F_POINTER(baseptr, matrix_elementsy,arrayshape)
  31.     CALL C_F_POINTER(baseptr2, matrix_elementsz,arrayshape)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement