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

Create cupid workflow #176

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
4 changes: 2 additions & 2 deletions machines/casper/config_machines.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<OS>LINUX</OS>
<COMPILERS>nvhpc,intel</COMPILERS>
<MPILIBS>openmpi</MPILIBS>
<CIME_OUTPUT_ROOT>/glade/scratch/$USER</CIME_OUTPUT_ROOT>
<CIME_OUTPUT_ROOT>/glade/derecho/scratch/$USER</CIME_OUTPUT_ROOT>
<DIN_LOC_ROOT>$ENV{CESMDATAROOT}/inputdata</DIN_LOC_ROOT>
<DIN_LOC_ROOT_CLMFORC>/glade/p/cgd/tss/CTSM_datm_forcing_data</DIN_LOC_ROOT_CLMFORC>
<DOUT_S_ROOT>$CIME_OUTPUT_ROOT/archive/$CASE</DOUT_S_ROOT>
Expand Down Expand Up @@ -108,7 +108,7 @@
<environment_variables>
<env name="MODULEPATH">/glade/u/apps/dav/modulefiles/default/compilers:/glade/u/apps/dav/modulefiles/default/idep</env>
<env name="OMP_STACKSIZE">256M</env>
<env name="TMPDIR">/glade/scratch/$USER</env>
<env name="TMPDIR">/glade/derecho/scratch/$USER</env>
<env name="CESMDATAROOT">/glade/p/cesmdata/cseg</env>
<env name="NETCDF_PATH">$ENV{NETCDF}</env>
</environment_variables>
Expand Down
14 changes: 14 additions & 0 deletions machines/config_workflow.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,20 @@
</job>
</workflow_jobs>

<workflow_jobs id="case.cupid" prepend="default">
<job name="case.cupid">
<template>template.cupid</template>
<hidden>false</hidden>
<dependency>case.st_archive</dependency>
<prereq>1</prereq>
<runtime_parameters MACH="derecho">
<task_count>1</task_count>
<tasks_per_node>1</tasks_per_node>
<walltime>0:20:00</walltime>
</runtime_parameters>
</job>
</workflow_jobs>

<!-- THIS CREATES THE JOB FOR THE LAUNCHING OF THE SMARTSIM ORCHESTRATOR -->
<workflow_jobs id="smartsim_db" prepend="default">
<job name="smartsim_db"> <!-- name here corresponds with scripts -->
Expand Down
2 changes: 2 additions & 0 deletions machines/derecho/config_machines.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
<command name="load">cesmdev/1.0</command>
<command name="load">ncarenv/23.09</command>
<command name="purge"/>
<command name="load">conda/latest</command>
<command name="load">nco</command>
<command name="load">craype</command>
</modules>
<modules compiler="intel">
Expand Down
47 changes: 47 additions & 0 deletions machines/template.cupid
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash -e

# Batch system directives
{{ batchdirectives }}

# Set environment for CESM
source .env_mach_specific.sh

# Use cupid-infrastructure environment for running these scripts
# Note: on derecho, the cesmdev module creates a python conflict
# by setting $PYTHONPATH; since this is conda-based we
# want an empty PYTHONPATH environment variable
MACH=`./xmlquery --value MACH`
unset PYTHONPATH
conda activate cupid-infrastructure

# Set variables that should eventually come from environment file
CUPID_EXAMPLE=key_metrics
RUN_CUPID_ANALYSIS=TRUE
RUN_CUPID_TIMESERIES=TRUE

if [ "${RUN_CUPID_ANALYSIS}" == "TRUE" ]; then
# 1. Generate CUPiD config file
{{ srcroot }}/tools/CUPiD/helper_scripts/generate_cupid_config_for_cesm_case.py \
--cesm-root {{ SRCROOT }}

# 2. Generate ADF config file
{{ srcroot }}/tools/CUPiD/helper_scripts/generate_adf_config_file.py \
--cesm-root {{ SRCROOT }} \
--cupid-config-loc ${PWD} \
--adf-template {{ SRCROOT }}/tools/CUPiD/externals/ADF/config_amwg_default_plots.yaml \
--out-file adf_config.yml

# 3. Generate timeseries files and run ADF
if [ "${RUN_CUPID_TIMESERIES}" == "TRUE" ]; then
{{ srcroot }}/tools/CUPiD/cupid/run_timeseries.py
fi
conda deactivate
conda activate cupid-analysis
{{ SRCROOT }}/tools/CUPiD/externals/ADF/run_adf_diag adf_config.yml

# 4. Run CUPiD and build webpage
conda deactivate
conda activate cupid-infrastructure
{{ srcroot }}/tools/CUPiD/cupid/run_diagnostics.py
{{ srcroot }}/tools/CUPiD/cupid/cupid_webpage.py
fi