Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test ESMF_GridComp creation performance #2894

Open
wants to merge 31 commits into
base: release/MAPL-v3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
f50415a
Create driver and cap
darianboggs Jul 1, 2024
fa5a70e
Additional functionality
darianboggs Jul 2, 2024
ea33e89
Latest changes to push up
darianboggs Jul 2, 2024
0cbf7a4
Change file and module names
darianboggs Jul 2, 2024
811a078
Original implentation
darianboggs Jul 3, 2024
f5b96e9
First attempt
darianboggs Jul 3, 2024
cadc828
Add constants module (back)
darianboggs Jul 4, 2024
8b1c80f
Latest changes; needs troubleshooting
darianboggs Jul 4, 2024
7a0c08a
Time tests working; move under `benchmarks/esmf/`
darianboggs Jul 5, 2024
79d67ad
remove unused files; change dir in CMakeLists.txt
darianboggs Jul 5, 2024
33873da
Edit CMakeLists.txt files for directory move
darianboggs Jul 5, 2024
73ed459
Update CHANGELOG.md
darianboggs Jul 5, 2024
dd2822e
Update with memory profile and multiple processes
darianboggs Jul 10, 2024
e863696
Tests complete
darianboggs Jul 10, 2024
1860722
Eliminate npes command argument; simplify output
darianboggs Jul 10, 2024
75af9f0
Returning 0 memory change
darianboggs Jul 11, 2024
5f2fd39
Make gridcomp creation test work for mpi
darianboggs Jul 17, 2024
9825ba7
Merge branch 'release/MAPL-v3' into test/wdboggs/grid_comp_creation_v3
darianboggs Jul 17, 2024
7f0b5b0
Update CHANGELOG.md
darianboggs Jul 17, 2024
3259acb
Additional changes for regular PR
darianboggs Jul 19, 2024
8411ec1
Merge branch 'release/MAPL-v3' into test/wdboggs/grid_comp_creation_v3
darianboggs Jul 24, 2024
c3ca4d4
Modify creation to share parent VM
darianboggs Aug 2, 2024
4ae2642
Impl. shared VM for gridcomp_creation benchmark
darianboggs Aug 5, 2024
c9a0610
Implement vm choice
darianboggs Aug 8, 2024
7615c58
Merge branch 'release/MAPL-v3' into test/wdboggs/grid_comp_creation_v3
darianboggs Aug 8, 2024
991f0f9
Merge branch 'release/MAPL-v3' into test/wdboggs/grid_comp_creation_v3
darianboggs Aug 19, 2024
b0f8248
Fix bug with String length
darianboggs Aug 19, 2024
c2cee9d
Add option to use own vm. Clean up unneeded code.
darianboggs Aug 19, 2024
6a16b84
Merge branch 'release/MAPL-v3' into test/wdboggs/grid_comp_creation_v3
darianboggs Aug 20, 2024
e350840
Merge branch 'release/MAPL-v3' into test/wdboggs/grid_comp_creation_v3
darianboggs Aug 20, 2024
99e4de2
Merge branch 'release/MAPL-v3' into test/wdboggs/grid_comp_creation_v3
darianboggs Aug 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [v3.0.0 - Development]
- Added benchmark to test creation of ESMF_GridComp objects

### Removed

Expand Down Expand Up @@ -36,6 +37,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added capability for HistoryCollectionGridComp to extract field names from expressions
- Added ability for HistoryCollectionGridComp to extract multiple field names from expressions
- Added vertical and ungridded dimensions to output for History3G
- Added benchmark to test the performance of gridcomp creation

### Changed

Expand Down
1 change: 1 addition & 0 deletions benchmarks/esmf/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
set(exe gc_run.x)

add_subdirectory(gridcomp_creation)
ecbuild_add_executable (
TARGET ${exe}
SOURCES gc_run.F90)
Expand Down
16 changes: 16 additions & 0 deletions benchmarks/esmf/gridcomp_creation/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
set(exe gridcomp_create.x)
set(MODULE_DIRECTORY ${esma_include}/benchmarks/esmf/gridcomp_creation)

ecbuild_add_executable (
TARGET ${exe}
SOURCES GridCompCreationTester.F90 GridCompCreator.F90 GridCompCreationShared.F90 GridCompCreatorMemoryProfile.F90
)

target_link_libraries (${exe} PRIVATE MAPL.shared MAPL.base ESMF::ESMF )
target_include_directories (${exe} PUBLIC $<BUILD_INTERFACE:${MAPL_SOURCE_DIR}/include>)
set_target_properties (${exe} PROPERTIES Fortran_MODULE_DIRECTORY ${MODULE_DIRECTORY})

# CMake has an OpenMP issue with NAG Fortran: https://gitlab.kitware.com/cmake/cmake/-/issues/21280
if (NOT CMAKE_Fortran_COMPILER_ID MATCHES "NAG")
target_link_libraries(${exe} PRIVATE OpenMP::OpenMP_Fortran)
endif ()
56 changes: 56 additions & 0 deletions benchmarks/esmf/gridcomp_creation/GridCompCreationShared.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
module grid_comp_creation_shared

use, intrinsic :: iso_fortran_env, only: R64 => real64

implicit none
private
public :: to_characters
public :: MAXSTR
public :: JOIN

integer, parameter :: MAXSTR = 256
character(len=*), parameter :: JOIN = ', '

interface to_characters
module procedure :: real_to_characters
module procedure :: integer_to_characters
end interface to_characters

contains

function real_to_characters(t, fixed, rc) result(chars)
character(len=:), allocatable :: chars
real(R64), intent(in) :: t
logical, optional, intent(in) :: fixed
integer, optional, intent(out) :: rc
integer :: status
integer, parameter :: TW = 12
character(len=TW), parameter :: SF = '( ES24.16 )'
character(len=TW), parameter :: FD = '( F8.4 )'
character(len=TW) :: FMT_
character(len=MAXSTR) :: raw

FMT_ = SF
if(present(fixed)) then
if(fixed) FMT_ = FD
end if
write(raw, fmt=FMT_, iostat=status) t
if(present(rc)) rc = status
chars = trim(adjustl(raw))

end function real_to_characters

function integer_to_characters(n, rc) result(chars)
character(len=:), allocatable :: chars
integer, intent(in) :: n
integer, optional, intent(out) :: rc
integer :: status
character(len=MAXSTR) :: raw

write(raw, fmt='(I0)', iostat=status) n
if(present(rc)) rc = status
chars = trim(adjustl(raw))

end function integer_to_characters

end module grid_comp_creation_shared
49 changes: 49 additions & 0 deletions benchmarks/esmf/gridcomp_creation/GridCompCreationTester.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
program grid_comp_creation_tester

use grid_comp_creation_shared
use grid_comp_creator
use grid_comp_creator_memory_profiler

implicit none

integer, parameter :: SUCCESS = 0
integer, parameter :: GENERAL_ERROR = 1
integer, parameter :: NGC_NOT_SET = 2*GENERAL_ERROR
integer, parameter :: RUN_FAILED = 2*NGC_NOT_SET

character(len=*), parameter :: OPTION_USE_OWN_VM = '--use-own-vm'

integer :: rc, status
integer :: ngc
character(len=MAXSTR) :: raw
integer :: i, n
logical :: is_silent = .TRUE.
logical :: use_own_vm = .FALSE.

rc = SUCCESS
ngc = -1
do i = 1, command_argument_count()
call get_command_argument(i, value=raw, status=status)
if(status /= SUCCESS) cycle
raw = adjustl(raw)
if(raw == OPTION_USE_OWN_VM) then
use_own_vm = .TRUE.
cycle
end if
read(raw, fmt='(I32)', iostat=status) n
if(status == SUCCESS) ngc = n
end do

if(ngc < 0) then
rc = rc + NGC_NOT_SET
error stop rc, QUIET=is_silent
end if

call run(ngc, use_own_vm, status)

if(status /= SUCCESS) rc = rc + RUN_FAILED
rc = finalize()
if(rc == SUCCESS) stop rc, QUIET=is_silent
error stop rc, QUIET=is_silent

end program grid_comp_creation_tester
Loading