-
Notifications
You must be signed in to change notification settings - Fork 355
Changes to enable easily turning on CUPiD diagnostics from your CTSM case #3689
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
Draft
ekluzek
wants to merge
53
commits into
master
Choose a base branch
from
CUPiD
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
499c13f
Add CUPiD to the submodule checkout
ekluzek a0f4094
CIME assumes a certain case for CUPiD
ekluzek 22bcd8c
Add note about the addition of CUPiD under tools
ekluzek 133475d
Change name of the CUPiD directory so that it uses the name assumed i…
ekluzek 99ecd8e
Update README.DIAG to use the CUPiD usermod directory
ekluzek 9493442
Rename for clarity
ekluzek 3d368b6
Add note about new README
ekluzek b21026d
Update CUPiD version to include pinned environments
ekluzek 0ef3c92
Fix the generate issue for CUPiD
ekluzek 675ce37
Adjust options a bit, and also change the generate step so it only ha…
ekluzek e870c10
Add a simple test to run CUPiD
ekluzek 5630cbd
Add another one time thing to do
ekluzek e463fe7
Update to a version that is working
ekluzek baa6088
Turn off some options that weren't working, and add setting DOUT_S to…
ekluzek d8d1d4b
Shift the CUPiD test to run f19 rather than f09, and IHist rather tha…
ekluzek 256a8d4
Merge branch 'master' into CUPiD
ekluzek e6c38c2
Update CUPiD to Will's land_only example version
ekluzek 76bb364
Merge branch 'CUPiD' of github.com:ESCOMP/CTSM into CUPiD
ekluzek 203a391
Merge tag 'ctsm5.4.011' into CUPiD
ekluzek 91e8267
Start adding a CUPiD system test, change the CUPiD test mod to use th…
ekluzek 8c5904d
Change the name of the cupid test, since having the _c in the testnam…
ekluzek 714de30
Merge branch 'master' into CUPiD
ekluzek c2b8893
Merge branch 'CUPiD' of github.com:ESCOMP/CTSM into CUPiD
ekluzek 04c3b25
Turn off LDF for default setup
ekluzek d4e5826
Simple list of archive tests for CUPiD options
ekluzek d333a31
Simple archive test and CUPiD testmods for the different CUPiD option…
ekluzek 28fbcb8
Add more needed to get a full CUPiD test working
ekluzek a33dfea
Add setup for SMSAR and SMSCUPID tests
ekluzek b91b731
Correct variable names
ekluzek a06eb03
At least CUPID_RUN_LND needs to be on for both ILAMB or LDF
ekluzek 95acbfc
Add a aux_cupid testlist and add a testmod for making HTML pages
ekluzek dc7043d
Update CUPiD to Will's latest
ekluzek 9588dd3
Turn HTML off, don't set TASKS or RUN_TYPE want to see if we can set …
ekluzek 1b0b82a
Rename SSMAR system tests to SMSPOSTPROC
ekluzek 7880d35
Add references to CUPiD documentation as per review
ekluzek fcd4f5f
Remove the bit about DOUT_S, as the system tests make this right, and…
ekluzek 12a59b7
Add a note that you have to remake the conda environments if you use …
ekluzek 513bad9
Adjust the CUPiD tests, make sure there are ones for LDF, ILAMB, plai…
ekluzek be2ee8d
Remove subgroup as it is not a valid option for testlist in cime
ekluzek ccdf717
Fix ending quote
ekluzek 47a2d17
Change the wallclock for the CUPiD tests to 40 minutes as the 5-year …
ekluzek fccfe81
Add the CUPiD_web testmod
ekluzek 9cd53ff
The ROF CUPiD test needs to be at f09 resolution
ekluzek 9de67a4
Update CUPiD to latest version from yesterday
ekluzek 3ce39c9
Update CUPiD submodule
ekluzek 2f81186
Update to latest CUPiD changes, fix LDF and ILAMB issues
ekluzek e9e1a74
Set base case settings
ekluzek 755a2aa
Merge branch 'CUPiD' of github.com:ESCOMP/CTSM into CUPiD
ekluzek 9059b4f
Point to latest land_only
ekluzek ed1ba8d
Update CUPiD to remove the softlink for the LDF config file
ekluzek ababf70
Get the settings to align with what we want based on the Tutorial dis…
ekluzek 2da82e5
Set the CUPID timeseries directory to the cupid_output location
ekluzek 65cc473
Two settings that I missed
ekluzek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| # QuickStart to Running Diagnostics of your Case with CUPiD (CESM Unified Postprocessing and Diagnostics) | ||
|
|
||
| [!NOTE] | ||
| Land Diagnostics Cheat Sheet is here: | ||
|
|
||
| This document has more details on more options and such | ||
|
|
||
| https://ncar.github.io/CUPiD/run_cesm.html | ||
|
|
||
| ## Initial setup steps to do first time | ||
|
|
||
| This step is something you need to do the first time you want to run CUPiD for a case. | ||
| And you only need to do it again if the CUPiD environment changes -- or if you need to | ||
| setup the environment for a different CTSM checkout. | ||
|
|
||
| ``` shell | ||
| # CUPiD instructions for this is here: https://ncar.github.io/CUPiD/index.html#installing | ||
| cd tools/CUPiD | ||
| mamba env create --yes -f environments/cupid-infrastructure.yml | ||
| mamba env create --yes -f environments/cupid-analysis.yml | ||
| # Check that the environment is valid | ||
| conda activate cupid-infrastructure | ||
| which cupid-diagnostics | ||
| # Should return something like: | ||
| # $HOME/conda-envs/cupid-infrastructure/bin/cupid-diagnostics | ||
| # If it returns "Command not found." something is wrong with the environment | ||
|
|
||
| # Instructions for the next part are here: | ||
| # https://ncar.github.io/CUPiD/index.html#note | ||
| # Now make sure the conda environments can be used by Jupyter notebooks | ||
| conda activate cupid-analysis | ||
| python -m ipykernel install --user --name=cupid-analysis | ||
| conda activate cupid-infrastructure | ||
| python -m ipykernel install --user --name=cupid-infrastructure | ||
| ``` | ||
|
|
||
| <!-- ========================================================================================== --> | ||
| #### IMPORTANT NOTE: You have to REMAKE THE CUPiD ENVIRONMENTS for a different CTSM Checkout | ||
| <!-- ========================================================================================== --> | ||
|
|
||
|
|
||
| > [!IMPORTANT] | ||
| > If you want to use CUPiD in a different clone of CTSM -- you'll need to remake the environments there. | ||
|
|
||
| ## Create your case using the CUPiD user-mod | ||
|
|
||
| This is similar to setting up any case, such as documented in the README and Quickstart guides. | ||
|
|
||
| ``` shell | ||
| ./create_newcase --case testIwCUPiD --res f09_t232 --compset I2000Clm60BgcCrop --user-mods-dirs clm-CUPiD | ||
| ``` | ||
|
|
||
| ## Run CUPID in your case | ||
|
|
||
| After st_archive has run do the following. With RUN_POSTPROCESSING set to TRUE this will happen | ||
| with each case submission automatically. But, if you want to run it separately... | ||
|
|
||
|
|
||
| ``` shell | ||
| ./case.submit --only-job case.cupid | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
|
|
||
| from CIME.test_status import * | ||
|
|
||
| CUPID_PHASE = "CUPID" | ||
|
|
||
| ALL_PHASES = [ | ||
| CREATE_NEWCASE_PHASE, | ||
| XML_PHASE, | ||
| SETUP_PHASE, | ||
| NAMELIST_PHASE, | ||
| SHAREDLIB_BUILD_PHASE, | ||
| MODEL_BUILD_PHASE, | ||
| SUBMIT_PHASE, | ||
| RUN_PHASE, | ||
| COMPARE_PHASE, | ||
| BASELINE_PHASE, | ||
| THROUGHPUT_PHASE, | ||
| MEMCOMP_PHASE, | ||
| MEMLEAK_PHASE, | ||
| STARCHIVE_PHASE, | ||
| CUPID_PHASE, | ||
| GENERATE_PHASE, | ||
| ] | ||
|
|
||
| # Extend the TestStatus class to include the CUPID phase and have CUPID phase within ALL_PHASES | ||
| class CTSMTestStatus(TestStatus): | ||
|
|
||
| def __init__(self, case): | ||
| super().__init__(case, ALL_PHASES) | ||
| self._test_status = CTSMTestStatus(test_dir=case.get_value("CASEROOT"), test_name=self.case.get_value("CASEBASEID") ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| from CIME.SystemTests.sms import SMS | ||
| from ctsm_test_status import * | ||
|
|
||
|
|
||
| class SMSCUPID(SMS): | ||
| def __init__(self, case): | ||
| super().__init__(case) | ||
| self._test_status = CTSMTestStatus( | ||
| test_dir=self._case.get_value("CASEROOT"), | ||
| test_name=self._case.get_value("CASEBASEID"), | ||
| ) | ||
|
|
||
| def setup_indv( | ||
| self, clean=False, test_mode=False, reset=False, keep=False, disable_git=False | ||
| ): | ||
| """ | ||
| Perform an individual setup | ||
| """ | ||
| super().setup_indv( | ||
| clean=clean, | ||
| test_mode=test_mode, | ||
| reset=reset, | ||
| keep=keep, | ||
| disable_git=disable_git, | ||
| ) | ||
| # Make sure the st_archiver is turned on, as CUPiD only runs after it runs | ||
| self._case.set_value("DOUT_S", True) | ||
|
|
||
| def run_indv( | ||
| self, | ||
| suffix="base", | ||
| st_archive=True, | ||
| cupid=True, | ||
| submit_resubmits=None, | ||
| keep_init_generated_files=False, | ||
| ): | ||
| """ | ||
| Perform an individual run. Raises an EXCEPTION on fail. | ||
|
|
||
| Just add the CUPiD phase after the standard run. | ||
| """ | ||
| super().run_indv( | ||
| suffix=suffix, | ||
| st_archive=st_archive, | ||
| submit_resubmits=submit_resubmits, | ||
| keep_init_generated_files=keep_init_generated_files, | ||
| ) | ||
| self._phase_modifying_call(CUPID_PHASE, self._cupid_case_test) | ||
|
|
||
| def case_test_cupid(self, testdir="cupid_test"): | ||
| # create the run directory testdir | ||
| if os.path.exists(testdir): | ||
| logger.info("Removing existing test directory {}".format(testdir)) | ||
| shutil.rmtree(testdir) | ||
| # Check that the CUPid postprocessing directories and config file exist | ||
| cupid_dir = os.path.join(self._case.get_value("CASEROOT"), "cupid-postprocessing" ) | ||
| notebooks_dir = os.path.join(cupid_dir, "compute_notebooks") | ||
| data_dir = os.path.join(cupid_dir, "temp_data") | ||
| for dir in [cupid_dir, notebooks_dir, data_dir]: | ||
| expect( os.isdir(dir), | ||
| "CUPiD postprocessing directory {} does not exist".format(dir) ) | ||
| cupid_config = os.path.join(cupid_dir, "config.yml") | ||
| expect( os.isfile(cupid_config), | ||
| "CUPiD config file {} does not exist".format(cupid_config) ) | ||
| # TODO: Add more checks about more files that should exist | ||
|
|
||
|
|
||
| # TODO: Populate the testdir with data files, config files and notebooks from the cupid-postprocessing directory | ||
|
|
||
| # TODO: Save various files to the baseline directory to use for BASELINE comparison | ||
|
|
||
| return True | ||
|
|
||
| def _cupid_case_test(self): | ||
| # For the st_archiver this test is under the case object | ||
| # Here we create it in this object, but probably should be moved to under the case object in CIME | ||
| result = self.test_cupid() | ||
| with self._test_status: | ||
| if result: | ||
| self._test_status.set_status(CUPID_PHASE, TEST_PASS_STATUS) | ||
| else: | ||
| self._test_status.set_status(CUPID_PHASE, TEST_FAIL_STATUS) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| from CIME.SystemTests.sms import SMS | ||
|
|
||
| class SMSPOSTPROC(SMS): | ||
| def setup_indv( | ||
| self, clean=False, test_mode=False, reset=False, keep=False, disable_git=False | ||
| ): | ||
| """ | ||
| Perform an individual setup | ||
| """ | ||
| super().setup_indv( | ||
| clean=clean, | ||
| test_mode=test_mode, | ||
| reset=reset, | ||
| keep=keep, | ||
| disable_git=disable_git, | ||
| ) | ||
| # Make sure the st_archiver is turned on, as CUPiD only runs after it runs | ||
| self._case.set_value("DOUT_S", True) | ||
| self._case.set_value("RUN_POSTPROCESSING", True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
cime_config/testdefs/testmods_dirs/clm/CUPiD_ILAMB/include_user_mods
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../../../usermods_dirs/clm/CUPiD |
3 changes: 3 additions & 0 deletions
3
cime_config/testdefs/testmods_dirs/clm/CUPiD_ILAMB/shell_commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| #!/bin/bash | ||
| ./xmlchange CUPID_RUN_ILAMB=TRUE | ||
|
|
1 change: 1 addition & 0 deletions
1
cime_config/testdefs/testmods_dirs/clm/CUPiD_LDF/include_user_mods
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../../../usermods_dirs/clm/CUPiD |
8 changes: 8 additions & 0 deletions
8
cime_config/testdefs/testmods_dirs/clm/CUPiD_LDF/shell_commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| #!/bin/bash | ||
| ./xmlchange CUPID_RUN_LDF=TRUE | ||
|
|
||
| # Base case setttings to match the case just run | ||
| ./xmlchange CUPID_BASE_STARTDATE='$RUN_STARTDATE' | ||
| ./xmlchange CUPID_BASE_CLIMO_END_YEAR=2005 | ||
| ./xmlchange CUPID_BASE_CLIMO_N_YEAR='$STOP_N' | ||
| ./xmlchange CUPID_BASE_STOP_N='$STOP_N' |
1 change: 1 addition & 0 deletions
1
cime_config/testdefs/testmods_dirs/clm/CUPiD_ROF/include_user_mods
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../../../usermods_dirs/clm/CUPiD |
4 changes: 4 additions & 0 deletions
4
cime_config/testdefs/testmods_dirs/clm/CUPiD_ROF/shell_commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| #!/bin/bash | ||
| ./xmlchange CUPID_RUN_ROF=TRUE | ||
| ./xmlchange CUPID_RUN_LND=FALSE | ||
|
|
1 change: 1 addition & 0 deletions
1
cime_config/testdefs/testmods_dirs/clm/CUPiD_web/include_user_mods
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../../../usermods_dirs/clm/CUPiD |
3 changes: 3 additions & 0 deletions
3
cime_config/testdefs/testmods_dirs/clm/CUPiD_web/shell_commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| #!/bin/bash | ||
| ./xmlchange CUPID_GEN_HTML=TRUE | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| This usermod turns on running CUPiD to get plots and diagnostics as part of a case. It sets the most common settings | ||
| for a CTSM case. | ||
|
|
||
| To run with CUPiD you'll need to activate the cupid-infrastructure conda environment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../_includes/hist_2000-2005 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we point to the documentation for running CUPiD via the CESM workflow rather than duplicating and ending up with outdated information?
I'm thinking it would also be good for me to put the land-specific 'cheat sheet' as a docs page for component-specific example of running a STANDALONE version