safe_shared_memory_alloc_cmplx Subroutine

private subroutine safe_shared_memory_alloc_cmplx(this, size, name)

Wrapper for shared_allocate_mpi that tests if the pointer is associated @param[out] win MPI shared memory window for internal MPI usage @param[out] ptr pointer to be allocated, on return points to a shared memory segment of given size @param[in] size size of the memory segment to be allocated

Type Bound

shared_array_cmplx_t

Arguments

Type IntentOptional Attributes Name
class(shared_array_cmplx_t) :: this
integer(kind=int64), intent(in) :: size
character(len=*), intent(in), optional :: name

Contents


Source Code

    subroutine safe_shared_memory_alloc_cmplx (this, size, name)

        class(shared_array_cmplx_t) :: this
        integer(int64), intent(in) :: size
        character(*), intent(in), optional :: name
        character(*), parameter :: t_r = "shared_alloc"

        ! if pointer was allocated prior, re-allocate the probabilities
        ! WARNING: DO NOT MANUALLY RE-ASSIGN ptr, THIS WILL MOST LIKELY BREAK STUFF
        call safe_shared_memory_dealloc_cmplx (this)
        call shared_allocate_mpi(this%win, this%ptr, (/size/))

        ! If a name is given, log the allocation
        if (associated(this%ptr) .and. present(name)) &
            call LogMemAlloc(name, size, sizeof(this%ptr(1)), t_r, this%tag)
    end subroutine safe_shared_memory_alloc_cmplx