Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
156 commits
Select commit Hold shift + click to select a range
d88b8f1
Add some additional timers around decomp level activity
ekluzek Jun 26, 2025
6cf4b8e
Start adding control for decomp_init self tests and add ability for s…
ekluzek Jun 26, 2025
ae5435b
Merge remote-tracking branch 'escomp/b4b-dev' into add_decomp_init_se…
ekluzek Jun 26, 2025
a27de36
Add namelist controls for self testing
ekluzek Jun 27, 2025
2fd081b
Changes to exit early when self test namelist option used for_testing…
ekluzek Jul 2, 2025
c90d475
Merge branch 'b4b-dev' into add_decomp_init_self_tests
ekluzek Jul 9, 2025
6eaadd4
Bring in the share branch with the memory logger from John Dennis
ekluzek Jul 11, 2025
3a94e8e
Merge remote-tracking branch 'escomp/b4b-dev' into decomp_init_study_…
ekluzek Jul 11, 2025
f18e4b0
Update proc_status_vm to use shr_sys_abort, and iulog from shr_log, a…
ekluzek Jul 11, 2025
71de4c9
Turn off restarts and history and add some timer options as well as t…
ekluzek Jul 11, 2025
efd2129
Fix proc_status_vm from the changes I made, it's now reporting properly
ekluzek Jul 14, 2025
d9e212b
Fix proc_status_vm from the changes I made, it's now reporting properly
ekluzek Jul 14, 2025
213ff9c
Add calls for evaluating memory
ekluzek Jul 14, 2025
0abc15c
Put memory stuff only under masterproc to only report on a single tas…
ekluzek Jul 15, 2025
c1bfd83
Add a PE layout for mpas13p75
ekluzek Jul 29, 2025
3a32519
Start adding timers to lnd_set_decomp_and_domain_from_readmesh
ekluzek Jul 29, 2025
33c8f75
Merge remote-tracking branch 'escomp/b4b-dev' into decomp_init_study_…
ekluzek Jul 29, 2025
d531303
Turn off RTM rather than increase the ROF coupling frequency
ekluzek Jul 30, 2025
402584e
Turn off urban HAC completely and minimize urban in gridcells
ekluzek Jul 30, 2025
31ad846
Add a testmod for mpasa3p75 grid
ekluzek Jul 30, 2025
be81f3a
Add decomp initialization test and test list for ultra high resolutio…
ekluzek Jul 30, 2025
95ab014
Fix syntax and correct 3p75 resolution grid name for test
ekluzek Jul 30, 2025
6ee9077
Still need to set NCPL_ROF
ekluzek Jul 30, 2025
f03a0eb
Fix name of mpasa3p75 testmod in test
ekluzek Jul 30, 2025
ed4c49e
Fix syntax error
ekluzek Jul 30, 2025
b5ab98c
Remove the mpasa15 test from expected fails
ekluzek Jul 30, 2025
8914b12
Add timers for clm_initialize2 that cover the whole subroutine
ekluzek Jul 31, 2025
f294b31
Add another timer within part3, and also turn off some of the history…
ekluzek Jul 31, 2025
1bd2408
Balance check doesn't take time, so adjust the timers again for part3
ekluzek Jul 31, 2025
60bd85e
Add memory checking calls through the lnd_set_decomp_and_domain_from_…
ekluzek Aug 1, 2025
8c5debb
Remove one of the memory checks as it wasn't needed
ekluzek Aug 1, 2025
3f5cff5
Add some timers for clmInstInit
ekluzek Aug 1, 2025
b30d9e0
Combine timers for part3/4/5 as they are all small
ekluzek Aug 1, 2025
373b84c
Add timers for urbantv Init and InitVertical
ekluzek Aug 1, 2025
4f7de29
Add a timer around just the strdata_init
ekluzek Aug 1, 2025
7f03d77
Make an internal subroutine for deallocation inside of lnd_set_decomp…
ekluzek Aug 1, 2025
02f894e
Add release of the ESMF objects in the lnd_set_decomp_and_domain_from…
ekluzek Aug 1, 2025
57b04cd
ESMF tells me that some of these objects are used later and can not b…
ekluzek Aug 1, 2025
8cf101a
Turn on removing all ESMF garbage for the things deleted, and add not…
ekluzek Aug 1, 2025
b47ef38
Merge remote-tracking branch 'escomp/b4b-dev' into add_decomp_init_se…
ekluzek Aug 1, 2025
47dbc1b
Remove the mpasa15 test from expected fails
ekluzek Jul 30, 2025
5bc62fa
Turn off restarts and history and add some timer options as well as t…
ekluzek Jul 11, 2025
f1a4277
Turn off RTM rather than increase the ROF coupling frequency
ekluzek Jul 30, 2025
2b9746b
Still need to set NCPL_ROF
ekluzek Jul 30, 2025
60425cd
Fix syntax error
ekluzek Jul 30, 2025
ccdd13c
Fix XML name for RTM_MODE
ekluzek Aug 1, 2025
9908a81
Fix XML name for RTM_MODE
ekluzek Aug 1, 2025
8fc95c1
Turn off urban HAC completely and minimize urban in gridcells
ekluzek Jul 30, 2025
19fb93d
Keep all self tests on
ekluzek Aug 2, 2025
03722cd
Call shr_malloc_trim so that memory is released by the OS after the d…
ekluzek Aug 4, 2025
635c124
Merge remote-tracking branch 'ekluzek/add_decomp_init_self_tests' int…
ekluzek Aug 4, 2025
4483944
Change memory check to a utility function to call that does everythin…
ekluzek Aug 4, 2025
8cd61a5
Clarify memory check logging
ekluzek Aug 5, 2025
e930f1d
Deallocate lndfrac_loc_input
ekluzek Aug 5, 2025
7b1d3ea
Add timers
ekluzek Aug 6, 2025
6237542
Add more timers
ekluzek Aug 6, 2025
7332c89
Update cdeps with more timers
ekluzek Aug 6, 2025
44a3b45
Add asserts for scalars and also text scalars
ekluzek Aug 11, 2025
82964a0
Add some interfaces and handling for self tests
ekluzek Aug 11, 2025
3e93968
Start adding tests for DecompInit
ekluzek Aug 11, 2025
da2fe56
Start adding tests for DecompInit
ekluzek Aug 11, 2025
d4522af
Add some more logging about self-tests options, and add a normal term…
ekluzek Aug 11, 2025
0481f89
Add return's after endrun calls so that the self-tests can trap expec…
ekluzek Aug 11, 2025
fa64311
Change the endrun message so that it can be tested for
ekluzek Aug 12, 2025
b134a3d
Add more logging, correct the clump_pproc test, flush log write each …
ekluzek Aug 12, 2025
22088aa
Remove ending whitespace, add logging about exiting self-tests, and a…
ekluzek Aug 12, 2025
4b83e4a
Remove terminate_early_without_error because it fails with timers tha…
ekluzek Aug 12, 2025
00f8335
Use iulog at top of module to be available throughout
ekluzek Aug 12, 2025
808720a
Add some new tests for fails that currently fail on the first one
ekluzek Aug 12, 2025
7098a88
Merge branch 'b4b-dev' into decomp_init_for_testing_work
ekluzek Aug 13, 2025
0855d55
Merge remote-tracking branch 'ekluzek/mpasa3p75' into decomp_init_for…
ekluzek Aug 13, 2025
cbf67ec
Merge branch 'endrun_work' into decomp_init_for_testing_work
ekluzek Aug 17, 2025
7c09803
Seperate run_self_tests into a test mod that just sets up the testing…
ekluzek Aug 17, 2025
476088c
Seperate out decomp_init test list into production tests for timing, …
ekluzek Aug 17, 2025
c90b57e
Merge branch 'endrun_work' into decomp_init_for_testing_work
ekluzek Aug 17, 2025
8c2ad44
Make the grid size much smaller and save it at the top of the module,…
ekluzek Aug 20, 2025
9d236ca
Change endrun calls to use new format for file and line, and remove t…
ekluzek Aug 20, 2025
a5612b3
Merge remote-tracking branch 'escomp/b4b-dev' into decomp_init_for_te…
ekluzek Aug 20, 2025
d4ef84a
Make decomp_init single grid case run with mpi-serial
ekluzek Aug 20, 2025
d3178e1
Add for_testing options to namelist handling to bypass init and run
ekluzek Aug 21, 2025
d65ecfb
Turn the bypass init and run logicals for testing on
ekluzek Aug 21, 2025
96e0c94
Add a namelist read and some logical settings to bypass init and run …
ekluzek Aug 21, 2025
f6272ef
Merge remote-tracking branch 'escomp/b4b-dev' into for_testing_bypass…
ekluzek Aug 21, 2025
7006740
Add use of abortutils so can make endrun calls
ekluzek Aug 21, 2025
a1fbe32
Add another error check test, this should fail, as it isn't handeled
ekluzek Aug 22, 2025
ebc6fa4
Merge remote-tracking branch 'escomp/b4b-dev' into decomp_init_for_te…
ekluzek Aug 22, 2025
06daca4
Merge branch 'for_testing_bypass_framework' into decomp_init_for_test…
ekluzek Aug 22, 2025
93628b2
Add bypassing the run phase in the for_testing tests, and remove it f…
ekluzek Aug 22, 2025
208a6d2
Remove some of the previous bypassing changes that aren't needed here
ekluzek Aug 22, 2025
bf663d4
Merge branch 'for_testing_bypass_framework' into decomp_init_for_test…
ekluzek Aug 22, 2025
28834c9
Update bld/namelist_files/namelist_definition_ctsm.xml
ekluzek Aug 22, 2025
92c9a3c
Merge remote-tracking branch 'escomp/b4b-dev' into decomp_init_for_te…
ekluzek Aug 23, 2025
62f3faf
decompInit/decompMod: initialize pointers to null, add checking that …
ekluzek Aug 25, 2025
45903c2
Add a standard ERP test with threading on to the decomp_init testlist…
ekluzek Aug 25, 2025
76d1f5f
Update the share code with a reset option, which turns out to not be …
ekluzek Aug 25, 2025
4bc13a3
Allow get_proc_bounds to exit early if only b3gg/endg will be needed,…
ekluzek Aug 26, 2025
469c108
Return up the chain in decompInit after endrun, for the testing. Do s…
ekluzek Aug 27, 2025
12da9cb
Bypass more code after running the self tests
ekluzek Aug 27, 2025
d325b87
Add calls to redo the decomp calls on the full grid so that get_proc_…
ekluzek Aug 27, 2025
d92cb69
Move bypass code around a bit so that most timers aren't half in/half…
ekluzek Aug 27, 2025
188f229
Also bypass the import fields for_testing option, and move the decomp…
ekluzek Aug 27, 2025
1c17af4
Add unit_test_shr directory to the main model build
ekluzek Aug 29, 2025
f65b59b
Move the get_proc_bounds to inside the bypass
ekluzek Aug 29, 2025
01f2659
Add more tests, remove redoing the decomp with the full grid after th…
ekluzek Aug 29, 2025
256e692
Merge branch 'b4b-dev' into for_testing_bypass_framework
ekluzek Sep 23, 2025
0137dc2
Merge branch 'for_testing_bypass_framework' of github.com:ekluzek/CTS…
ekluzek Sep 23, 2025
69792af
Merge branch 'b4b-dev' into for_testing_bypass_framework
ekluzek Sep 29, 2025
de1ca06
Add namelist controls for self testing
ekluzek Jun 27, 2025
c1c7ca3
Add unit_test_shr directory to the main model build
ekluzek Aug 29, 2025
db4551c
Merge remote-tracking branch 'escomp/b4b-dev' into decomp_init_for_te…
ekluzek Aug 23, 2025
cb8e7ec
Merge remote-tracking branch 'escomp/b4b-dev' into decomp_init_for_te…
ekluzek Aug 22, 2025
09aa5ac
Balance check doesn't take time, so adjust the timers again for part3
ekluzek Jul 31, 2025
bf498ab
Add another timer within part3, and also turn off some of the history…
ekluzek Jul 31, 2025
3c54060
Add timers for clm_initialize2 that cover the whole subroutine
ekluzek Jul 31, 2025
ce2d68b
Change the test grid total size to 384 so can be divisible by either …
ekluzek Sep 2, 2025
2fc723f
Don't do the abort testing if not serial as different tasks won't be …
ekluzek Sep 6, 2025
d8d656b
Change a test to make it valid for clump_pproc or not
ekluzek Sep 8, 2025
4ce6b5f
Just do the checking over the local processor clumps and not all the …
ekluzek Sep 14, 2025
7dc7dcd
Resolve the conflicts
ekluzek Oct 1, 2025
2a46724
Remove some of the previous bypassing changes that aren't needed here
ekluzek Aug 22, 2025
c95b886
Move bypass code around a bit so that most timers aren't half in/half…
ekluzek Aug 27, 2025
86382c6
Also bypass the import fields for_testing option, and move the decomp…
ekluzek Aug 27, 2025
dac0ae0
Move the get_proc_bounds to inside the bypass
ekluzek Aug 29, 2025
e867afe
Changes to exit early when self test namelist option used for_testing…
ekluzek Jul 2, 2025
d19b894
Add asserts for scalars and also text scalars
ekluzek Aug 11, 2025
a5d5b5c
Revert most of 2fd081b544 so removing the changes regarding the addit…
ekluzek Oct 1, 2025
b3185c0
Move some for_testing namelist items into the selftests driver namelist
ekluzek Oct 1, 2025
1acf630
Remove the uneeded timers and get back to the 3 part timers as they s…
ekluzek Oct 1, 2025
2636975
Remove some changes from the baseline code that aren't needed especia…
ekluzek Oct 1, 2025
def2c97
Remove TestDecompInit for now, bring it in, in another PR
ekluzek Oct 2, 2025
bf947fb
Remove the update to Assertions and bring it in, in another PR
ekluzek Oct 2, 2025
80192dc
Remove update in DecompInitMod for now
ekluzek Oct 2, 2025
7dbdecf
Merge branch 'for_testing_bypass_framework' into decomp_init_for_test…
ekluzek Oct 2, 2025
77e0fc7
Revert most of 2fd081b544 so removing the changes regarding the addit…
ekluzek Oct 1, 2025
71e3dec
Get branch to align with the for_testing_bypass_framework branch in o…
ekluzek Oct 2, 2025
43ffa1c
Don't do the abort testing if not serial as different tasks won't be …
ekluzek Sep 6, 2025
1c6f200
Change a test to make it valid for clump_pproc or not
ekluzek Sep 8, 2025
aca1c1f
Just do the checking over the local processor clumps and not all the …
ekluzek Sep 14, 2025
c53fe7e
Change the test grid total size to 384 so can be divisible by either …
ekluzek Sep 2, 2025
f2c1874
Remove update in DecompInitMod for now
ekluzek Oct 2, 2025
4923bd3
Add new test directory for decomp_init error testing
ekluzek Oct 3, 2025
f44dc0c
Add new tests to the cmake
ekluzek Oct 3, 2025
116f3b6
Return early if no tests are asked for, and clarify log
ekluzek Oct 3, 2025
0af4ee2
Some changes needed to get the PF unit test working, move one abort t…
ekluzek Oct 3, 2025
60d85de
Move the failure tests over to the PF unit tester
ekluzek Oct 3, 2025
5d1951c
Add files needed for decompInit testing
ekluzek Oct 3, 2025
9cf9853
Pull in FATES source as well for unit testing so they are available f…
ekluzek Oct 3, 2025
6aa3a22
Remove a comment no longer needed
ekluzek Oct 3, 2025
df19381
Merge branch 'b4b-dev' into for_testing_bypass_framework
ekluzek Oct 3, 2025
1abc5c3
Merge branch 'b4b-dev' into decomp_init_for_testing_work
ekluzek Oct 3, 2025
173de26
Update to a FATES branch hash
ekluzek Oct 3, 2025
417922d
Merge branch 'b4b-dev' into for_testing_bypass_framework
ekluzek Oct 4, 2025
c3edd6c
Merge branch 'for_testing_bypass_framework' into decomp_init_for_test…
ekluzek Oct 4, 2025
911d72f
A few changes from the add_decomp_init_unittest branch, and some work…
ekluzek Oct 5, 2025
0daaa55
List the dependencies for each top level target in one line for brevi…
ekluzek Oct 5, 2025
4cfd8e4
Remove the handling of stub shr_mpi_mod and shr_pio_mod in the unit t…
ekluzek Oct 5, 2025
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
7 changes: 5 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@
#
[submodule "fates"]
path = src/fates
url = https://github.com/NGEET/fates
fxtag = sci.1.87.2_api.41.0.0
#url = https://github.com/NGEET/fates
url = https://github.com/ekluzek/fates
#fxtag = sci.1.87.2_api.41.0.0
#fxtag = add_file_to_cmake_unittest_list
fxtag = fa4016d1b59ffdb509a7833da113a88872a8a56c
fxrequired = AlwaysRequired
# Standard Fork to compare to with "git fleximod test" to ensure personal forks aren't committed
fxDONOTUSEurl = https://github.com/NGEET/fates
Expand Down
1 change: 1 addition & 0 deletions bld/CLMBuildNamelist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5315,6 +5315,7 @@ sub write_output_files {
push @groups, "clm_canopy_inparm";
push @groups, "prigentroughness";
push @groups, "zendersoilerod";
push @groups, "for_testing_options";
if (remove_leading_and_trailing_quotes($nl->get_value('snow_cover_fraction_method')) eq 'SwensonLawrence2012') {
push @groups, "scf_swenson_lawrence_2012_inparm";
}
Expand Down
28 changes: 27 additions & 1 deletion bld/namelist_files/namelist_definition_ctsm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1259,12 +1259,38 @@ Whether to use subgrid fluxes for snow
Whether snow on the vegetation canopy affects the radiation/albedo calculations
</entry>

<!-- ======================================================================================== -->
<!-- Namelist items for doing specific things for testing -->
<!-- for_testing section: -->
<!-- ======================================================================================== -->

<entry id="for_testing_bypass_init" type="logical" category="default_settings"
group="for_testing_options" >
For testing whether to bypass the rest of the initialization after the self test driver is run
</entry>

<entry id="for_testing_bypass_run" type="logical" category="default_settings"
group="for_testing_options" >
For testing whether to bypass most of the run phase other than the clock advance
</entry>

<entry id="for_testing_exit_after_self_tests" type="logical" category="default_settings"
group="for_testing_options" >
Whether to exit early after the initialization self tests are run. This is typically only used in automated tests.
</entry>

<entry id="for_testing_run_ncdiopio_tests" type="logical" category="default_settings"
group="clm_inparm" >
group="for_testing_options" >
Whether to run some tests of ncdio_pio as part of the model run. This is
typically only used in automated tests.
</entry>

<entry id="for_testing_run_decomp_init_tests" type="logical" category="default_settings"
group="for_testing_options" >
Whether to run some tests of decompInit (to get the gridcell to MPI task decomposition) as part of the model run. This is
typically only used in automated tests.
</entry>

<entry id="for_testing_use_second_grain_pool" type="logical" category="default_settings"
group="clm_inparm" >
If true, allocate memory for and use a second crop grain pool. This is
Expand Down
1 change: 1 addition & 0 deletions cime_config/buildlib
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ def _main_func():
os.path.join(lnd_root, "src", "dyn_subgrid"),
os.path.join(lnd_root, "src", "init_interp"),
os.path.join(lnd_root, "src", "self_tests"),
os.path.join(lnd_root, "src", "unit_test_shr"),
os.path.join(lnd_root, "src", "fates"),
os.path.join(lnd_root, "src", "fates", "main"),
os.path.join(lnd_root, "src", "fates", "biogeophys"),
Expand Down
7 changes: 0 additions & 7 deletions cime_config/testdefs/ExpectedTestFails.xml
Original file line number Diff line number Diff line change
Expand Up @@ -381,13 +381,6 @@

<!-- decomp_init test list-->

<test name="SMS_Ln1_PL.mpasa15_mpasa15.I2000Clm45Sp.derecho_intel.clm-run_self_tests">
<phase name="RUN">
<status>FAIL</status>
<issue>#3316</issue>
</phase>
</test>

<!-- interim_restart (and aux_clm) test list-->

<test name="ERR_Ld7.f10_f10_mg37.I2000Clm50BgcCropRtm.derecho_gnu.clm-default">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
! Exit early and bypass the run phase
for_testing_exit_after_self_tests = .true.

! Turn off history, restarts, and output
hist_empty_htapes = .true.
use_noio = .true.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
./xmlchange CLM_FORCE_COLDSTART="on"

# We use this testmod in a _Ln1 test; this requires forcing the ROF coupling frequency to every time step
./xmlchange ROF_NCPL=48

# Restarts aren't allowed for these tests, and turn off CPL history
./xmlchange REST_OPTION="never"
./xmlchange HIST_OPTION="never"
10 changes: 10 additions & 0 deletions cime_config/testdefs/testmods_dirs/clm/run_self_tests/user_nl_clm
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
! Bypass as much of the init phase as can be done
! Bypassing the run phase already was inherited from the for_testing_fastsetup_bypassrun testmod
for_testing_bypass_init = .true.

! Turn on some of the self tests
for_testing_run_ncdiopio_tests = .true.
for_testing_run_decomp_init_tests = .true.

! Turn off history, restarts, and output
hist_empty_htapes = .true.
use_noio = .true.
for_testing_run_decomp_init_tests = .true.

! Exit initialization phase after the self tests
for_testing_bypass_init = .true.
38 changes: 13 additions & 25 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,41 +59,29 @@ add_subdirectory(${CLM_ROOT}/src/main clm_main)
add_subdirectory(${CLM_ROOT}/src/init_interp clm_init_interp)
add_subdirectory(${CLM_ROOT}/src/self_tests clm_self_tests)

# Add FATES source directories
add_subdirectory(${CLM_ROOT}/src/fates/main fates_main)
add_subdirectory(${CLM_ROOT}/src/fates/biogeochem fates_biogeochem)
add_subdirectory(${CLM_ROOT}/src/fates/biogeophys fates_biogeophys)
add_subdirectory(${CLM_ROOT}/src/fates/parteh fates_parteh)
add_subdirectory(${CLM_ROOT}/src/fates/fire fates_fire)
add_subdirectory(${CLM_ROOT}/src/fates/radiation fates_radiation)

# Add general unit test directories (stubbed out files, etc.)
add_subdirectory(unit_test_stubs)
add_subdirectory(unit_test_shr)

# Remove some things from share_sources
#
# TODO: this should be moved into a general-purpose function in Sourcelist_utils.
# Then each removal could be replaced with a single call, like:
# remove_source_file(${share_sources} "shr_mpi_mod.F90")
foreach (sourcefile ${share_sources})
# Remove shr_mpi_mod from share_sources.
# This is needed because we want to use the mock shr_mpi_mod in place of the real one
string(REGEX MATCH "shr_mpi_mod.F90" match_found ${sourcefile})
if(match_found)
list(REMOVE_ITEM share_sources ${sourcefile})
endif()

# Remove shr_pio_mod from share_sources. This is needed to avoid an explicit dependency
# on PIO. This removal is needed on some systems but not on others: the unit test build
# works without this removal on a Mac with a pre-built PIO library, but failed (with
# error message, "Cannot open module file 'pio.mod'") on a Mac without a pre-built PIO
# (where ESMF was built with its internal PIO).
string(REGEX MATCH "shr_pio_mod.F90" match_found ${sourcefile})
if(match_found)
list(REMOVE_ITEM share_sources ${sourcefile})
endif()
endforeach()

# Build libraries containing stuff needed for the unit tests.
# Eventually, these add_library calls should probably be distributed into the correct location, rather than being in this top-level CMakeLists.txt file.
add_library(csm_share ${share_sources} ${drv_sources_needed})
declare_generated_dependencies(csm_share "${share_genf90_sources}")
add_library(clm ${clm_sources})
add_library(fates ${fates_sources})
declare_generated_dependencies(clm "${clm_genf90_sources}")
add_dependencies(clm csm_share esmf)
# Add explicit dependencies to lower level libraries, for each library
add_dependencies(csm_share esmf)
add_dependencies(clm fates csm_share esmf)
add_dependencies(fates csm_share esmf)

# We need to look for header files here, in order to pick up shr_assert.h
include_directories(${CLM_ROOT}/share/include)
Expand Down
36 changes: 33 additions & 3 deletions src/cpl/nuopc/lnd_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ module lnd_comp_nuopc
use lnd_import_export , only : advertise_fields, realize_fields, import_fields, export_fields
use lnd_comp_shr , only : mesh, model_meshfile, model_clock
use perf_mod , only : t_startf, t_stopf, t_barrierf
use SelfTestDriver , only : for_testing_exit_after_self_tests

implicit none
private ! except
Expand Down Expand Up @@ -351,6 +352,8 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
use lnd_set_decomp_and_domain , only : lnd_set_decomp_and_domain_from_readmesh
use lnd_set_decomp_and_domain , only : lnd_set_mesh_for_single_column
use lnd_set_decomp_and_domain , only : lnd_set_decomp_and_domain_for_single_column
use SelfTestDriver , only : for_testing_bypass_init_after_self_tests, &
for_testing_exit_after_self_tests

! input/output variables
type(ESMF_GridComp) :: gcomp
Expand Down Expand Up @@ -500,6 +503,12 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
else
single_column = .false.
end if
!if ( for_testing_exit_after_self_tests) then
! *******************
! *** RETURN HERE ***
! *******************
!RETURN
!end if

!----------------------------------------------------------------------------
! Reset shr logging to my log file
Expand Down Expand Up @@ -676,14 +685,19 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
call t_startf('clm_init2')
call initialize2(ni, nj, currtime)
call t_stopf('clm_init2')
if (for_testing_exit_after_self_tests) then
RETURN
end if

!--------------------------------
! Create land export state
!--------------------------------
if ( .not. for_testing_bypass_init_after_self_tests() ) then
call get_proc_bounds(bounds)
call export_fields(gcomp, bounds, glc_present, rof_prognostic, &
water_inst%waterlnd2atmbulk_inst, lnd2atm_inst, lnd2glc_inst, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
end if

! Set scalars in export state
call State_SetScalar(dble(ldomain%ni), flds_scalar_index_nx, exportState, &
Expand Down Expand Up @@ -731,6 +745,7 @@ subroutine ModelAdvance(gcomp, rc)
use clm_instMod , only : water_inst, atm2lnd_inst, glc2lnd_inst, lnd2atm_inst, lnd2glc_inst
use decompMod , only : bounds_type, get_proc_bounds
use clm_driver , only : clm_drv
use SelfTestDriver, only : for_testing_bypass_init_after_self_tests

! input/output variables
type(ESMF_GridComp) :: gcomp
Expand Down Expand Up @@ -786,6 +801,9 @@ subroutine ModelAdvance(gcomp, rc)
if (single_column .and. .not. scol_valid) then
RETURN
end if
!if (for_testing_exit_after_self_tests) then
! RETURN
!end if

!$ call omp_set_num_threads(nthrds)

Expand Down Expand Up @@ -818,16 +836,20 @@ subroutine ModelAdvance(gcomp, rc)
flds_scalar_index_nextsw_cday, nextsw_cday, &
flds_scalar_name, flds_scalar_num, rc)

! Get proc bounds
call get_proc_bounds(bounds)

!--------------------------------
! Unpack import state
!--------------------------------

if ( .not. for_testing_bypass_init_after_self_tests() ) then
! Get proc bounds for both import and export
call get_proc_bounds(bounds)

call t_startf ('lc_lnd_import')
call import_fields( gcomp, bounds, glc_present, rof_prognostic, &
atm2lnd_inst, glc2lnd_inst, water_inst%wateratm2lndbulk_inst, rc )
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call t_stopf ('lc_lnd_import')
end if

!--------------------------------
! Run model
Expand Down Expand Up @@ -917,9 +939,13 @@ subroutine ModelAdvance(gcomp, rc)
! Pack export state
!--------------------------------

if ( .not. for_testing_bypass_init_after_self_tests() ) then
call t_startf ('lc_lnd_export')
call export_fields(gcomp, bounds, glc_present, rof_prognostic, &
water_inst%waterlnd2atmbulk_inst, lnd2atm_inst, lnd2glc_inst, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call t_stopf ('lc_lnd_export')
end if

!--------------------------------
! Advance ctsm time step
Expand Down Expand Up @@ -1009,6 +1035,7 @@ subroutine ModelSetRunClock(gcomp, rc)
rc = ESMF_SUCCESS
call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO)
if (.not. scol_valid) return
!if (for_testing_exit_after_self_tests) return

! query the Component for its clocks
call NUOPC_ModelGet(gcomp, driverClock=dclock, modelClock=mclock, rc=rc)
Expand Down Expand Up @@ -1320,6 +1347,9 @@ subroutine CheckImport(gcomp, rc)
if (single_column .and. .not. scol_valid) then
RETURN
end if
!if (for_testing_exit_after_self_tests) then
!RETURN
!end if
! The remander of this should be equivalent to the NUOPC internal routine
! from NUOPC_ModeBase.F90

Expand Down
2 changes: 1 addition & 1 deletion src/fates
2 changes: 2 additions & 0 deletions src/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ list(APPEND clm_sources
clm_varsur.F90
column_varcon.F90
decompMod.F90
decompInitMod.F90
filterColMod.F90
FireMethodType.F90
glc2lndMod.F90
Expand All @@ -30,6 +31,7 @@ list(APPEND clm_sources
ncdio_utils.F90
organicFileMod.F90
paramUtilMod.F90
subgridMod.F90
subgridAveMod.F90
subgridWeightsMod.F90
surfrdUtilsMod.F90
Expand Down
7 changes: 7 additions & 0 deletions src/main/clm_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ module clm_driver
use clm_instMod
use SoilMoistureStreamMod , only : PrescribedSoilMoistureInterp, PrescribedSoilMoistureAdvance
use SoilBiogeochemDecompCascadeConType , only : no_soil_decomp, decomp_method
use SelfTestDriver , only : for_testing_bypass_run_except_clock_advance
!
! !PUBLIC TYPES:
implicit none
Expand Down Expand Up @@ -165,6 +166,7 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro
! CalcIrrigationNeeded. Simply declaring this variable makes the ICE go away.
real(r8), allocatable :: dummy1_to_make_pgi_happy(:)
!-----------------------------------------------------------------------
if ( for_testing_bypass_run_except_clock_advance() ) return

! Determine processor bounds and clumps for this processor

Expand Down Expand Up @@ -1576,6 +1578,8 @@ subroutine clm_drv_init(bounds, &
integer :: fp, fc ! filter indices
!-----------------------------------------------------------------------

if ( for_testing_bypass_run_except_clock_advance() ) return

associate( &
snl => col%snl , & ! Input: [integer (:) ] number of snow layers

Expand Down Expand Up @@ -1657,6 +1661,7 @@ subroutine clm_drv_patch2col (bounds, &
! !LOCAL VARIABLES:
integer :: c,fc ! indices
! -----------------------------------------------------------------
if ( for_testing_bypass_run_except_clock_advance() ) return

! Note: lake points are excluded from many of the following
! averages. For some fields, this is because the field doesn't
Expand Down Expand Up @@ -1752,6 +1757,8 @@ subroutine write_diagnostic (bounds, nstep, lnd2atm_inst)
integer :: status(MPI_STATUS_SIZE) ! mpi status
!------------------------------------------------------------------------

if ( for_testing_bypass_run_except_clock_advance() ) return

call get_proc_global(ng=numg)

if (masterproc) then
Expand Down
Loading
Loading