shm_alloc_r Subroutine

private subroutine shm_alloc_r(ndim, lubd, a1, a2, a3, tag, label, ierror)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: ndim
integer, intent(in) :: lubd(2*ndim)
real, intent(inout), optional, pointer :: a1(:)
real, intent(inout), optional, pointer :: a2(:,:)
real, intent(inout), optional, pointer :: a3(:,:,:)
integer, intent(out), optional :: tag
character(len=maxlen), intent(in), optional :: label
integer, intent(out), optional :: ierror

Contents

Source Code


Source Code

  subroutine shm_alloc_r(ndim, lubd, a1, a2, a3, tag, label, ierror)
    use, intrinsic :: iso_c_binding, only : c_f_pointer, c_loc
    implicit none
    ! allocated shared array and stores the information in shm_info
    integer, intent(in) :: ndim ! array rank
    integer, intent(in) :: lubd(2*ndim) ! upper * lowee bound in the following format (s1, e1, s2, e2, ...)
    real, pointer, optional, intent(inout) :: a1(:), a2(:,:), a3(:,:,:)
    integer, optional, intent(out) :: tag
    character(len=maxlen), optional, intent(in) :: label
    integer, intent(out), optional :: ierror 
    
    type(c_ptr) :: base_ptr
    integer(KIND=MPI_ADDRESS_KIND) asize
    integer disp, id, i, win, ierr
    integer, allocatable :: ashape(:)
    real x ! for sizeof 

    !sanity checks
    if ( ndim == 1 .and. .not. present(a1) .or. &
         ndim == 2 .and. .not. present(a2) .or. &
         ndim == 3 .and. .not. present(a3) ) then
       call error_abort("inconsistent ndim and optional array argumnent in shm_alloc call")
    end if

    if (present(ierror)) ierror = 0

    !call MPI_type_size(MPI_DOUBLE_PRECISION,disp,ierr)
   

    include "shm_mpi3_alloc_tmpl.inc"

  end subroutine shm_alloc_r