Skip to content

Commit

Permalink
Add 6DR8 Alloc/Dealloc to Shmem on 2.6 branch
Browse files Browse the repository at this point in the history
  • Loading branch information
mathomp4 committed Aug 4, 2021
1 parent a106ed0 commit 8e962bd
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 4 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
### Fixed

## [2.6.8]
## [2.6.9] - 2021-08-04

### Added

- Added `MAPL_AllocNodeArray_6DR8` and `MAPL_DeAllocNodeArray_6DR8` to Shmem

## [2.6.8] - 2021-05-20

### Changed

Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cmake_policy (SET CMP0054 NEW)

project (
MAPL
VERSION 2.6.8
VERSION 2.6.9
LANGUAGES Fortran CXX C) # Note - CXX is required for ESMF

if (EXISTS ${CMAKE_CURRENT_LIST_DIR}/ESMA_cmake)
Expand Down
13 changes: 13 additions & 0 deletions shared/Shmem/Shmem.F90
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ end subroutine perror
module procedure MAPL_AllocNodeArray_3DR8
module procedure MAPL_AllocNodeArray_4DR8
module procedure MAPL_AllocNodeArray_5DR8
module procedure MAPL_AllocNodeArray_6DR8
end interface MAPL_AllocNodeArray

interface MAPL_DeAllocNodeArray
Expand All @@ -139,6 +140,7 @@ end subroutine perror
module procedure MAPL_DeAllocNodeArray_3DR8
module procedure MAPL_DeAllocNodeArray_4DR8
module procedure MAPL_DeAllocNodeArray_5DR8
module procedure MAPL_DeAllocNodeArray_6DR8
end interface MAPL_DeAllocNodeArray

interface MAPL_BroadcastToNodes
Expand Down Expand Up @@ -253,6 +255,11 @@ module subroutine MAPL_DeAllocNodeArray_5DR8(Ptr,rc)
integer, optional, intent(OUT) :: rc
end subroutine MAPL_DeAllocNodeArray_5DR8

module subroutine MAPL_DeAllocNodeArray_6DR8(Ptr,rc)
real(kind=REAL64), pointer :: Ptr(:,:,:,:,:,:)
integer, optional, intent(OUT) :: rc
end subroutine MAPL_DeAllocNodeArray_6DR8

module subroutine MAPL_AllocNodeArray_1DL4(Ptr, Shp, lbd, rc)
logical, pointer, intent(INOUT) :: Ptr(:)
integer, intent(IN ) :: Shp(1)
Expand Down Expand Up @@ -355,6 +362,12 @@ module subroutine MAPL_AllocNodeArray_5DR8(Ptr, Shp, lbd, rc)
integer, optional, intent( OUT) :: rc
end subroutine MAPL_AllocNodeArray_5DR8

module subroutine MAPL_AllocNodeArray_6DR8(Ptr, Shp, lbd, rc)
real(kind=REAL64), pointer, intent(INOUT) :: Ptr(:,:,:,:,:,:)
integer, intent(IN ) :: Shp(6)
integer, optional, intent(IN ) :: lbd(6)
integer, optional, intent( OUT) :: rc
end subroutine MAPL_AllocNodeArray_6DR8

module subroutine MAPL_AllocateShared_1DL4(Ptr, Shp, lbd, TransRoot, rc)
logical, pointer, intent(INOUT) :: Ptr(:)
Expand Down
43 changes: 41 additions & 2 deletions shared/Shmem/Shmem_implementation.F90
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,23 @@
_VERIFY(STATUS)

_RETURN(SHM_SUCCESS)
end procedure MAPL_DeAllocNodeArray_5DR8
end procedure MAPL_DeAllocNodeArray_5DR8

module procedure MAPL_DeAllocNodeArray_6DR8

type(c_ptr) :: Caddr
integer :: STATUS

if(.not.MAPL_ShmInitialized) then
_RETURN(MAPL_NoShm)
endif

Caddr = C_Loc(Ptr(lbound(Ptr,1),lbound(Ptr,2),lbound(Ptr,3),lbound(Ptr,4),lbound(Ptr,5),lbound(Ptr,6)))
call ReleaseSharedMemory(Caddr,rc=STATUS)
_VERIFY(STATUS)

_RETURN(SHM_SUCCESS)
end procedure MAPL_DeAllocNodeArray_6DR8

module procedure MAPL_AllocNodeArray_1DL4
implicit none
Expand Down Expand Up @@ -664,7 +680,30 @@
if(present(lbd)) Ptr(lbd(1):,lbd(2):,lbd(3):,lbd(4):,lbd(5):) => Ptr

_RETURN(SHM_SUCCESS)
end procedure MAPL_AllocNodeArray_5DR8
end procedure MAPL_AllocNodeArray_5DR8

module procedure MAPL_AllocNodeArray_6DR8

type(c_ptr) :: Caddr
integer len, STATUS

_UNUSED_DUMMY(lbd)
if(.not.MAPL_ShmInitialized) then
_RETURN(MAPL_NoShm)
endif

len=product(Shp)*2

call GetSharedMemory(Caddr, len, rc=STATUS)
_VERIFY(STATUS)

call c_f_pointer(Caddr, Ptr, Shp) ! C ptr to Fortran ptr
_ASSERT(all(shape(Ptr)==Shp),'needs informative message')

if(present(lbd)) Ptr(lbd(1):,lbd(2):,lbd(3):,lbd(4):,lbd(5):,lbd(6):) => Ptr

_RETURN(SHM_SUCCESS)
end procedure MAPL_AllocNodeArray_6DR8


module procedure MAPL_AllocateShared_1DL4
Expand Down

0 comments on commit 8e962bd

Please sign in to comment.