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

Add ExtData Testing Framework #1556

Merged
merged 17 commits into from
Jun 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ workflows:
repo: MAPL
mepodevelop: false
run_unit_tests: true
ctest_options: "-LE PERFORMANCE --output-on-failure"
ctest_options: "-LE 'PERFORMANCE|EXTDATA1G_BIG_TESTS|EXTDATA2G_BIG_TESTS' --output-on-failure"

# Builds MAPL in a "default" way - GNU
#
Expand All @@ -41,7 +41,7 @@ workflows:
repo: MAPL
mepodevelop: false
run_unit_tests: true
ctest_options: "-E bundleio -LE PERFORMANCE --output-on-failure"
ctest_options: "-E bundleio -LE 'PERFORMANCE|EXTDATA1G_BIG_TESTS|EXTDATA2G_BIG_TESTS' --output-on-failure"

# Builds MAPL like UFS does (no FLAP and pFlogger, static)
- ci/build:
Expand All @@ -55,7 +55,7 @@ workflows:
mepodevelop: false
extra_cmake_options: "-DBUILD_WITH_FLAP=OFF -DBUILD_WITH_PFLOGGER=OFF -DBUILD_SHARED_MAPL=OFF"
run_unit_tests: true
ctest_options: "-LE PERFORMANCE --output-on-failure"
ctest_options: "-LE 'PERFORMANCE|EXTDATA1G_BIG_TESTS|EXTDATA2G_BIG_TESTS' --output-on-failure"

# Build GEOSgcm
- ci/build:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
#
# For now, we run GNU/Open MPI without the bundleio tests. Some indications that
# Open MPI 5 will not have this limitation
ctest -E bundleio -LE PERFORMANCE --output-on-failure
ctest -E bundleio -LE 'PERFORMANCE|EXTDATA1G_BIG_TESTS|EXTDATA2G_BIG_TESTS' --output-on-failure
build_test_mapl_intel:
name: Build and Test MAPL Intel
runs-on: ubuntu-latest
Expand Down Expand Up @@ -114,4 +114,4 @@ jobs:
cd build
make -j4 build-tests
# skip performance tests
ctest -LE PERFORMANCE --output-on-failure
ctest -LE 'PERFORMANCE|EXTDATA1G_BIG_TESTS|EXTDATA2G_BIG_TESTS' --output-on-failure
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Enable GCM run test in CircleCI (1-hour, no ExtData)
- Added monotonic regridding option
- Make availalbe to History and ExtData2G all supported regridding methods
- Add test cases for ExtData

### Changed

Expand Down
5 changes: 1 addition & 4 deletions Tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ if (BUILD_WITH_FLAP)
target_link_libraries(pfio_MAPL_demo.x PRIVATE OpenMP::OpenMP_Fortran)
endif ()
set_target_properties(pfio_MAPL_demo.x PROPERTIES Fortran_MODULE_DIRECTORY ${MODULE_DIRECTORY})
add_subdirectory(ExtData_Testing_Framework EXCLUDE_FROM_ALL)

endif ()

#install(PROGRAMS ExtDataDriver.x DESTINATION bin)
#install(TARGETS ExtDataDriver.x DESTINATION bin)

51 changes: 51 additions & 0 deletions Tests/ExtData_Testing_Framework/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Detect if we are using Open MPI and add oversubscribe
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")
endif()

file(STRINGS "test_cases/cases.txt" TEST_CASES)

set(cutoff "7")

foreach(TEST_CASE ${TEST_CASES})
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)
else()
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")
else()
set_tests_properties ("ExtData1G_${TEST_CASE}" PROPERTIES LABELS "EXTDATA1G_BIG_TESTS")
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")
else()
set_tests_properties ("ExtData2G_${TEST_CASE}" PROPERTIES LABELS "EXTDATA2G_BIG_TESTS")
endif()
endforeach()
30 changes: 30 additions & 0 deletions Tests/ExtData_Testing_Framework/run_extdata.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
macro(run_case CASE)
string(RANDOM LENGTH 24 tempdir)
execute_process(
COMMAND ${CMAKE_COMMAND} -E make_directory ${tempdir}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_LIST_DIR}/test_cases/${CASE} ${tempdir}
)
if (EXISTS "${tempdir}/nproc.rc")
file(READ "${tempdir}/nproc.rc" num_procs_temp)
string(STRIP ${num_procs_temp} num_procs)
else()
set(num_procs "1")
endif()
if (${IS_EXTDATA2G} STREQUAL "YES")
file(APPEND "${tempdir}/CAP1.rc" "USE_EXTDATA2G: .true.")
file(APPEND "${tempdir}/CAP2.rc" "USE_EXTDATA2G: .true.")
endif()
execute_process(
COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${num_procs} ${MPIEXEC_PREFLAGS} ${MY_BINARY_DIR}/ExtDataDriver.x
RESULT_VARIABLE CMD_RESULT
WORKING_DIRECTORY ${tempdir}
#COMMAND_ECHO STDOUT
)
execute_process(
COMMAND ${CMAKE_COMMAND} -E rm -rf ${tempdir}
)
if(CMD_RESULT)
message(FATAL_ERROR "Error running ${CASE}")
endif()
endmacro()
run_case(${TEST_CASE})
24 changes: 24 additions & 0 deletions Tests/ExtData_Testing_Framework/test_cases/case1/AGCM1.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
NX: 1
NY: 1

Root.GRID_TYPE: LatLon
Root.GRIDNAME: DC90x45-PC
Root.LM: 3
Root.IM_WORLD: 90
Root.JM_WORLD: 45
Root.POLE: 'PC'
Root.DATELINE: 'DC'

RUN_MODE: GenerateExports

EXPORT_STATE::
VAR2D , time , days , xy , c
VAR3D , time , days , xyz , c
::

FILL_DEF::
VAR2D time
VAR3D time
::

REF_TIME: 20040701 000000
29 changes: 29 additions & 0 deletions Tests/ExtData_Testing_Framework/test_cases/case1/AGCM2.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
NX: 1
NY: 1

Root.GRID_TYPE: LatLon
Root.GRIDNAME: DC90x45-PC
Root.LM: 3
Root.IM_WORLD: 90
Root.JM_WORLD: 45
Root.POLE: 'PC'
Root.DATELINE: 'DC'

RUN_MODE: CompareImports

IMPORT_STATE::
VAR2D , time , days , xy , c
VAR3D , time , days , xyz , c
::

EXPORT_STATE::
VAR2D , time , days , xy , c
VAR3D , time , days , xyz , c
::

FILL_DEF::
VAR2D time
VAR3D time
::

REF_TIME: 20040701 000000
4 changes: 4 additions & 0 deletions Tests/ExtData_Testing_Framework/test_cases/case1/CAP.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
CASES::
CAP1.rc
CAP2.rc
::
25 changes: 25 additions & 0 deletions Tests/ExtData_Testing_Framework/test_cases/case1/CAP1.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
ROOT_NAME: Root
ROOT_CF: AGCM1.rc
HIST_CF: HISTORY1.rc

BEG_DATE: 20040101 210000

JOB_SGMT: 00001200 000000
HEARTBEAT_DT: 3600

#RUN_EXTDATA: .false.
RUN_TIMES::
20040115 210000
20040215 210000
20040315 210000
20040415 210000
20040515 210000
20040615 210000
20040715 210000
20040815 210000
20040915 210000
20041015 210000
20041115 210000
20041215 210000
::

15 changes: 15 additions & 0 deletions Tests/ExtData_Testing_Framework/test_cases/case1/CAP2.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ROOT_NAME: Root
ROOT_CF: AGCM2.rc
HIST_CF: HISTORY2.rc

BEG_DATE: 20040101 210000

JOB_SGMT: 00001200 000000
HEARTBEAT_DT: 3600

#RUN_EXTDATA: .false.
RUN_TIMES::
20041125 210000
20041126 210000
::

13 changes: 13 additions & 0 deletions Tests/ExtData_Testing_Framework/test_cases/case1/ExtData.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#CASE_SENSITIVE_VARIABLE_NAMES: .false.
Ext_AllowExtrap: .false.
Prefetch: .true.
#DEBUG_LEVEL: 20

PrimaryExports%%
VAR2D NA N N 0 none none VAR2D case1.%y4.nc4
VAR3D NA N N 0 none none VAR3D case1.%y4.nc4
%%


DerivedExports%%
%%
13 changes: 13 additions & 0 deletions Tests/ExtData_Testing_Framework/test_cases/case1/HISTORY1.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
GRID_LABELS:
::

COLLECTIONS: case1
::

case1.template: '%y4.nc4',
case1.format: 'CFIO',
case1.frequency: 010000,
case1.duration: 000000
case1.fields: 'VAR2D', 'Root',
'VAR3D', 'Root',
::
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
GRID_LABELS:
::

COLLECTIONS:
::
1 change: 1 addition & 0 deletions Tests/ExtData_Testing_Framework/test_cases/case1/README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Case, 12-month/12 time 2004 file with 2 updates, non-climatology
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Collections:
fstream1: {template: case1.%y4.nc4, valid_range: "2004-01-01/2005-01-01" }
Exports:
VAR2D: {variable: VAR2D, collection: fstream1}
VAR3D: {variable: VAR3D, collection: fstream1}
22 changes: 22 additions & 0 deletions Tests/ExtData_Testing_Framework/test_cases/case10/AGCM1.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
NX: 1
NY: 1

Root.GRID_TYPE: LatLon
Root.GRIDNAME: DC90x45-PC
Root.LM: 3
Root.IM_WORLD: 90
Root.JM_WORLD: 45
Root.POLE: 'PC'
Root.DATELINE: 'DC'

RUN_MODE: GenerateExports

EXPORT_STATE::
VAR2D , time , days , xy , c
::

FILL_DEF::
VAR2D time
::

REF_TIME: 20040701 000000
27 changes: 27 additions & 0 deletions Tests/ExtData_Testing_Framework/test_cases/case10/AGCM2.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
NX: 1
NY: 1

Root.GRID_TYPE: LatLon
Root.GRIDNAME: DC900x45-PC
Root.LM: 3
Root.IM_WORLD: 90
Root.JM_WORLD: 45
Root.POLE: 'PC'
Root.DATELINE: 'DC'

RUN_MODE: CompareImports

IMPORT_STATE::
VAR2D , time , days , xy , c
::

EXPORT_STATE::
VAR2D , time , days , xy , c
::

FILL_DEF::
VAR2D time
::

CLIM_YEAR: 2005
REF_TIME: 20040701 000000
4 changes: 4 additions & 0 deletions Tests/ExtData_Testing_Framework/test_cases/case10/CAP.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
CASES::
CAP1.rc
CAP2.rc
::
36 changes: 36 additions & 0 deletions Tests/ExtData_Testing_Framework/test_cases/case10/CAP1.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
ROOT_NAME: Root
ROOT_CF: AGCM1.rc
HIST_CF: HISTORY1.rc

BEG_DATE: 20040101 210000

JOB_SGMT: 00002400 000000
HEARTBEAT_DT: 3600

RUN_TIMES::
20040115 210000
20040215 210000
20040315 210000
20040415 210000
20040515 210000
20040615 210000
20040715 210000
20040815 210000
20040915 210000
20041015 210000
20041115 210000
20041215 210000
20050115 210000
20050215 210000
20050315 210000
20050415 210000
20050515 210000
20050615 210000
20050715 210000
20050815 210000
20050915 210000
20051015 210000
20051115 210000
20051215 210000
::

14 changes: 14 additions & 0 deletions Tests/ExtData_Testing_Framework/test_cases/case10/CAP2.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
ROOT_NAME: Root
ROOT_CF: AGCM2.rc
HIST_CF: HISTORY2.rc

BEG_DATE: 20060101 210000

JOB_SGMT: 00001200 000000
HEARTBEAT_DT: 3600

#RUN_EXTDATA: .false.
RUN_TIMES::
20060225 210000
::

Loading