Skip to content

Commit

Permalink
Merge pull request #2887 from GEOS-ESM/develop
Browse files Browse the repository at this point in the history
GitFlow: Merge develop into main for 2.47 release
  • Loading branch information
mathomp4 authored Jun 24, 2024
2 parents b76ba1a + 894a6a4 commit 2b97398
Show file tree
Hide file tree
Showing 23 changed files with 1,066 additions and 547 deletions.
9 changes: 5 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ parameters:

# Anchors to prevent forgetting to update a version
os_version: &os_version ubuntu20
baselibs_version: &baselibs_version v7.24.0
bcs_version: &bcs_version v11.3.0
baselibs_version: &baselibs_version v7.23.0
bcs_version: &bcs_version v11.5.0
tag_build_arg_name: &tag_build_arg_name maplversion

orbs:
Expand Down Expand Up @@ -49,15 +49,16 @@ workflows:
- docker-hub-creds
matrix:
parameters:
compiler: [ifort]
compiler: [gfortran, ifort]
baselibs_version: *baselibs_version
repo: MAPL
mepodevelop: false
remove_flap: true
remove_pflogger: true
extra_cmake_options: "-DBUILD_WITH_FLAP=OFF -DBUILD_WITH_PFLOGGER=OFF -DBUILD_WITH_FARGPARSE=OFF -DUSE_EXTDATA2G=OFF -DBUILD_SHARED_MAPL=OFF"
run_unit_tests: true
ctest_options: "-L 'ESSENTIAL' --output-on-failure"
# ExtData1G tests were removed from ESSENTIAL, so we run them separately here as UFS might still use 1G?
ctest_options: "-L 'ESSENTIAL|EXTDATA1G_SMALL_TESTS' --output-on-failure"

# Run MAPL Tutorials
- ci/run_mapl_tutorial:
Expand Down
368 changes: 206 additions & 162 deletions Apps/MAPL_GridCompSpecs_ACG.py

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions Apps/Regrid_Util.F90
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module regrid_util_support_mod
integer :: deflate, shave
integer :: quantize_algorithm
integer :: quantize_level
logical :: use_weights
contains
procedure :: create_grid
procedure :: process_command_line
Expand Down Expand Up @@ -97,6 +98,7 @@ subroutine process_command_line(this,rc)
this%deflate=0
this%quantize_algorithm=1
this%quantize_level=0
this%use_weights = .false.
nargs = command_argument_count()
do i=1,nargs
call get_command_argument(i,str)
Expand Down Expand Up @@ -159,6 +161,8 @@ subroutine process_command_line(this,rc)
case('-quantize_level')
call get_command_argument(i+1,astr)
read(astr,*)this%quantize_level
case('-file_weights')
this%use_weights = .true.
case('--help')
if (mapl_am_I_root()) then

Expand Down Expand Up @@ -413,9 +417,9 @@ subroutine main()
if (mapl_am_i_root()) write(*,*)'processing timestep from '//trim(filename)
time = tSeries(i)
if (support%onlyvars) then
call MAPL_Read_bundle(bundle,trim(filename),time=time,regrid_method=support%regridMethod,only_vars=support%vars,_RC)
call MAPL_Read_bundle(bundle,trim(filename),time=time,regrid_method=support%regridMethod,only_vars=support%vars,file_weights=support%use_weights, _RC)
else
call MAPL_Read_bundle(bundle,trim(filename),time=time,regrid_method=support%regridMethod,_RC)
call MAPL_Read_bundle(bundle,trim(filename),time=time,regrid_method=support%regridMethod,file_weights=support%use_weights, _RC)
end if
call t_prof%stop("Read")

Expand Down
34 changes: 31 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,36 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Deprecated

## [2.47.0] - 2024-06-24

### Added

- Add new option to `Regrid_Util.x` to write and re-use ESMF pregenerated weights
- If file path length exceeds `ESMF_MAXSTR`, add `_FAIL` in subroutine fglob
- Add GNU UFS-like CI test
- Add capability to mangle `LONG_NAME` in ACG with a different prefix

### Changed

- pFIO Clients don't send "Done" message when there is no request
- Update `components.yaml`
- ESMA_cmake v3.46.0
- Fix bugs in meson detection
- Fix for building on older macOS
- Add `esma_add_fortran_submodules` function
- Updated `checkpoint_simulator` to not create and close file if not writing
- Update ExtData tests
- Add new category of `SLOW` tests that take 10-30 seconds and remove them from the `ESSENTIAL`
label run in CI
- Remove ExtData1G tests from `ESSENTIAL` label, but run them in the UFS-like CI test
- Improved timing for station sampler with GHCNd input: used LocStream with CS background, LS with uniform distributed points, and `MPI_GatherV`

### Fixed

- Fixed a bug in `generate_newnxy` in `MAPL_SwathGridFactory.F90` (`NX*NY=Ncore`)
- Fixes for NVHPC 24.5
- Convert `MAPL_GeosatMaskMod` to "interface-in-both-files" submodule style

## [2.46.2] - 2024-05-31

### Removed
Expand All @@ -36,9 +66,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Update `FindESMF.cmake` to match that in ESMF 8.6.1

### Changed

- Add timer to the sampler code
- Set required version of ESMF to 8.6.1
- Update `components.yaml`
- ESMA_cmake v3.45.0
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ endif ()

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

# Set the possible values of build type for cmake-gui
Expand Down
83 changes: 49 additions & 34 deletions Tests/ExtData_Testing_Framework/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,63 +2,78 @@
string(REPLACE " " ";" MPI_Fortran_LIBRARY_VERSION_LIST ${MPI_Fortran_LIBRARY_VERSION_STRING})
list(GET MPI_Fortran_LIBRARY_VERSION_LIST 0 MPI_Fortran_LIBRARY_VERSION_FIRSTWORD)
if(MPI_Fortran_LIBRARY_VERSION_FIRSTWORD MATCHES "Open")
list(APPEND MPIEXEC_PREFLAGS "-oversubscribe")
list(APPEND MPIEXEC_PREFLAGS "-oversubscribe")
endif()

file(STRINGS "test_cases/extdata_1g_cases.txt" TEST_CASES_1G)

set(cutoff "7")

# We want to make a list of tests that are slow and can
# be skipped for ESSENTIAL testing. Most ExtData tests
# take 1-2 seconds at most, but some take 20-30 seconds.
set(SLOW_TESTS
"case6"
"case14"
"case15"
"case16"
"case20"
"case22"
"case23"
)

foreach(TEST_CASE ${TEST_CASES_1G})
if (EXISTS ${CMAKE_CURRENT_LIST_DIR}/test_cases/${TEST_CASE}/nproc.rc)
file(READ ${CMAKE_CURRENT_LIST_DIR}/test_cases/${TEST_CASE}/nproc.rc num_procs)
file(READ ${CMAKE_CURRENT_LIST_DIR}/test_cases/${TEST_CASE}/nproc.rc num_procs)
else()
set(num_procs "1")
set(num_procs "1")
endif()
add_test(
NAME "ExtData1G_${TEST_CASE}"
COMMAND ${CMAKE_COMMAND}
-DTEST_CASE=${TEST_CASE}
-DMPIEXEC_EXECUTABLE=${MPIEXEC_EXECUTABLE}
-DMPIEXEC_NUMPROC_FLAG=${MPIEXEC_NUMPROC_FLAG}
-DMY_BINARY_DIR=${CMAKE_BINARY_DIR}/bin
-DMPIEXEC_PREFLAGS=${MPIEXEC_PREFLAGS}
-DIS_EXTDATA2G=NO
-P ${CMAKE_CURRENT_SOURCE_DIR}/run_extdata.cmake
)
if (${num_procs} LESS ${cutoff})
set_tests_properties ("ExtData1G_${TEST_CASE}" PROPERTIES LABELS "EXTDATA1G_SMALL_TESTS")
set_tests_properties ("ExtData1G_${TEST_CASE}" PROPERTIES LABELS "ESSENTIAL")
NAME "ExtData1G_${TEST_CASE}"
COMMAND ${CMAKE_COMMAND}
-DTEST_CASE=${TEST_CASE}
-DMPIEXEC_EXECUTABLE=${MPIEXEC_EXECUTABLE}
-DMPIEXEC_NUMPROC_FLAG=${MPIEXEC_NUMPROC_FLAG}
-DMY_BINARY_DIR=${CMAKE_BINARY_DIR}/bin
-DMPIEXEC_PREFLAGS=${MPIEXEC_PREFLAGS}
-DIS_EXTDATA2G=NO
-P ${CMAKE_CURRENT_SOURCE_DIR}/run_extdata.cmake
)
if (${num_procs} GREATER ${cutoff})
set_tests_properties ("ExtData1G_${TEST_CASE}" PROPERTIES LABELS "EXTDATA1G_BIG_TESTS")
elseif (${TEST_CASE} IN_LIST SLOW_TESTS)
set_tests_properties ("ExtData1G_${TEST_CASE}" PROPERTIES LABELS "EXTDATA1G_SLOW_TESTS")
else()
set_tests_properties ("ExtData1G_${TEST_CASE}" PROPERTIES LABELS "EXTDATA1G_BIG_TESTS")
set_tests_properties ("ExtData1G_${TEST_CASE}" PROPERTIES LABELS "EXTDATA1G_SMALL_TESTS")
endif()

endforeach()

file(STRINGS "test_cases/extdata_2g_cases.txt" TEST_CASES_2G)

foreach(TEST_CASE ${TEST_CASES_2G})

if (EXISTS ${CMAKE_CURRENT_LIST_DIR}/test_cases/${TEST_CASE}/nproc.rc)
file(READ ${CMAKE_CURRENT_LIST_DIR}/test_cases/${TEST_CASE}/nproc.rc num_procs)
file(READ ${CMAKE_CURRENT_LIST_DIR}/test_cases/${TEST_CASE}/nproc.rc num_procs)
else()
set(num_procs "1")
set(num_procs "1")
endif()
add_test(
NAME "ExtData2G_${TEST_CASE}"
COMMAND ${CMAKE_COMMAND}
-DTEST_CASE=${TEST_CASE}
-DMPIEXEC_EXECUTABLE=${MPIEXEC_EXECUTABLE}
-DMPIEXEC_NUMPROC_FLAG=${MPIEXEC_NUMPROC_FLAG}
-DMY_BINARY_DIR=${CMAKE_BINARY_DIR}/bin
-DMPIEXEC_PREFLAGS=${MPIEXEC_PREFLAGS}
-DIS_EXTDATA2G=YES
-P ${CMAKE_CURRENT_SOURCE_DIR}/run_extdata.cmake
)
if (${num_procs} LESS ${cutoff})
set_tests_properties ("ExtData2G_${TEST_CASE}" PROPERTIES LABELS "EXTDATA2G_SMALL_TESTS")
set_tests_properties ("ExtData2G_${TEST_CASE}" PROPERTIES LABELS "ESSENTIAL")
NAME "ExtData2G_${TEST_CASE}"
COMMAND ${CMAKE_COMMAND}
-DTEST_CASE=${TEST_CASE}
-DMPIEXEC_EXECUTABLE=${MPIEXEC_EXECUTABLE}
-DMPIEXEC_NUMPROC_FLAG=${MPIEXEC_NUMPROC_FLAG}
-DMY_BINARY_DIR=${CMAKE_BINARY_DIR}/bin
-DMPIEXEC_PREFLAGS=${MPIEXEC_PREFLAGS}
-DIS_EXTDATA2G=YES
-P ${CMAKE_CURRENT_SOURCE_DIR}/run_extdata.cmake
)
if (${num_procs} GREATER ${cutoff})
set_tests_properties ("ExtData2G_${TEST_CASE}" PROPERTIES LABELS "EXTDATA2G_BIG_TESTS")
elseif (${TEST_CASE} IN_LIST SLOW_TESTS)
set_tests_properties ("ExtData2G_${TEST_CASE}" PROPERTIES LABELS "EXTDATA2G_SLOW_TESTS")
else()
set_tests_properties ("ExtData2G_${TEST_CASE}" PROPERTIES LABELS "EXTDATA2G_BIG_TESTS")
set_tests_properties ("ExtData2G_${TEST_CASE}" PROPERTIES LABELS "EXTDATA2G_SMALL_TESTS")
set_tests_properties ("ExtData2G_${TEST_CASE}" PROPERTIES LABELS "ESSENTIAL")
endif()
endforeach()
7 changes: 6 additions & 1 deletion base/MAPL_ObsUtil.F90
Original file line number Diff line number Diff line change
Expand Up @@ -941,11 +941,16 @@ subroutine fglob(search_name, filename, rc) ! give the last name

character(kind=C_CHAR, len=:), allocatable :: c_search_name
character(kind=C_CHAR, len=512) :: c_filename
integer slen
integer :: slen, lenmax

c_search_name = trim(search_name)//C_NULL_CHAR
rc = f_call_c_glob(c_search_name, c_filename, slen)
filename=""
lenmax = len(filename)
if (lenmax < slen) then
if (MAPL_AM_I_ROOT()) write(6,*) 'pathlen vs filename_max_char_len: ', slen, lenmax
_FAIL ('PATHLEN is greater than filename_max_char_len')
end if
if (slen>0) filename(1:slen)=c_filename(1:slen)

return
Expand Down
58 changes: 30 additions & 28 deletions base/MAPL_SwathGridFactory.F90
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,8 @@ function make_new_grid(this, unusable, rc) result(grid)

_UNUSED_DUMMY(unusable)

!!if (mapl_am_I_root()) write(6,*) 'MAPL_SwathGridFactory.F90: bf this%create_basic_grid'
grid = this%create_basic_grid(_RC)
!!if (mapl_am_I_root()) write(6,*) 'MAPL_SwathGridFactory.F90: af this%create_basic_grid'
call this%add_horz_coordinates_from_file(grid,_RC)
!!if (mapl_am_I_root()) write(6,*) 'MAPL_SwathGridFactory.F90: af this%add_horz_coordinates_from_file'

_RETURN(_SUCCESS)
end function make_new_grid

Expand Down Expand Up @@ -483,6 +479,7 @@ subroutine initialize_from_config_with_prefix(this, config, prefix, unusable, rc

call lgr%debug(' %a %a', 'CurrTime =', trim(tmp))


if ( index(tmp, 'T') /= 0 .OR. index(tmp, '-') /= 0 ) then
call ESMF_TimeSet(currTime, timeString=tmp, _RC)
else
Expand Down Expand Up @@ -718,6 +715,7 @@ subroutine initialize_from_config_with_prefix(this, config, prefix, unusable, rc
endif
! ims is set at here
call this%check_and_fill_consistency(_RC)
call lgr%debug(' %a %i5 %i5', 'nx, ny (check_and_fill_consistency) = ', this%nx, this%ny)

_RETURN(_SUCCESS)

Expand Down Expand Up @@ -864,7 +862,6 @@ subroutine check_and_fill_consistency(this, unusable, rc)
call this%generate_newnxy(_RC)
end if
end if

_RETURN(_SUCCESS)

contains
Expand Down Expand Up @@ -1145,43 +1142,48 @@ subroutine generate_newnxy(this,unusable,rc)
class (KeywordEnforcer), optional, intent(in) :: unusable
integer, optional, intent(out) :: rc
integer :: n
integer :: j, pet_count

_UNUSED_DUMMY(unusable)

pet_count = this%nx * this%ny
n = this%im_world/this%nx
if (n < 2) then
this%nx = generate_new_decomp(this%im_world,this%nx)
deallocate(this%ims)
allocate(this%ims(0:this%nx-1))
call MAPL_DecomposeDim(this%im_world, this%ims, this%nx)
do j = this%im_world/2, 1, -1
if ( mod(pet_count, j) == 0 .and. this%im_world/j >= 2 ) then
exit ! found a decomposition
end if
end do
this%nx = j
this%ny = pet_count/j
end if

n = this%jm_world/this%ny
if (n < 2) then
this%ny = generate_new_decomp(this%jm_world,this%ny)
deallocate(this%jms)
allocate(this%jms(0:this%ny-1))
call MAPL_DecomposeDim(this%jm_world, this%jms, this%ny)
do j = this%jm_world/2, 1, -1
if ( mod(pet_count, j) == 0 .and. this%jm_world/j >=2 ) then
exit ! found a decomposition
end if
end do
this%ny = j
this%nx = pet_count/j
end if

if ( this%im_world/this%nx < 2 .OR. this%jm_world/this%ny < 2 ) then
_FAIL ('Algorithm failed')
end if

if (allocated(this%ims)) deallocate(this%ims)
allocate(this%ims(0:this%nx-1))
call MAPL_DecomposeDim(this%im_world, this%ims, this%nx)
if (allocated(this%jms)) deallocate(this%jms)
allocate(this%jms(0:this%ny-1))
call MAPL_DecomposeDim(this%jm_world, this%jms, this%ny)

_RETURN(_SUCCESS)

end subroutine generate_newnxy

function generate_new_decomp(im,nd) result(n)
integer, intent(in) :: im, nd
integer :: n
logical :: canNotDecomp

canNotDecomp = .true.
n = nd
do while(canNotDecomp)
if ( (im/n) < 2) then
n = n/2
else
canNotDecomp = .false.
end if
enddo
end function generate_new_decomp

subroutine init_halo(this, unusable, rc)
class (SwathGridFactory), target, intent(inout) :: this
Expand Down
6 changes: 3 additions & 3 deletions benchmarks/io/checkpoint_simulator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ The code has the following options and needs an ESMF rc file named checkpoint\_b
- "NX:" the x distribution for each face
- "NY:" the y distribution for each face
- "IM\_WORLD:" the cube resolution
- "LM:" the nubmer of levels
- "LM:" the number of levels
- "NUM\_WRITERS:" the number of writing processes either to a single or independent files
- "NUM\_ARRAYS:" the number of 3D variables to write to the file
- "CHUNK:" whether to chunk, default true
- "GATHER\_3D:" gather all levels at once (default is false which means a level at a time is gathered)
- "SPLIT\_FILE:" default false, if true, each writer writes to and independent file
- "WRITE\_BARRIER:" default false, add a barrier before each write to for synchronization
- "DO\_WRITES:" default true, if false skips writing (so just an mpi test at that point)
- "NTRIAL:" default 1, the number of trials to make writing
- "NTRIALS:" default 1, the number of trials to make writing
- "RANDOM\_DATA:" default true, if true will arrays with random data, if false sets the array to the rank of the process

Note that whatever you set NX and NY to the program must be run on 6*NY*NY processors and the number of writers must evenly divide 6*NY
Note that whatever you set NX and NY to the program must be run on `6*NX*NY` processors and the number of writers must evenly divide `6*NY`
Loading

0 comments on commit 2b97398

Please sign in to comment.