From 5a38a5dffcfb8ede321e865e1831f9b2ee3c2b35 Mon Sep 17 00:00:00 2001 From: Christina Holt Date: Fri, 6 Oct 2023 22:02:22 +0000 Subject: [PATCH 01/43] WIP. --- devbuild.sh | 26 ++++++++++++ environment.yml | 10 ++--- graphics_environment.yml | 14 +++++++ modulefiles/conda.lua | 44 ++++++++++++++++++++ modulefiles/tasks/jet/plot_allvars.local.lua | 6 +-- modulefiles/tasks/jet/python_srw.lua | 6 +-- modulefiles/wflow_jet.lua | 5 +-- 7 files changed, 95 insertions(+), 16 deletions(-) create mode 100644 graphics_environment.yml create mode 100644 modulefiles/conda.lua diff --git a/devbuild.sh b/devbuild.sh index b21998fc8e..07e6fb56b2 100755 --- a/devbuild.sh +++ b/devbuild.sh @@ -117,6 +117,7 @@ VERBOSE=false # Turn off all apps to build and choose default later DEFAULT_BUILD=true +BUILD_CONDA="off" BUILD_UFS="off" BUILD_UFS_UTILS="off" BUILD_UPP="off" @@ -175,6 +176,7 @@ while :; do default) ;; all) DEFAULT_BUILD=false; BUILD_UFS="on"; BUILD_UFS_UTILS="on"; BUILD_UPP="on";; + conda) BUILD_CONDA="on";; ufs) DEFAULT_BUILD=false; BUILD_UFS="on" ;; ufs_utils) DEFAULT_BUILD=false; BUILD_UFS_UTILS="on" ;; upp) DEFAULT_BUILD=false; BUILD_UPP="on" ;; @@ -306,6 +308,30 @@ else fi fi +# build conda and conda environments, if requested. +set -x +CONDA_BUILD_DIR="./conda" +if [ "${BUILD_CONDA}" = "on" ] ; then + if [ ! -d "${CONDA_BUILD_DIR}" ] ; then + installer=Miniforge3-$(uname)-$(uname -m).sh + wget "https://github.com/conda-forge/miniforge/releases/latest/download/${installer}" + bash ./${installer} -bfp "${CONDA_BUILD_DIR}" + rm ${installer} + fi + + source ${CONDA_BUILD_DIR}/etc/profile.d/conda.sh + conda activate + if ! conda env list | grep -q "^srw_app\s" ; then + mamba env create -n srw_app --file environment.yml + fi + if ! conda env list | grep -q "^srw_graphics\s" ; then + mamba env create -n srw_graphics --file graphics_environment.yml + fi +else + source ${CONDA_BUILD_DIR}/etc/profile.d/conda.sh + conda activate +fi + # cmake settings CMAKE_SETTINGS="\ -DCMAKE_BUILD_TYPE=${BUILD_TYPE}\ diff --git a/environment.yml b/environment.yml index 2e75288d85..c574df5e23 100644 --- a/environment.yml +++ b/environment.yml @@ -1,8 +1,8 @@ -name: regional_workflow +name: srw_app channels: - conda-forge + - ufs-community dependencies: - python: 3.7 - f90nml: 1.1.2 - jinja2: 2.11* - pyyaml: 5.1.2 + - pylint=2.17* + - pytest=7.2* + - uwtools=1.0.0 diff --git a/graphics_environment.yml b/graphics_environment.yml new file mode 100644 index 0000000000..f295ad9dd3 --- /dev/null +++ b/graphics_environment.yml @@ -0,0 +1,14 @@ +name: srw_graphics +channels: + - conda-forge +dependencies: + - python=3.9* + - cartopy=0.18* + - matplotlib=3.5* + - pillow=9.2* + - pygrib=2.1* + - pylint=2.16* + - pyproj=2.6* + - pytest=7.1* + - pyyaml=6.0* + - scipy=1.9* diff --git a/modulefiles/conda.lua b/modulefiles/conda.lua new file mode 100644 index 0000000000..6d6425e97b --- /dev/null +++ b/modulefiles/conda.lua @@ -0,0 +1,44 @@ +help([[ +]]) + +local pkgName = myModuleName() +local pkgVersion = myModuleVersion() +local shell=myShellType() + +conflict(pkgName) + +local mod_path, mod_file = splitFileName(myFileName()) +local base = pathJoin(mod_path, "..", "conda") +local conda_file = pathJoin(base, "etc", "profile.d", "conda." .. shell) +local command = "source " .. conda_file + +local level + +base = capture("readlink -f " .. base) + +execute{cmd=command, modeA={"load", "unload"}} + +if mode() == "unload" then + + level=tonumber(os.getenv("CONDA_SHLVL")) + + while (level > 0) do + execute{cmd="conda deactivate", modeA={"unload"}} + level = level - 1 + end + + + if shell == "csh" then + execute{cmd="unalias conda", modeA={"unload"}} + command = "unsetenv CONDA_EXE CONDA_PYTHON_EXE CONDA_SHLVL _CE_CONDA" + else + execute{cmd="unset conda", modeA={"unload"}} + command = "unset CONDA_EXE CONDA_PYTHON_EXE CONDA_SHLVL _CE_CONDA" + end + execute{cmd=command, modeA={"unload"}} + remove_path("PATH", pathJoin(base, "condabin")) + remove_path("MANPATH", pathJoin(base, "share", "man")) +end + +prepend_path("PATH", pathJoin(base, "bin")) +prepend_path("LD_LIBRARY_PATH", pathJoin(base, "lib")) diff --git a/modulefiles/tasks/jet/plot_allvars.local.lua b/modulefiles/tasks/jet/plot_allvars.local.lua index ef4f248966..b7e9528710 100644 --- a/modulefiles/tasks/jet/plot_allvars.local.lua +++ b/modulefiles/tasks/jet/plot_allvars.local.lua @@ -1,4 +1,2 @@ -prepend_path("MODULEPATH","/mnt/lfs4/HFIP/hfv3gfs/role.epic/miniconda3/modulefiles") -load(pathJoin("miniconda3", os.getenv("miniconda3_ver") or "4.12.0")) - -setenv("SRW_ENV", "regional_workflow") +load("conda") +setenv("SRW_ENV", "srw_graphics") diff --git a/modulefiles/tasks/jet/python_srw.lua b/modulefiles/tasks/jet/python_srw.lua index 3c7987be18..a2dd45084c 100644 --- a/modulefiles/tasks/jet/python_srw.lua +++ b/modulefiles/tasks/jet/python_srw.lua @@ -1,4 +1,2 @@ -prepend_path("MODULEPATH","/mnt/lfs4/HFIP/hfv3gfs/role.epic/miniconda3/modulefiles") -load(pathJoin("miniconda3", os.getenv("miniconda3_ver") or "4.12.0")) - -setenv("SRW_ENV", "workflow_tools") +load("conda") +setenv("SRW_ENV", "srw_app") diff --git a/modulefiles/wflow_jet.lua b/modulefiles/wflow_jet.lua index 5f109429dc..c3e740537a 100644 --- a/modulefiles/wflow_jet.lua +++ b/modulefiles/wflow_jet.lua @@ -8,11 +8,10 @@ whatis([===[Loads libraries needed for running the UFS SRW App on Jet ]===]) load("rocoto") load("set_pythonpath") -prepend_path("MODULEPATH","/mnt/lfs4/HFIP/hfv3gfs/role.epic/miniconda3/modulefiles") -load(pathJoin("miniconda3", os.getenv("miniconda3_ver") or "4.12.0")) +load("conda") if mode() == "load" then LmodMsgRaw([===[Please do the following to activate conda: - > conda activate workflow_tools + > conda activate srw_app ]===]) end From 2a5b05a057f7fda02cc3c3ab93c54d5c8bdf4c01 Mon Sep 17 00:00:00 2001 From: Christina Holt Date: Sat, 7 Oct 2023 00:16:32 +0000 Subject: [PATCH 02/43] Make the fundamental tests run. --- graphics_environment.yml | 3 +++ ush/load_modules_wflow.sh | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/graphics_environment.yml b/graphics_environment.yml index f295ad9dd3..78b3e3c762 100644 --- a/graphics_environment.yml +++ b/graphics_environment.yml @@ -4,6 +4,8 @@ channels: dependencies: - python=3.9* - cartopy=0.18* + - f90nml 1.4* + - jinja2=3.0* - matplotlib=3.5* - pillow=9.2* - pygrib=2.1* @@ -11,4 +13,5 @@ dependencies: - pyproj=2.6* - pytest=7.1* - pyyaml=6.0* + - pyyaml=6.0* - scipy=1.9* diff --git a/ush/load_modules_wflow.sh b/ush/load_modules_wflow.sh index 7631295d76..67499f4888 100755 --- a/ush/load_modules_wflow.sh +++ b/ush/load_modules_wflow.sh @@ -62,7 +62,7 @@ task failed: $has_mu && set +u if [ ! -z $(command -v conda) ]; then - conda activate workflow_tools + conda activate srw_app fi $has_mu && set -u From aeccb685e0e9ec7762553b483ce42c1f0d22f97b Mon Sep 17 00:00:00 2001 From: Christina Holt Date: Sat, 7 Oct 2023 00:16:46 +0000 Subject: [PATCH 03/43] Modify the rest of the modulefiles accordingly. --- modulefiles/build_cheyenne_gnu.lua | 1 - modulefiles/build_cheyenne_intel.lua | 1 - modulefiles/build_linux_gnu.lua | 1 - modulefiles/build_macos_gnu.lua | 1 - modulefiles/build_orion_intel.lua | 1 - .../tasks/cheyenne/plot_allvars.local.lua | 6 ++---- modulefiles/tasks/cheyenne/python_srw.lua | 6 ++---- .../tasks/derecho/plot_allvars.local.lua | 6 ++---- modulefiles/tasks/derecho/python_srw.lua | 6 ++---- .../tasks/gaea-c5/plot_allvars.local.lua | 6 ++---- modulefiles/tasks/gaea-c5/python_srw.lua | 6 ++---- modulefiles/tasks/gaea/plot_allvars.local.lua | 6 ++---- modulefiles/tasks/gaea/python_srw.lua | 6 ++---- modulefiles/tasks/hera/plot_allvars.local.lua | 6 ++---- modulefiles/tasks/hera/python_srw.lua | 6 ++---- .../tasks/hercules/plot_allvars.local.lua | 6 ++---- modulefiles/tasks/hercules/python_srw.lua | 6 ++---- modulefiles/tasks/noaacloud/python_srw.lua | 3 ++- .../tasks/orion/plot_allvars.local.lua | 6 ++---- modulefiles/tasks/orion/python_srw.lua | 6 ++---- modulefiles/wflow_cheyenne.lua | 5 ++--- modulefiles/wflow_derecho.lua | 5 ++--- modulefiles/wflow_gaea-c5.lua | 5 ++--- modulefiles/wflow_gaea.lua | 5 ++--- modulefiles/wflow_hera.lua | 6 ++---- modulefiles/wflow_hercules.lua | 5 ++--- modulefiles/wflow_linux.lua | 19 ++----------------- modulefiles/wflow_macos.lua | 19 ++----------------- modulefiles/wflow_noaacloud.lua | 5 ++--- modulefiles/wflow_orion.lua | 5 ++--- modulefiles/wflow_singularity.lua | 5 ++--- 31 files changed, 52 insertions(+), 124 deletions(-) diff --git a/modulefiles/build_cheyenne_gnu.lua b/modulefiles/build_cheyenne_gnu.lua index e9ed311712..58398891b2 100644 --- a/modulefiles/build_cheyenne_gnu.lua +++ b/modulefiles/build_cheyenne_gnu.lua @@ -9,7 +9,6 @@ load(pathJoin("cmake", os.getenv("cmake_ver") or "3.22.0")) load(pathJoin("ncarenv", os.getenv("ncarenv_ver") or "1.3")) load(pathJoin("gnu", os.getenv("gnu_ver") or "11.2.0")) load(pathJoin("mpt", os.getenv("mpt_ver") or "2.25")) -load(pathJoin("python", os.getenv("python_ver") or "3.7.9")) setenv("MKLROOT", "/glade/u/apps/opt/intel/2022.1/mkl/latest") load(pathJoin("ncarcompilers", os.getenv("ncarcompilers_ver") or "0.5.0")) unload("netcdf") diff --git a/modulefiles/build_cheyenne_intel.lua b/modulefiles/build_cheyenne_intel.lua index 21bc7108ab..298c9879ac 100644 --- a/modulefiles/build_cheyenne_intel.lua +++ b/modulefiles/build_cheyenne_intel.lua @@ -10,7 +10,6 @@ load(pathJoin("ncarenv", os.getenv("ncarenv_ver") or "1.3")) load(pathJoin("intel", os.getenv("intel_ver") or "2022.1")) load(pathJoin("mpt", os.getenv("mpt_ver") or "2.25")) load(pathJoin("mkl", os.getenv("mkl_ver") or "2022.1")) -load(pathJoin("python", os.getenv("python_ver") or "3.7.9")) load(pathJoin("ncarcompilers", os.getenv("ncarcompilers_ver") or "0.5.0")) unload("netcdf") diff --git a/modulefiles/build_linux_gnu.lua b/modulefiles/build_linux_gnu.lua index cc5f6831f1..22dfaf9a70 100644 --- a/modulefiles/build_linux_gnu.lua +++ b/modulefiles/build_linux_gnu.lua @@ -11,7 +11,6 @@ local HPCstack="/home/username/hpc-stack/install" -- Load HPC stack prepend_path("MODULEPATH", pathJoin(HPCstack, "modulefiles/stack")) load("hpc") -load("hpc-python") load("hpc-gnu") load("hpc-openmpi") diff --git a/modulefiles/build_macos_gnu.lua b/modulefiles/build_macos_gnu.lua index 266bfd11a6..d26da73544 100644 --- a/modulefiles/build_macos_gnu.lua +++ b/modulefiles/build_macos_gnu.lua @@ -15,7 +15,6 @@ local HPCstack="/Users/username/hpc-stack/install" -- Load HPC stack prepend_path("MODULEPATH", pathJoin(HPCstack, "modulefiles/stack")) load("hpc") -load("hpc-python") load("hpc-gnu") load("hpc-openmpi") diff --git a/modulefiles/build_orion_intel.lua b/modulefiles/build_orion_intel.lua index 87e35a0a35..21b78d7671 100644 --- a/modulefiles/build_orion_intel.lua +++ b/modulefiles/build_orion_intel.lua @@ -9,7 +9,6 @@ load("contrib") load("noaatools") load(pathJoin("cmake", os.getenv("cmake_ver") or "3.22.1")) -load(pathJoin("python", os.getenv("python_ver") or "3.9.2")) prepend_path("MODULEPATH","/work/noaa/epic/role-epic/contrib/orion/hpc-stack/intel-2022.1.2_ncdf492/modulefiles/stack") load(pathJoin("hpc", os.getenv("hpc_ver") or "1.2.0")) diff --git a/modulefiles/tasks/cheyenne/plot_allvars.local.lua b/modulefiles/tasks/cheyenne/plot_allvars.local.lua index 2263141a0a..b49b8bb863 100644 --- a/modulefiles/tasks/cheyenne/plot_allvars.local.lua +++ b/modulefiles/tasks/cheyenne/plot_allvars.local.lua @@ -1,5 +1,3 @@ unload("python") -prepend_path("MODULEPATH","/glade/work/epicufsrt/contrib/miniconda3/modulefiles") -load(pathJoin("miniconda3", os.getenv("miniconda3_ver") or "4.12.0")) - -setenv("SRW_ENV", "regional_workflow") +load("conda") +setenv("SRW_ENV", "srw_graphics") diff --git a/modulefiles/tasks/cheyenne/python_srw.lua b/modulefiles/tasks/cheyenne/python_srw.lua index 57e2c2eed0..fe6c73a7d5 100644 --- a/modulefiles/tasks/cheyenne/python_srw.lua +++ b/modulefiles/tasks/cheyenne/python_srw.lua @@ -1,5 +1,3 @@ unload("python") -prepend_path("MODULEPATH","/glade/work/epicufsrt/contrib/miniconda3/modulefiles") -load(pathJoin("miniconda3", os.getenv("miniconda3_ver") or "4.12.0")) - -setenv("SRW_ENV", "workflow_tools") +load("conda") +setenv("SRW_ENV", "srw_app") diff --git a/modulefiles/tasks/derecho/plot_allvars.local.lua b/modulefiles/tasks/derecho/plot_allvars.local.lua index 2263141a0a..b49b8bb863 100644 --- a/modulefiles/tasks/derecho/plot_allvars.local.lua +++ b/modulefiles/tasks/derecho/plot_allvars.local.lua @@ -1,5 +1,3 @@ unload("python") -prepend_path("MODULEPATH","/glade/work/epicufsrt/contrib/miniconda3/modulefiles") -load(pathJoin("miniconda3", os.getenv("miniconda3_ver") or "4.12.0")) - -setenv("SRW_ENV", "regional_workflow") +load("conda") +setenv("SRW_ENV", "srw_graphics") diff --git a/modulefiles/tasks/derecho/python_srw.lua b/modulefiles/tasks/derecho/python_srw.lua index 29c290813e..fe6c73a7d5 100644 --- a/modulefiles/tasks/derecho/python_srw.lua +++ b/modulefiles/tasks/derecho/python_srw.lua @@ -1,5 +1,3 @@ unload("python") -prepend_path("MODULEPATH","/glade/work/epicufsrt/contrib/derecho/miniconda3/modulefiles") -load(pathJoin("miniconda3", os.getenv("miniconda3_ver") or "4.12.0")) - -setenv("SRW_ENV", "workflow_tools") +load("conda") +setenv("SRW_ENV", "srw_app") diff --git a/modulefiles/tasks/gaea-c5/plot_allvars.local.lua b/modulefiles/tasks/gaea-c5/plot_allvars.local.lua index 7c2e3a9ba2..b7e9528710 100644 --- a/modulefiles/tasks/gaea-c5/plot_allvars.local.lua +++ b/modulefiles/tasks/gaea-c5/plot_allvars.local.lua @@ -1,4 +1,2 @@ -prepend_path("MODULEPATH","/lustre/f2/dev/role.epic/contrib/C5/miniconda3/modulefiles") -load(pathJoin("miniconda3", os.getenv("miniconda3_ver") or "4.12.0")) - -setenv("SRW_ENV", "regional_workflow") +load("conda") +setenv("SRW_ENV", "srw_graphics") diff --git a/modulefiles/tasks/gaea-c5/python_srw.lua b/modulefiles/tasks/gaea-c5/python_srw.lua index 673aa800b8..a8b57c694e 100644 --- a/modulefiles/tasks/gaea-c5/python_srw.lua +++ b/modulefiles/tasks/gaea-c5/python_srw.lua @@ -1,5 +1,3 @@ unload("miniconda3") -prepend_path("MODULEPATH","/lustre/f2/dev/role.epic/contrib/C5/miniconda3/modulefiles") -load(pathJoin("miniconda3", os.getenv("miniconda3_ver") or "4.12.0")) - -setenv("SRW_ENV", "workflow_tools") +load("conda") +setenv("SRW_ENV", "srw_app") diff --git a/modulefiles/tasks/gaea/plot_allvars.local.lua b/modulefiles/tasks/gaea/plot_allvars.local.lua index 5cd4d13325..b7e9528710 100644 --- a/modulefiles/tasks/gaea/plot_allvars.local.lua +++ b/modulefiles/tasks/gaea/plot_allvars.local.lua @@ -1,4 +1,2 @@ -prepend_path("MODULEPATH","/lustre/f2/dev/role.epic/contrib/miniconda3/modulefiles") -load(pathJoin("miniconda3", os.getenv("miniconda3_ver") or "4.12.0")) - -setenv("SRW_ENV", "regional_workflow") +load("conda") +setenv("SRW_ENV", "srw_graphics") diff --git a/modulefiles/tasks/gaea/python_srw.lua b/modulefiles/tasks/gaea/python_srw.lua index a18856b8d2..a2dd45084c 100644 --- a/modulefiles/tasks/gaea/python_srw.lua +++ b/modulefiles/tasks/gaea/python_srw.lua @@ -1,4 +1,2 @@ -prepend_path("MODULEPATH","/lustre/f2/dev/role.epic/contrib/miniconda3/modulefiles") -load(pathJoin("miniconda3", os.getenv("miniconda3_ver") or "4.12.0")) - -setenv("SRW_ENV", "workflow_tools") +load("conda") +setenv("SRW_ENV", "srw_app") diff --git a/modulefiles/tasks/hera/plot_allvars.local.lua b/modulefiles/tasks/hera/plot_allvars.local.lua index 7934169824..b7e9528710 100644 --- a/modulefiles/tasks/hera/plot_allvars.local.lua +++ b/modulefiles/tasks/hera/plot_allvars.local.lua @@ -1,4 +1,2 @@ -prepend_path("MODULEPATH","/scratch1/NCEPDEV/nems/role.epic/miniconda3/modulefiles") -load(pathJoin("miniconda3", os.getenv("miniconda3_ver") or "4.12.0")) - -setenv("SRW_ENV", "regional_workflow") +load("conda") +setenv("SRW_ENV", "srw_graphics") diff --git a/modulefiles/tasks/hera/python_srw.lua b/modulefiles/tasks/hera/python_srw.lua index 62ddf7d9e8..a2dd45084c 100644 --- a/modulefiles/tasks/hera/python_srw.lua +++ b/modulefiles/tasks/hera/python_srw.lua @@ -1,4 +1,2 @@ -prepend_path("MODULEPATH","/scratch1/NCEPDEV/nems/role.epic/miniconda3/modulefiles") -load(pathJoin("miniconda3", os.getenv("miniconda3_ver") or "4.12.0")) - -setenv("SRW_ENV", "workflow_tools") +load("conda") +setenv("SRW_ENV", "srw_app") diff --git a/modulefiles/tasks/hercules/plot_allvars.local.lua b/modulefiles/tasks/hercules/plot_allvars.local.lua index c995f83bb8..b49b8bb863 100644 --- a/modulefiles/tasks/hercules/plot_allvars.local.lua +++ b/modulefiles/tasks/hercules/plot_allvars.local.lua @@ -1,5 +1,3 @@ unload("python") -append_path("MODULEPATH","/work/noaa/epic/role-epic/contrib/hercules/miniconda3/modulefiles") -load(pathJoin("miniconda3", os.getenv("miniconda3_ver") or "4.12.0")) - -setenv("SRW_ENV", "regional_workflow") +load("conda") +setenv("SRW_ENV", "srw_graphics") diff --git a/modulefiles/tasks/hercules/python_srw.lua b/modulefiles/tasks/hercules/python_srw.lua index 157e6884ea..fe6c73a7d5 100644 --- a/modulefiles/tasks/hercules/python_srw.lua +++ b/modulefiles/tasks/hercules/python_srw.lua @@ -1,5 +1,3 @@ unload("python") -append_path("MODULEPATH","/work/noaa/epic/role-epic/contrib/hercules/miniconda3/modulefiles") -load(pathJoin("miniconda3", os.getenv("miniconda3_ver") or "4.12.0")) - -setenv("SRW_ENV", "workflow_tools") +load("conda") +setenv("SRW_ENV", "srw_app") diff --git a/modulefiles/tasks/noaacloud/python_srw.lua b/modulefiles/tasks/noaacloud/python_srw.lua index 602d60842f..a2dd45084c 100644 --- a/modulefiles/tasks/noaacloud/python_srw.lua +++ b/modulefiles/tasks/noaacloud/python_srw.lua @@ -1 +1,2 @@ -prepend_path("PATH", "/contrib/EPIC/miniconda3/4.12.0/envs/regional_workflow/bin") +load("conda") +setenv("SRW_ENV", "srw_app") diff --git a/modulefiles/tasks/orion/plot_allvars.local.lua b/modulefiles/tasks/orion/plot_allvars.local.lua index 94fed189be..b49b8bb863 100644 --- a/modulefiles/tasks/orion/plot_allvars.local.lua +++ b/modulefiles/tasks/orion/plot_allvars.local.lua @@ -1,5 +1,3 @@ unload("python") -append_path("MODULEPATH","/work/noaa/epic/role-epic/contrib/orion/miniconda3/modulefiles") -load(pathJoin("miniconda3", os.getenv("miniconda3_ver") or "4.12.0")) - -setenv("SRW_ENV", "regional_workflow") +load("conda") +setenv("SRW_ENV", "srw_graphics") diff --git a/modulefiles/tasks/orion/python_srw.lua b/modulefiles/tasks/orion/python_srw.lua index 449ce23f31..fe6c73a7d5 100644 --- a/modulefiles/tasks/orion/python_srw.lua +++ b/modulefiles/tasks/orion/python_srw.lua @@ -1,5 +1,3 @@ unload("python") -append_path("MODULEPATH","/work/noaa/epic/role-epic/contrib/orion/miniconda3/modulefiles") -load(pathJoin("miniconda3", os.getenv("miniconda3_ver") or "4.12.0")) - -setenv("SRW_ENV", "workflow_tools") +load("conda") +setenv("SRW_ENV", "srw_app") diff --git a/modulefiles/wflow_cheyenne.lua b/modulefiles/wflow_cheyenne.lua index 9a7a37c0b5..f3fec407c7 100644 --- a/modulefiles/wflow_cheyenne.lua +++ b/modulefiles/wflow_cheyenne.lua @@ -12,13 +12,12 @@ load("rocoto") unload("python") +load("conda") load("set_pythonpath") -prepend_path("MODULEPATH","/glade/work/epicufsrt/contrib/miniconda3/modulefiles") -load(pathJoin("miniconda3", os.getenv("miniconda3_ver") or "4.12.0")) if mode() == "load" then LmodMsgRaw([===[Please do the following to activate conda: - > conda activate workflow_tools + > conda activate srw_app ]===]) end diff --git a/modulefiles/wflow_derecho.lua b/modulefiles/wflow_derecho.lua index 8a71ed6cd7..f32cfdc298 100644 --- a/modulefiles/wflow_derecho.lua +++ b/modulefiles/wflow_derecho.lua @@ -12,13 +12,12 @@ load("rocoto") unload("python") +load("conda") load("set_pythonpath") -prepend_path("MODULEPATH","/glade/work/epicufsrt/contrib/derecho/miniconda3/modulefiles") -load(pathJoin("miniconda3", os.getenv("miniconda3_ver") or "4.12.0")) if mode() == "load" then LmodMsgRaw([===[Please do the following to activate conda: - > conda activate workflow_tools + > conda activate srw_app ]===]) end diff --git a/modulefiles/wflow_gaea-c5.lua b/modulefiles/wflow_gaea-c5.lua index 12467dfd74..5f9d93e58f 100644 --- a/modulefiles/wflow_gaea-c5.lua +++ b/modulefiles/wflow_gaea-c5.lua @@ -7,8 +7,7 @@ whatis([===[Loads libraries needed for running the UFS SRW App on gaea ]===]) unload("python") load("set_pythonpath") -prepend_path("MODULEPATH","/lustre/f2/dev/role.epic/contrib/C5/miniconda3/modulefiles") -load(pathJoin("miniconda3", os.getenv("miniconda3_ver") or "4.12.0")) +load("conda") prepend_path("MODULEPATH","/lustre/f2/dev/role.epic/contrib/C5/rocoto/modulefiles") load("rocoto") @@ -16,6 +15,6 @@ pushenv("MKLROOT", "/opt/intel/oneapi/mkl/2023.1.0/") if mode() == "load" then LmodMsgRaw([===[Please do the following to activate conda: - > conda activate workflow_tools + > conda activate srw_app ]===]) end diff --git a/modulefiles/wflow_gaea.lua b/modulefiles/wflow_gaea.lua index 3e95511f80..bea887a79c 100644 --- a/modulefiles/wflow_gaea.lua +++ b/modulefiles/wflow_gaea.lua @@ -7,8 +7,7 @@ whatis([===[Loads libraries needed for running the UFS SRW App on gaea ]===]) unload("python") load("set_pythonpath") -prepend_path("MODULEPATH","/lustre/f2/dev/role.epic/contrib/miniconda3/modulefiles") -load(pathJoin("miniconda3", os.getenv("miniconda3_ver") or "4.12.0")) +load("conda") prepend_path("MODULEPATH","/lustre/f2/dev/role.epic/contrib/rocoto/modulefiles") load("rocoto") load("alps") @@ -21,6 +20,6 @@ setenv("PMI_NO_PREINITIALIZE","1") if mode() == "load" then LmodMsgRaw([===[Please do the following to activate conda: - > conda activate workflow_tools + > conda activate srw_app ]===]) end diff --git a/modulefiles/wflow_hera.lua b/modulefiles/wflow_hera.lua index 5d6ebeed1d..832f40bb73 100644 --- a/modulefiles/wflow_hera.lua +++ b/modulefiles/wflow_hera.lua @@ -7,12 +7,10 @@ whatis([===[Loads libraries needed for running the UFS SRW App on Hera ]===]) load("rocoto") load("set_pythonpath") - -prepend_path("MODULEPATH","/scratch1/NCEPDEV/nems/role.epic/miniconda3/modulefiles") -load(pathJoin("miniconda3", os.getenv("miniconda3_ver") or "4.12.0")) +load("conda") if mode() == "load" then LmodMsgRaw([===[Please do the following to activate conda: - > conda activate workflow_tools + > conda activate srw_app ]===]) end diff --git a/modulefiles/wflow_hercules.lua b/modulefiles/wflow_hercules.lua index 471b1f8919..978ef14711 100644 --- a/modulefiles/wflow_hercules.lua +++ b/modulefiles/wflow_hercules.lua @@ -10,12 +10,11 @@ load("rocoto") load("set_pythonpath") unload("python") -append_path("MODULEPATH","/work/noaa/epic/role-epic/contrib/hercules/miniconda3/modulefiles") -load(pathJoin("miniconda3", os.getenv("miniconda3_ver") or "4.12.0")) +load("conda") if mode() == "load" then LmodMsgRaw([===[Please do the following to activate conda: - > conda activate workflow_tools + > conda activate srw_app ]===]) end diff --git a/modulefiles/wflow_linux.lua b/modulefiles/wflow_linux.lua index 3fb5d1123a..4c2305f047 100644 --- a/modulefiles/wflow_linux.lua +++ b/modulefiles/wflow_linux.lua @@ -6,22 +6,7 @@ whatis([===[This module sets a path for conda environment needed for running the setenv("CMAKE_Platform", "linux") --- Conda initialization function -function init_conda(conda_path) - local shell=myShellType() - local conda_file - if shell == "csh" then - conda_file=pathJoin(conda_path,"etc/profile.d/conda.csh") - else - conda_file=pathJoin(conda_path,"etc/profile.d/conda.sh") - end - local mcmd="source " .. conda_file - execute{cmd=mcmd, modeA={"load"}} -end - --- initialize conda -local conda_path="/home/username/miniconda3" -init_conda(conda_path) +load("conda") -- add rocoto to path local rocoto_path="/home/username/rocoto" @@ -37,6 +22,6 @@ load("set_pythonpath") -- display conda activation message if mode() == "load" then LmodMsgRaw([===[Please do the following to activate conda: - > conda activate workflow_tools + > conda activate srw_app ]===]) end diff --git a/modulefiles/wflow_macos.lua b/modulefiles/wflow_macos.lua index 6ee6022b20..987adcdd52 100644 --- a/modulefiles/wflow_macos.lua +++ b/modulefiles/wflow_macos.lua @@ -6,22 +6,7 @@ whatis([===[This module activates conda environment for running the UFS SRW App setenv("CMAKE_Platform", "macos") --- Conda initialization function -function init_conda(conda_path) - local shell=myShellType() - local conda_file - if shell == "csh" then - conda_file=pathJoin(conda_path,"etc/profile.d/conda.csh") - else - conda_file=pathJoin(conda_path,"etc/profile.d/conda.sh") - end - local mcmd="source " .. conda_file - execute{cmd=mcmd, modeA={"load"}} -end - --- initialize conda -local conda_path="/Users/username/miniconda3" -init_conda(conda_path) +load("conda") -- add rocoto to path local rocoto_path="/Users/username/rocoto" @@ -37,7 +22,7 @@ load("set_pythonpath") -- display conda activation message if mode() == "load" then LmodMsgRaw([===[Please do the following to activate conda virtual environment: - > conda activate workflow_tools" + > conda activate srw_app" ]===]) end diff --git a/modulefiles/wflow_noaacloud.lua b/modulefiles/wflow_noaacloud.lua index fdfb7ef14d..e4a355f0b2 100644 --- a/modulefiles/wflow_noaacloud.lua +++ b/modulefiles/wflow_noaacloud.lua @@ -10,8 +10,7 @@ load("rocoto") load("set_pythonpath") -prepend_path("MODULEPATH","/contrib/EPIC/miniconda3/modulefiles") -load(pathJoin("miniconda3", os.getenv("miniconda3_ver") or "4.12.0")) +load("conda") setenv("PROJ_LIB","/contrib/EPIC/miniconda3/4.12.0/envs/regional_workflow/share/proj") setenv("OPT","/contrib/EPIC/hpc-modules") @@ -20,6 +19,6 @@ prepend_path("PATH","/contrib/EPIC/bin") if mode() == "load" then LmodMsgRaw([===[Please do the following to activate conda: - > conda activate workflow_tools + > conda activate srw_app ]===]) end diff --git a/modulefiles/wflow_orion.lua b/modulefiles/wflow_orion.lua index ed72ff2245..0a9ef26fce 100644 --- a/modulefiles/wflow_orion.lua +++ b/modulefiles/wflow_orion.lua @@ -11,12 +11,11 @@ load("wget") load("set_pythonpath") unload("python") -append_path("MODULEPATH","/work/noaa/epic/role-epic/contrib/orion/miniconda3/modulefiles") -load(pathJoin("miniconda3", os.getenv("miniconda3_ver") or "4.12.0")) +load("conda") if mode() == "load" then LmodMsgRaw([===[Please do the following to activate conda: - > conda activate workflow_tools + > conda activate srw_app ]===]) end diff --git a/modulefiles/wflow_singularity.lua b/modulefiles/wflow_singularity.lua index 309c5eac23..3e1de292e1 100644 --- a/modulefiles/wflow_singularity.lua +++ b/modulefiles/wflow_singularity.lua @@ -6,9 +6,8 @@ a singularity container whatis([===[Loads libraries needed for running the UFS SRW App in a singularity container]===]) load("set_pythonpath") -append_path("MODULEPATH","/opt/hpc-modules/modulefiles/core") -load("miniconda3") +load("conda") if mode() == "load" then - execute{cmd="conda activate workflow_tools", modeA={"load"}} + execute{cmd="conda activate srw_app", modeA={"load"}} end From 4611e70661dddd1712263a940570fb3d9ce2b768 Mon Sep 17 00:00:00 2001 From: Christina Holt Date: Sat, 7 Oct 2023 00:40:04 +0000 Subject: [PATCH 04/43] Modifying the GHA workflows to use the environment --- .github/workflows/python_func_tests.yaml | 39 ------------ .github/workflows/python_linter.yaml | 40 ------------- .github/workflows/python_tests.yaml | 75 ++++++++++++++++++++++++ .github/workflows/python_unittests.yaml | 44 -------------- tests/build.sh | 2 +- 5 files changed, 76 insertions(+), 124 deletions(-) delete mode 100644 .github/workflows/python_func_tests.yaml delete mode 100644 .github/workflows/python_linter.yaml create mode 100644 .github/workflows/python_tests.yaml delete mode 100644 .github/workflows/python_unittests.yaml diff --git a/.github/workflows/python_func_tests.yaml b/.github/workflows/python_func_tests.yaml deleted file mode 100644 index 980b67a77c..0000000000 --- a/.github/workflows/python_func_tests.yaml +++ /dev/null @@ -1,39 +0,0 @@ -name: Python functional tests -on: - push: - branches: - - develop - - 'release/*' - paths: - - ush/*retrieve_data.py - - parm/data_locations.yml - pull_request: - branches: - - develop - - 'release/*' - workflow_dispatch: - -env: - CI: true - -jobs: - python_functests: - name: Python Functional Tests - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - # Install dependencies - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install python3 python3-pip netcdf-bin - sudo pip3 install pyyaml - - # Run python functional tests - - name: Run python functional tests - run: | - export PYTHONPATH=${PWD}/ush - python3 -m unittest -b tests/test_python/test_retrieve_data.py diff --git a/.github/workflows/python_linter.yaml b/.github/workflows/python_linter.yaml deleted file mode 100644 index b63a2a513c..0000000000 --- a/.github/workflows/python_linter.yaml +++ /dev/null @@ -1,40 +0,0 @@ -name: Python linting -on: - push: - branches: - - develop - - 'release/*' - pull_request: - branches: - - develop - - 'release/*' - workflow_dispatch: - -defaults: - run: - shell: bash -jobs: - - python_linter: - name: Python unittests - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - # Install dependencies - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install python3 python3-pip netcdf-bin - sudo pip3 install pylint==2.16 - - # Run python unittests - - name: Lint the test directory - run: | - ./manage_externals/checkout_externals workflow-tools - export PYTHONPATH=$(pwd)/ush:$(pwd)/ush/python_utils/workflow-tools:$(pwd)/ush/python_utils/workflow-tools/src - pylint --ignore-imports=yes tests/test_python/ - pylint ush/create_*.py - pylint ush/generate_FV3LAM_wflow.py diff --git a/.github/workflows/python_tests.yaml b/.github/workflows/python_tests.yaml new file mode 100644 index 0000000000..b2f72d3b1c --- /dev/null +++ b/.github/workflows/python_tests.yaml @@ -0,0 +1,75 @@ +name: Python Tests +on: + push: + branches: + - develop + - 'release/*' + pull_request: + branches: + - develop + - 'release/*' + workflow_dispatch: + +defaults: + run: + shell: bash -l {0} + +jobs: + install_environment: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + # Install dependencies + - name: Install Micromamba with no environment + uses: mamba-org/provision-with-micromamba@main + with: + environment-file: false + channel-priority: flexible + cache-downloads: true + cache-env: true + - name: Install srw_app environment + run: micromamba create -y -n srw_app --file environment.yml + - name: Checkout externals + run: | + ./manage_externals/checkout_externals ufs-weather-model workflow-tools + + python_unittests: + env: + UNIT_TEST: True + needs: install_environment + runs-on: ubuntu-latest + steps: + # Run python unittests + - name: Run python unittests + run: | + # exclude test_retrieve_data that is tested in functional test + micromamba activate srw_app + export PYTHONPATH=$(pwd)/ush:$(pwd)/ush/python_utils/workflow-tools:$(pwd)/ush/python_utils/workflow-tools/src + python -m unittest -b tests/test_python/*.py + + python_functests: + env: + CI: true + needs: install_environment + runs-on: ubuntu-latest + steps: + # Run python functional tests + - name: Run python functional tests + run: | + micromamba activate srw_app + export PYTHONPATH=${PWD}/ush + python3 -m unittest -b tests/test_python/test_retrieve_data.py + + python_formatting: + needs: install_environment + runs-on: ubuntu-latest + steps: + - name: Lint the python code + run: | + micromamba activate srw_app + export PYTHONPATH=$(pwd)/ush:$(pwd)/ush/python_utils/workflow-tools:$(pwd)/ush/python_utils/workflow-tools/src + pylint --ignore-imports=yes tests/test_python/ + pylint ush/create_*.py + pylint ush/generate_FV3LAM_wflow.py diff --git a/.github/workflows/python_unittests.yaml b/.github/workflows/python_unittests.yaml deleted file mode 100644 index 5e491dea6e..0000000000 --- a/.github/workflows/python_unittests.yaml +++ /dev/null @@ -1,44 +0,0 @@ -name: Python unittests -on: - push: - branches: - - develop - - 'release/*' - pull_request: - branches: - - develop - - 'release/*' - workflow_dispatch: - -env: - UNIT_TEST: True - -defaults: - run: - shell: bash -jobs: - - python_unittests: - name: Python unittests - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - # Install dependencies - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install python3 python3-pip netcdf-bin - sudo pip3 install pyyaml jinja2==2.11 f90nml - sudo pip3 install numpy matplotlib basemap - - # Run python unittests - - name: Run python unittests - run: | - ./manage_externals/checkout_externals ufs-weather-model workflow-tools - # exclude test_retrieve_data that is tested in functional test - export PYTHONPATH=$(pwd)/ush:$(pwd)/ush/python_utils/workflow-tools:$(pwd)/ush/python_utils/workflow-tools/src - python3 -m unittest -b tests/test_python/*.py - diff --git a/tests/build.sh b/tests/build.sh index b1d7a00091..ea3dd91939 100755 --- a/tests/build.sh +++ b/tests/build.sh @@ -42,7 +42,7 @@ machine=$(echo "${MACHINE}" | tr '[A-Z]' '[a-z]') # scripts in sorc need lower compiler=${2:-"intel"} -components=${3:-"default"} +components=${3:-"default conda"} #----------------------------------------------------------------------- # Check that machine is valid From 4bdf0bc18e0e3204f21283284a2005b74dae5317 Mon Sep 17 00:00:00 2001 From: Christina Holt Date: Sat, 7 Oct 2023 01:02:39 +0000 Subject: [PATCH 05/43] Attempt to fix mamba --- .github/workflows/python_tests.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python_tests.yaml b/.github/workflows/python_tests.yaml index b2f72d3b1c..6385967521 100644 --- a/.github/workflows/python_tests.yaml +++ b/.github/workflows/python_tests.yaml @@ -23,12 +23,13 @@ jobs: # Install dependencies - name: Install Micromamba with no environment - uses: mamba-org/provision-with-micromamba@main + uses: mamba-org/setup-micromamba@v1 with: environment-file: false channel-priority: flexible + init-shell: bash cache-downloads: true - cache-env: true + cache-environment: true - name: Install srw_app environment run: micromamba create -y -n srw_app --file environment.yml - name: Checkout externals From c9735bc4704a27785f82076f48e798bd8f7583ea Mon Sep 17 00:00:00 2001 From: Christina Holt Date: Sat, 7 Oct 2023 01:03:55 +0000 Subject: [PATCH 06/43] Fix autosyntax error. --- .github/workflows/python_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python_tests.yaml b/.github/workflows/python_tests.yaml index 6385967521..42463468bc 100644 --- a/.github/workflows/python_tests.yaml +++ b/.github/workflows/python_tests.yaml @@ -23,7 +23,7 @@ jobs: # Install dependencies - name: Install Micromamba with no environment - uses: mamba-org/setup-micromamba@v1 + uses: mamba-org/setup-micromamba@v1 with: environment-file: false channel-priority: flexible From 64c53694eff7e5753d47720abd50a1c1f41173f7 Mon Sep 17 00:00:00 2001 From: Christina Holt Date: Sat, 7 Oct 2023 01:07:00 +0000 Subject: [PATCH 07/43] Cleanup old flags. --- .github/workflows/python_tests.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/python_tests.yaml b/.github/workflows/python_tests.yaml index 42463468bc..89face8b7e 100644 --- a/.github/workflows/python_tests.yaml +++ b/.github/workflows/python_tests.yaml @@ -26,7 +26,6 @@ jobs: uses: mamba-org/setup-micromamba@v1 with: environment-file: false - channel-priority: flexible init-shell: bash cache-downloads: true cache-environment: true From 255765caa3ca4934c0a401bb1e8e663dcd6ef816 Mon Sep 17 00:00:00 2001 From: Christina Holt Date: Sat, 7 Oct 2023 01:09:53 +0000 Subject: [PATCH 08/43] Try to install env with mamba install. --- .github/workflows/python_tests.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python_tests.yaml b/.github/workflows/python_tests.yaml index 89face8b7e..7609f75082 100644 --- a/.github/workflows/python_tests.yaml +++ b/.github/workflows/python_tests.yaml @@ -25,12 +25,11 @@ jobs: - name: Install Micromamba with no environment uses: mamba-org/setup-micromamba@v1 with: - environment-file: false + environment-file: environment.yml + environment-name: srw_app init-shell: bash cache-downloads: true cache-environment: true - - name: Install srw_app environment - run: micromamba create -y -n srw_app --file environment.yml - name: Checkout externals run: | ./manage_externals/checkout_externals ufs-weather-model workflow-tools From e6bb3a3fa8738c1dadd327c17691f751661a9276 Mon Sep 17 00:00:00 2001 From: Christina Holt Date: Sat, 7 Oct 2023 01:16:46 +0000 Subject: [PATCH 09/43] Try better default shell for activating mamba --- .github/workflows/python_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python_tests.yaml b/.github/workflows/python_tests.yaml index 7609f75082..ffb0a0218e 100644 --- a/.github/workflows/python_tests.yaml +++ b/.github/workflows/python_tests.yaml @@ -12,7 +12,7 @@ on: defaults: run: - shell: bash -l {0} + shell: bash -leo pipefail {0} {0} jobs: install_environment: From 4421031e3b5c74349afd99a734c6ad7ac2f58e96 Mon Sep 17 00:00:00 2001 From: Christina Holt Date: Sat, 7 Oct 2023 01:26:38 +0000 Subject: [PATCH 10/43] Perhaps a typo in the micromamba docs? --- .github/workflows/python_tests.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python_tests.yaml b/.github/workflows/python_tests.yaml index ffb0a0218e..8a1c4018a5 100644 --- a/.github/workflows/python_tests.yaml +++ b/.github/workflows/python_tests.yaml @@ -12,7 +12,7 @@ on: defaults: run: - shell: bash -leo pipefail {0} {0} + shell: bash -leo pipefail {0} jobs: install_environment: @@ -44,6 +44,7 @@ jobs: - name: Run python unittests run: | # exclude test_retrieve_data that is tested in functional test + cat /home/runner/.bashrc micromamba activate srw_app export PYTHONPATH=$(pwd)/ush:$(pwd)/ush/python_utils/workflow-tools:$(pwd)/ush/python_utils/workflow-tools/src python -m unittest -b tests/test_python/*.py From 9ee47c3836d40be5f873c1ec24eaa7e0c11fc744 Mon Sep 17 00:00:00 2001 From: Christina Holt Date: Sat, 7 Oct 2023 01:34:40 +0000 Subject: [PATCH 11/43] Don't separate jobs --- .github/workflows/python_tests.yaml | 32 ++++++++--------------------- 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/.github/workflows/python_tests.yaml b/.github/workflows/python_tests.yaml index 8a1c4018a5..603102433a 100644 --- a/.github/workflows/python_tests.yaml +++ b/.github/workflows/python_tests.yaml @@ -34,38 +34,15 @@ jobs: run: | ./manage_externals/checkout_externals ufs-weather-model workflow-tools - python_unittests: - env: - UNIT_TEST: True - needs: install_environment - runs-on: ubuntu-latest - steps: - # Run python unittests - name: Run python unittests run: | # exclude test_retrieve_data that is tested in functional test cat /home/runner/.bashrc micromamba activate srw_app + export UNIT_TEST=True export PYTHONPATH=$(pwd)/ush:$(pwd)/ush/python_utils/workflow-tools:$(pwd)/ush/python_utils/workflow-tools/src python -m unittest -b tests/test_python/*.py - python_functests: - env: - CI: true - needs: install_environment - runs-on: ubuntu-latest - steps: - # Run python functional tests - - name: Run python functional tests - run: | - micromamba activate srw_app - export PYTHONPATH=${PWD}/ush - python3 -m unittest -b tests/test_python/test_retrieve_data.py - - python_formatting: - needs: install_environment - runs-on: ubuntu-latest - steps: - name: Lint the python code run: | micromamba activate srw_app @@ -73,3 +50,10 @@ jobs: pylint --ignore-imports=yes tests/test_python/ pylint ush/create_*.py pylint ush/generate_FV3LAM_wflow.py + + - name: Run python functional tests + run: | + micromamba activate srw_app + export CI=true + export PYTHONPATH=${PWD}/ush + python3 -m unittest -b tests/test_python/test_retrieve_data.py From 0f8b58a5a34d5ba44786be30bee20b6e931cc9fe Mon Sep 17 00:00:00 2001 From: Christina Holt Date: Sat, 7 Oct 2023 01:47:37 +0000 Subject: [PATCH 12/43] Reorder and cleanup. --- .github/workflows/python_tests.yaml | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/.github/workflows/python_tests.yaml b/.github/workflows/python_tests.yaml index 603102433a..1bab329c0c 100644 --- a/.github/workflows/python_tests.yaml +++ b/.github/workflows/python_tests.yaml @@ -15,14 +15,13 @@ defaults: shell: bash -leo pipefail {0} jobs: - install_environment: + srw_tests: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v2 - # Install dependencies - - name: Install Micromamba with no environment + - name: Install Micromamba and srw_app environment uses: mamba-org/setup-micromamba@v1 with: environment-file: environment.yml @@ -30,19 +29,11 @@ jobs: init-shell: bash cache-downloads: true cache-environment: true + - name: Checkout externals run: | ./manage_externals/checkout_externals ufs-weather-model workflow-tools - - name: Run python unittests - run: | - # exclude test_retrieve_data that is tested in functional test - cat /home/runner/.bashrc - micromamba activate srw_app - export UNIT_TEST=True - export PYTHONPATH=$(pwd)/ush:$(pwd)/ush/python_utils/workflow-tools:$(pwd)/ush/python_utils/workflow-tools/src - python -m unittest -b tests/test_python/*.py - - name: Lint the python code run: | micromamba activate srw_app @@ -51,6 +42,14 @@ jobs: pylint ush/create_*.py pylint ush/generate_FV3LAM_wflow.py + - name: Run python unittests + run: | + # exclude test_retrieve_data that is tested in functional test + micromamba activate srw_app + export UNIT_TEST=True + export PYTHONPATH=$(pwd)/ush:$(pwd)/ush/python_utils/workflow-tools:$(pwd)/ush/python_utils/workflow-tools/src + python -m unittest -b tests/test_python/*.py + - name: Run python functional tests run: | micromamba activate srw_app From 66202d741d8ed046f4ea09f93e7fe0c5fb3c1b4d Mon Sep 17 00:00:00 2001 From: Christina Holt Date: Sat, 7 Oct 2023 02:29:18 +0000 Subject: [PATCH 13/43] Update docs. --- .../BackgroundInfo/TechnicalOverview.rst | 5 + .../source/BuildingRunningTesting/AQM.rst | 6 +- .../ContainerQuickstart.rst | 4 +- .../BuildingRunningTesting/Quickstart.rst | 4 +- .../source/BuildingRunningTesting/RunSRW.rst | 127 ++++-------------- .../BuildingRunningTesting/Tutorial.rst | 4 +- .../source/BuildingRunningTesting/VXCases.rst | 2 +- docs/UsersGuide/source/Reference/FAQ.rst | 4 +- environment.yml | 6 + 9 files changed, 51 insertions(+), 111 deletions(-) diff --git a/docs/UsersGuide/source/BackgroundInfo/TechnicalOverview.rst b/docs/UsersGuide/source/BackgroundInfo/TechnicalOverview.rst index a179d535e1..2b457358ec 100644 --- a/docs/UsersGuide/source/BackgroundInfo/TechnicalOverview.rst +++ b/docs/UsersGuide/source/BackgroundInfo/TechnicalOverview.rst @@ -94,6 +94,11 @@ Optional but recommended prerequisites for all systems: * Rocoto Workflow Management System (1.3.1) * Python packages ``scipy``, ``matplotlib``, ``pygrib``, ``cartopy``, and ``pillow`` for graphics +.. note:: +The SRW build will install conda, and necessary conda environments for running the workflow and the +graphics automatically when the ``conda`` target is included at build time. + + .. _SRWStructure: Code Repositories and Directory Structure diff --git a/docs/UsersGuide/source/BuildingRunningTesting/AQM.rst b/docs/UsersGuide/source/BuildingRunningTesting/AQM.rst index 4c83bcee2b..1c4ff068f7 100644 --- a/docs/UsersGuide/source/BuildingRunningTesting/AQM.rst +++ b/docs/UsersGuide/source/BuildingRunningTesting/AQM.rst @@ -68,7 +68,7 @@ If the SRW-AQM builds correctly, users should see the standard executables liste * - nexus - Runs the NOAA Emission and eXchange Unified System (:ref:`NEXUS `) emissions processing system -Load the ``workflow_tools`` Environment +Load the ``srw_app`` Environment -------------------------------------------- Load the python environment for the workflow: @@ -88,9 +88,9 @@ If the console outputs a message, the user should run the commands specified in .. code-block:: console Please do the following to activate conda: - > conda activate workflow_tools + > conda activate srw_app -then the user should run ``conda activate workflow_tools``. Otherwise, the user can continue with configuring the workflow. +then the user should run ``conda activate srw_app``. Otherwise, the user can continue with configuring the workflow. .. _AQMConfig: diff --git a/docs/UsersGuide/source/BuildingRunningTesting/ContainerQuickstart.rst b/docs/UsersGuide/source/BuildingRunningTesting/ContainerQuickstart.rst index bcc17e73ce..129645da26 100644 --- a/docs/UsersGuide/source/BuildingRunningTesting/ContainerQuickstart.rst +++ b/docs/UsersGuide/source/BuildingRunningTesting/ContainerQuickstart.rst @@ -271,9 +271,9 @@ The ``wflow_`` modulefile will then output instructions to activate th .. code-block:: console Please do the following to activate conda: - > conda activate workflow_tools + > conda activate srw_app -then the user should run ``conda activate workflow_tools``. This will activate the ``workflow_tools`` conda environment. The command(s) will vary from system to system, but the user should see ``(workflow_tools)`` in front of the Terminal prompt at this point. +then the user should run ``conda activate srw_app``. This will activate the ``srw_app`` conda environment. The command(s) will vary from system to system, but the user should see ``(srw_app)`` in front of the Terminal prompt at this point. .. _SetUpConfigFileC: diff --git a/docs/UsersGuide/source/BuildingRunningTesting/Quickstart.rst b/docs/UsersGuide/source/BuildingRunningTesting/Quickstart.rst index df5a61b1ef..387e8d6d2e 100644 --- a/docs/UsersGuide/source/BuildingRunningTesting/Quickstart.rst +++ b/docs/UsersGuide/source/BuildingRunningTesting/Quickstart.rst @@ -60,9 +60,9 @@ For a detailed explanation of how to build and run the SRW App on any supported .. code-block:: console Please do the following to activate conda: - > conda activate workflow_tools + > conda activate srw_app - then the user should run ``conda activate workflow_tools`` to activate the workflow environment. + then the user should run ``conda activate srw_app`` to activate the workflow environment. #. Configure the experiment: diff --git a/docs/UsersGuide/source/BuildingRunningTesting/RunSRW.rst b/docs/UsersGuide/source/BuildingRunningTesting/RunSRW.rst index c7ea16d6b0..3ab35742c8 100644 --- a/docs/UsersGuide/source/BuildingRunningTesting/RunSRW.rst +++ b/docs/UsersGuide/source/BuildingRunningTesting/RunSRW.rst @@ -111,23 +111,37 @@ The first two steps depend on the platform being used and are described here for Load the Conda/Python Environment ------------------------------------ -The SRW App workflow is often referred to as the *regional workflow* because it runs experiments on a regional scale (unlike the *global workflow* used in other applications). The SRW App workflow requires installation of Python3 using conda; it also requires additional packages built in a separate conda evironment named ``workflow_tools``. On Level 1 systems, a ``workflow_tools`` environment already exists, and users merely need to load the environment. On Level 2-4 systems, users must create and then load the environment. The process for each is described in detail below. +The SRW App workflow requires a variety of Python packages. To manage the packages, the App relies +on conda as a package manager and virtual environment manager. At build time users have the option +to install the latest version of miniforge and automatically create the environments needed by SRW. +Managed environments will no longer be updated on Tier I platforms for newer versions of SRW. -.. _Load-WF-L1: -Loading the Workflow Environment on Level 1 Systems -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Installing miniconda and creating environments +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. attention:: +In addition to building the SRW App components, the ``devbuild.sh`` script will install miniconda, +specifically miniforge, and install the SRW-required environments if the ``conda`` target is +provided. For example, the following command will build all the default SRW components on the hera +platform using the Intel compiler, and will also install conda and environments: + +``` +./devbuild.sh --platform=hera --compiler=intel default conda +``` + + + +.. _Load-WF-L1: - Users on a Level 2-4 system should skip to the :ref:`next section ` for instructions. +Loading the Workflow Environment +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The ``workflow_tools`` conda/Python environment has already been set up on Level 1 platforms and can be activated in the following way: +The ``srw_app`` conda/Python environment can be activated in the following way: .. code-block:: console source /path/to/etc/lmod-setup.sh - module use /path/to/modulefiles + module use /path/to/ufs-srweather-app/modulefiles module load wflow_ where ```` refers to a valid machine name (see :numref:`Section %s ` for ``MACHINE`` options). In a csh shell environment, users should replace ``lmod-setup.sh`` with ``lmod-setup.csh``. @@ -140,106 +154,21 @@ The ``wflow_`` modulefile will then output instructions to activate th .. code-block:: console Please do the following to activate conda: - > conda activate workflow_tools + > conda activate srw_app -then the user should run ``conda activate workflow_tools``. This activates the ``workflow_tools`` conda environment, and the user typically sees ``(workflow_tools)`` in front of the Terminal prompt at this point. - -After loading the workflow environment, users may continue to :numref:`Section %s ` for instructions on setting the experiment configuration parameters. - -.. _Load-WF-L234: - -Loading the Workflow Environment on Level 2-4 Systems -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Users on non-Level 1 systems will need to create a conda workflow environment, modify a ``wflow_*`` file to reflect the location of required modules, and load the workflow modules using the modified ``wflow_*`` file. - -Create a *conda* Workflow Environment -``````````````````````````````````````` +then the user should run ``conda activate srw_app``. This activates the ``srw_app`` conda environment, and the user typically sees ``(srw_app)`` in front of the Terminal prompt at this point. .. note:: - Examples in this subsection presume that the user is running in the Terminal with a bash shell environment. If this is not the case, users will need to adjust the commands to fit their command line application and shell environment. - -.. _MacMorePackages: - -MacOS ONLY: Install/Upgrade Mac-Specific Packages -""""""""""""""""""""""""""""""""""""""""""""""""""" - -.. attention:: - - This subsection is for Mac OS users only. Users on Linux systems can skip to :ref:`Creating the workflow_tools Environment on Linux and Mac OS ` for instructions. - - -MacOS requires the installation of a few additional packages and, possibly, an upgrade to bash. Users running on MacOS should execute the following commands: - -.. code-block:: console - - bash --version - brew install bash # or: brew upgrade bash - brew install coreutils - brew gsed # follow directions to update the PATH env variable - - -.. _LinuxMacVEnv: + If users do not use the wflow module to load conda, ``conda`` will need to be initialized before running ``conda activate srw_app`` command. Depending on the user's system and login setup, this may be accomplished in a variety of ways. Conda initialization usually involves the following command: ``source /etc/profile.d/conda.sh``, where ```` is the base conda installation directory and by default will be the full path to ``ufs-srweather-app/conda``. -Creating the ``workflow_tools`` Environment on Linux and Mac OS -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - -On generic Mac and Linux systems, users need to create a conda ``workflow_tools`` environment. The environment can be stored in a local path, which could be a default location or a user-specified location (e.g., ``$HOME/condaenv/venvs/`` directory). (To determine the default location, use the ``conda info`` command, and look for the ``envs directories`` list.) The following is a brief recipe for creating a virtual conda environment on non-Level 1 platforms. It uses the aarch64 (64-bit ARM) Miniforge for Linux and installs into $HOME/conda. Adjust as necessary for your target system. - -.. code-block:: console - - wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-aarch64.sh - bash Miniforge3-Linux-aarch64.sh -bfp ~/conda - rm Miniforge3-Linux-aarch64.sh - source ~/conda/etc/profile.d/conda.sh - conda activate - conda install -y conda-build conda-verify - cd path/to/your/workflow-tools/clone - conda build recipe - conda create -y -n workflow_tools -c local workflow_tools - conda activate workflow_tools - -In future shells, you can activate and use this environment with: - -.. code-block:: console - - source ~/conda/etc/profile.d/conda.sh - conda activate uwtools - -See the `workflow-tools repository `__ for additional documentation. +After loading the workflow environment, users may continue to :numref:`Section %s ` for instructions on setting the experiment configuration parameters. Modify a ``wflow_`` File `````````````````````````````````````` -Users can copy one of the provided ``wflow_`` files from the ``modulefiles`` directory and use it as a template to create a ``wflow_`` file that functions on their system. The ``wflow_macos`` and ``wflow_linux`` template modulefiles are provided as a starting point, but any ``wflow_`` file could be used. Users must modify the files to provide paths for python, miniconda modules, module loads, conda initialization, and the user's ``workflow_tools`` conda environment. - -Load the Workflow Environment -``````````````````````````````` - -After creating a ``workflow_tools`` environment and making modifications to a ``wflow_`` file, users can run the commands below to activate the workflow environment: - -.. code-block:: console - - source /path/to/etc/lmod-setup.sh - module use /path/to/modulefiles - module load wflow_ - -where ```` refers to a valid machine name (i.e., ``linux`` or ``macos``). - -.. note:: - If users source the lmod-setup file on a system that doesn't need it, it will not cause any problems (it will simply do a ``module purge``). +Users can copy one of the provided ``wflow_`` files from the ``modulefiles`` directory and use it as a template to create a ``wflow_`` file that functions on their system. The ``wflow_macos`` and ``wflow_linux`` template modulefiles are provided as a starting point, but any ``wflow_`` file could be used. Since conda environments are installed with the SRW App build, the existing modulefiles will be able to automatically find those environments. No need to edit any of the information in those files for Python purposes. -The ``wflow_`` modulefile will then output the following instructions: -.. code-block:: console - - Please do the following to activate conda: - > conda activate workflow_tools - -After running ``conda activate workflow_tools``, the user will typically see ``(workflow_tools)`` in front of the Terminal prompt. This indicates that the workflow environment has been loaded successfully. - -.. note:: - ``conda`` needs to be initialized before running ``conda activate workflow_tools`` command. Depending on the user's system and login setup, this may be accomplished in a variety of ways. Conda initialization usually involves the following command: ``source /etc/profile.d/conda.sh``, where ```` is the base conda installation directory. .. _ExptConfig: @@ -416,7 +345,7 @@ A correct ``config.yaml`` file will output a ``SUCCESS`` message. A ``config.yam .. hint:: - * The ``workflow_tools`` environment must be loaded for the ``config_utils.py`` script to validate the ``config.yaml`` file. + * The ``srw_app`` environment must be loaded for the ``config_utils.py`` script to validate the ``config.yaml`` file. * Valid values for configuration variables should be consistent with those in the ``ush/valid_param_vals.yaml`` script. diff --git a/docs/UsersGuide/source/BuildingRunningTesting/Tutorial.rst b/docs/UsersGuide/source/BuildingRunningTesting/Tutorial.rst index c27544f54e..ff510bafc3 100644 --- a/docs/UsersGuide/source/BuildingRunningTesting/Tutorial.rst +++ b/docs/UsersGuide/source/BuildingRunningTesting/Tutorial.rst @@ -65,14 +65,14 @@ To load the workflow environment, source the lmod-setup file. Then load the work where ```` is a valid, lowercased machine name (see ``MACHINE`` in :numref:`Section %s ` for valid values). -After loading the workflow, users should follow the instructions printed to the console. Usually, the instructions will tell the user to run ``conda activate workflow_tools``. For example, a user on Hera with permissions on the ``nems`` project may issue the following commands to load the workflow (replacing ``User.Name`` with their actual username): +After loading the workflow, users should follow the instructions printed to the console. Usually, the instructions will tell the user to run ``conda activate srw_app``. For example, a user on Hera with permissions on the ``nems`` project may issue the following commands to load the workflow (replacing ``User.Name`` with their actual username): .. code-block:: console source /scratch1/NCEPDEV/nems/User.Name/ufs-srweather-app/etc/lmod-setup.sh hera module use /scratch1/NCEPDEV/nems/User.Name/ufs-srweather-app/modulefiles module load wflow_hera - conda activate workflow_tools + conda activate srw_app Configuration ------------------------- diff --git a/docs/UsersGuide/source/BuildingRunningTesting/VXCases.rst b/docs/UsersGuide/source/BuildingRunningTesting/VXCases.rst index 533f6e7fb2..950e7ac2c2 100644 --- a/docs/UsersGuide/source/BuildingRunningTesting/VXCases.rst +++ b/docs/UsersGuide/source/BuildingRunningTesting/VXCases.rst @@ -93,7 +93,7 @@ First, navigate to the ``ufs-srweather-app/ush`` directory. Then, load the workf Users running a csh/tcsh shell would run ``source /path/to/etc/lmod-setup.csh `` in place of the first command above. -After loading the workflow, users should follow the instructions printed to the console. Usually, the instructions will tell the user to run ``conda activate regional_workflow``. +After loading the workflow, users should follow the instructions printed to the console. Usually, the instructions will tell the user to run ``conda activate srw_app``. Configure the Verification Sample Case ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/docs/UsersGuide/source/Reference/FAQ.rst b/docs/UsersGuide/source/Reference/FAQ.rst index 237980789c..48c44680ed 100644 --- a/docs/UsersGuide/source/Reference/FAQ.rst +++ b/docs/UsersGuide/source/Reference/FAQ.rst @@ -234,7 +234,7 @@ To run a new experiment at a later time, users need to rerun the commands in :nu module use /path/to/modulefiles module load wflow_ -Follow any instructions output by the console (e.g., ``conda activate workflow_tools``). +Follow any instructions output by the console (e.g., ``conda activate srw_app``). Then, users can configure a new experiment by updating the environment variables in ``config.yaml`` to reflect the desired experiment configuration. Detailed instructions can be viewed in :numref:`Section %s `. Parameters and valid values are listed in :numref:`Section %s `. After adjusting the configuration file, generate the new experiment by running ``./generate_FV3LAM_wflow.py``. Check progress by navigating to the ``$EXPTDIR`` and running ``rocotostat -w FV3LAM_wflow.xml -d FV3LAM_wflow.db -v 10``. @@ -276,4 +276,4 @@ If you encounter issues while generating ICS and LBCS for a predefined 3-km grid Additionally, users can try increasing the number of processors or the wallclock time requested for the jobs. Sometimes jobs may fail without errors because the process is cut short. These settings can be adusted in one of the ``ufs-srweather-app/parm/wflow`` files. For ICs/LBCs tasks, these parameters are set in the ``coldstart.yaml`` file. -Users can also update the hash of UFS_UTILS in the ``Externals.cfg`` file to the HEAD of that repository. There was a known memory issue with how ``chgres_cube`` was handling regridding of the 3-D wind field for large domains at high resolutions (see `UFS_UTILS PR #766 `__ and the associated issue for more information). If changing the hash in ``Externals.cfg``, users will need to rerun ``manage_externals`` and rebuild the code (see :numref:`Section %s `). \ No newline at end of file +Users can also update the hash of UFS_UTILS in the ``Externals.cfg`` file to the HEAD of that repository. There was a known memory issue with how ``chgres_cube`` was handling regridding of the 3-D wind field for large domains at high resolutions (see `UFS_UTILS PR #766 `__ and the associated issue for more information). If changing the hash in ``Externals.cfg``, users will need to rerun ``manage_externals`` and rebuild the code (see :numref:`Section %s `). diff --git a/environment.yml b/environment.yml index c574df5e23..721cbab690 100644 --- a/environment.yml +++ b/environment.yml @@ -6,3 +6,9 @@ dependencies: - pylint=2.17* - pytest=7.2* - uwtools=1.0.0 + - bash + - macos + - coreutils + - macos + - sed + - macos From 5c644d8ac20cc9b17ddf5205ef32c0f15eeeb122 Mon Sep 17 00:00:00 2001 From: Christina Holt Date: Sat, 7 Oct 2023 02:39:18 +0000 Subject: [PATCH 14/43] Try different syntax --- environment.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/environment.yml b/environment.yml index 721cbab690..1d44433a3d 100644 --- a/environment.yml +++ b/environment.yml @@ -6,9 +6,9 @@ dependencies: - pylint=2.17* - pytest=7.2* - uwtools=1.0.0 - - bash + - bash: - macos - - coreutils + - coreutils: - macos - - sed + - sed: - macos From d3329d4b711830ef79ad59c2c4c38be9da0a8858 Mon Sep 17 00:00:00 2001 From: Christina Holt Date: Fri, 6 Oct 2023 20:57:31 -0600 Subject: [PATCH 15/43] Check if this limits this to only mac. --- environment.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/environment.yml b/environment.yml index 1d44433a3d..42da5616f1 100644 --- a/environment.yml +++ b/environment.yml @@ -2,10 +2,14 @@ name: srw_app channels: - conda-forge - ufs-community + - nodefaults dependencies: - pylint=2.17* - pytest=7.2* - uwtools=1.0.0 + - bash + - coreutils + - sed - bash: - macos - coreutils: From a0e047e410139a7d7aec555f041219d20fb0d5d7 Mon Sep 17 00:00:00 2001 From: Christina Holt Date: Fri, 6 Oct 2023 20:59:41 -0600 Subject: [PATCH 16/43] Revert "Check if this limits this to only mac." This reverts commit d3329d4b711830ef79ad59c2c4c38be9da0a8858. --- environment.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/environment.yml b/environment.yml index 42da5616f1..1d44433a3d 100644 --- a/environment.yml +++ b/environment.yml @@ -2,14 +2,10 @@ name: srw_app channels: - conda-forge - ufs-community - - nodefaults dependencies: - pylint=2.17* - pytest=7.2* - uwtools=1.0.0 - - bash - - coreutils - - sed - bash: - macos - coreutils: From 17c5af220dd0e39e3eb956cd73b7da8fbbe81553 Mon Sep 17 00:00:00 2001 From: Christina Holt Date: Tue, 10 Oct 2023 14:51:39 -0600 Subject: [PATCH 17/43] Fixes for building on MacOs. --- devbuild.sh | 10 +++++++--- environment.yml | 6 ------ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/devbuild.sh b/devbuild.sh index 07e6fb56b2..c555865e9a 100755 --- a/devbuild.sh +++ b/devbuild.sh @@ -314,18 +314,22 @@ CONDA_BUILD_DIR="./conda" if [ "${BUILD_CONDA}" = "on" ] ; then if [ ! -d "${CONDA_BUILD_DIR}" ] ; then installer=Miniforge3-$(uname)-$(uname -m).sh - wget "https://github.com/conda-forge/miniforge/releases/latest/download/${installer}" + curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/${installer}" bash ./${installer} -bfp "${CONDA_BUILD_DIR}" rm ${installer} fi source ${CONDA_BUILD_DIR}/etc/profile.d/conda.sh + # Put some additional packages in the base environment on MacOS systems + if [ $(uname) == "Darwin" ] ; then + conda install -y bash coreutils sed + fi conda activate if ! conda env list | grep -q "^srw_app\s" ; then - mamba env create -n srw_app --file environment.yml + conda env create -n srw_app --file environment.yml fi if ! conda env list | grep -q "^srw_graphics\s" ; then - mamba env create -n srw_graphics --file graphics_environment.yml + conda env create -n srw_graphics --file graphics_environment.yml fi else source ${CONDA_BUILD_DIR}/etc/profile.d/conda.sh diff --git a/environment.yml b/environment.yml index 1d44433a3d..c574df5e23 100644 --- a/environment.yml +++ b/environment.yml @@ -6,9 +6,3 @@ dependencies: - pylint=2.17* - pytest=7.2* - uwtools=1.0.0 - - bash: - - macos - - coreutils: - - macos - - sed: - - macos From 2fcc2b2f4657deeadf189fc8eace3e3421ab72b1 Mon Sep 17 00:00:00 2001 From: "Christina.Holt" Date: Tue, 10 Oct 2023 22:12:50 +0000 Subject: [PATCH 18/43] Configurable conda location. --- .gitignore | 1 + devbuild.sh | 19 +++++++++++++------ modulefiles/conda.lua | 4 ++-- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index b6da1c53a0..8566703a22 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ ush/config.yaml ush/python_utils/__pycache__/ ush/python_utils/workflow-tools/ ush/*.swp +conda_loc *.swp __pycache__ diff --git a/devbuild.sh b/devbuild.sh index c555865e9a..1246fadb49 100755 --- a/devbuild.sh +++ b/devbuild.sh @@ -104,6 +104,7 @@ MACHINE_SETUP=${SRW_DIR}/src/UFS_UTILS/sorc/machine-setup.sh BUILD_DIR="${SRW_DIR}/build" INSTALL_DIR=${SRW_DIR} BIN_DIR="exec" +CONDA_BUILD_DIR="${SRW_DIR}/conda" COMPILER="" APPLICATION="" CCPP_SUITES="" @@ -165,6 +166,8 @@ while :; do --install-dir|--install-dir=) usage_error "$1 requires argument." ;; --bin-dir=?*) BIN_DIR=${1#*=} ;; --bin-dir|--bin-dir=) usage_error "$1 requires argument." ;; + --conda-dir=?*) CONDA_BUILD_DIR=${1#*=} ;; + --conda-dir|--conda-dir=) usage_error "$1 requires argument." ;; --build-type=?*) BUILD_TYPE=${1#*=} ;; --build-type|--build-type=) usage_error "$1 requires argument." ;; --build-jobs=?*) BUILD_JOBS=$((${1#*=})) ;; @@ -310,10 +313,13 @@ fi # build conda and conda environments, if requested. set -x -CONDA_BUILD_DIR="./conda" +CONDA_BUILD_DIR="$(readlink -f "${CONDA_BUILD_DIR}")" if [ "${BUILD_CONDA}" = "on" ] ; then if [ ! -d "${CONDA_BUILD_DIR}" ] ; then - installer=Miniforge3-$(uname)-$(uname -m).sh + os=$(uname) + test $os == Darwin && os=MacOSX + hardware=$(uname -m) + installer=Miniforge3-${os}-${hardware}.sh curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/${installer}" bash ./${installer} -bfp "${CONDA_BUILD_DIR}" rm ${installer} @@ -321,20 +327,21 @@ if [ "${BUILD_CONDA}" = "on" ] ; then source ${CONDA_BUILD_DIR}/etc/profile.d/conda.sh # Put some additional packages in the base environment on MacOS systems - if [ $(uname) == "Darwin" ] ; then - conda install -y bash coreutils sed + if [ "${os}" == "MacOSX" ] ; then + mamba install -y bash coreutils sed fi conda activate if ! conda env list | grep -q "^srw_app\s" ; then - conda env create -n srw_app --file environment.yml + mamba env create -n srw_app --file environment.yml fi if ! conda env list | grep -q "^srw_graphics\s" ; then - conda env create -n srw_graphics --file graphics_environment.yml + mamba env create -n srw_graphics --file graphics_environment.yml fi else source ${CONDA_BUILD_DIR}/etc/profile.d/conda.sh conda activate fi +echo ${CONDA_BUILD_DIR} > ${SRW_DIR}/conda_loc # cmake settings CMAKE_SETTINGS="\ diff --git a/modulefiles/conda.lua b/modulefiles/conda.lua index 6d6425e97b..1400dadad2 100644 --- a/modulefiles/conda.lua +++ b/modulefiles/conda.lua @@ -8,13 +8,13 @@ local shell=myShellType() conflict(pkgName) local mod_path, mod_file = splitFileName(myFileName()) -local base = pathJoin(mod_path, "..", "conda") +local conda_loc_file = pathJoin(mod_path, "..", "conda_loc") +local base = capture("cat " .. conda_loc_file) local conda_file = pathJoin(base, "etc", "profile.d", "conda." .. shell) local command = "source " .. conda_file local level -base = capture("readlink -f " .. base) execute{cmd=command, modeA={"load", "unload"}} From d11254c64365a19131227bd44401668080c951e7 Mon Sep 17 00:00:00 2001 From: Christina Holt Date: Tue, 10 Oct 2023 16:45:43 -0600 Subject: [PATCH 19/43] Make it MacOS compatible. --- devbuild.sh | 83 +++++++++++++++++++++++++++-------------------------- 1 file changed, 42 insertions(+), 41 deletions(-) diff --git a/devbuild.sh b/devbuild.sh index 1246fadb49..6ce45ca3a0 100755 --- a/devbuild.sh +++ b/devbuild.sh @@ -99,12 +99,8 @@ usage_error () { # default settings LCL_PID=$$ -SRW_DIR=$(cd "$(dirname "$(readlink -f -n "${BASH_SOURCE[0]}" )" )" && pwd -P) -MACHINE_SETUP=${SRW_DIR}/src/UFS_UTILS/sorc/machine-setup.sh -BUILD_DIR="${SRW_DIR}/build" -INSTALL_DIR=${SRW_DIR} BIN_DIR="exec" -CONDA_BUILD_DIR="${SRW_DIR}/conda" +CONDA_BUILD_DIR="conda" COMPILER="" APPLICATION="" CCPP_SUITES="" @@ -192,11 +188,48 @@ while :; do shift done +# build conda and conda environments, if requested. +set -x +if [ "${BUILD_CONDA}" = "on" ] ; then + if [ ! -d "${CONDA_BUILD_DIR}" ] ; then + os=$(uname) + test $os == Darwin && os=MacOSX + hardware=$(uname -m) + installer=Miniforge3-${os}-${hardware}.sh + curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/${installer}" + bash ./${installer} -bfp "${CONDA_BUILD_DIR}" + rm ${installer} + fi + + source ${CONDA_BUILD_DIR}/etc/profile.d/conda.sh + # Put some additional packages in the base environment on MacOS systems + if [ "${os}" == "MacOSX" ] ; then + mamba install -y bash coreutils sed + fi + conda activate + if ! conda env list | grep -q "^srw_app\s" ; then + mamba env create -n srw_app --file environment.yml + fi + if ! conda env list | grep -q "^srw_graphics\s" ; then + mamba env create -n srw_graphics --file graphics_environment.yml + fi +else + source ${CONDA_BUILD_DIR}/etc/profile.d/conda.sh + conda activate +fi + +# Conda environment should have linux utilties to perform these tasks on macos. +SRW_DIR=$(cd "$(dirname "$(readlink -f -n "${BASH_SOURCE[0]}" )" )" && pwd -P) +MACHINE_SETUP=${SRW_DIR}/src/UFS_UTILS/sorc/machine-setup.sh +BUILD_DIR="${SRW_DIR}/build" +INSTALL_DIR=${SRW_DIR} +CONDA_BUILD_DIR="$(readlink -f "${CONDA_BUILD_DIR}")" +echo ${CONDA_BUILD_DIR} > ${SRW_DIR}/conda_loc + # Ensure uppercase / lowercase ============================================ -APPLICATION="${APPLICATION^^}" -PLATFORM="${PLATFORM,,}" -COMPILER="${COMPILER,,}" -EXTERNALS="${EXTERNALS^^}" +APPLICATION=$(echo ${APPLICATION} | tr '[a-z]' '[A-Z]') +PLATFORM=$(echo ${PLATFORM} | tr '[A-Z]' '[a-z]') +COMPILER=$(echo ${COMPILER} | tr '[A-Z]' '[a-z]') # check if PLATFORM is set if [ -z $PLATFORM ] ; then @@ -311,38 +344,6 @@ else fi fi -# build conda and conda environments, if requested. -set -x -CONDA_BUILD_DIR="$(readlink -f "${CONDA_BUILD_DIR}")" -if [ "${BUILD_CONDA}" = "on" ] ; then - if [ ! -d "${CONDA_BUILD_DIR}" ] ; then - os=$(uname) - test $os == Darwin && os=MacOSX - hardware=$(uname -m) - installer=Miniforge3-${os}-${hardware}.sh - curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/${installer}" - bash ./${installer} -bfp "${CONDA_BUILD_DIR}" - rm ${installer} - fi - - source ${CONDA_BUILD_DIR}/etc/profile.d/conda.sh - # Put some additional packages in the base environment on MacOS systems - if [ "${os}" == "MacOSX" ] ; then - mamba install -y bash coreutils sed - fi - conda activate - if ! conda env list | grep -q "^srw_app\s" ; then - mamba env create -n srw_app --file environment.yml - fi - if ! conda env list | grep -q "^srw_graphics\s" ; then - mamba env create -n srw_graphics --file graphics_environment.yml - fi -else - source ${CONDA_BUILD_DIR}/etc/profile.d/conda.sh - conda activate -fi -echo ${CONDA_BUILD_DIR} > ${SRW_DIR}/conda_loc - # cmake settings CMAKE_SETTINGS="\ -DCMAKE_BUILD_TYPE=${BUILD_TYPE}\ From c7b2cc8b2d62d666b63d892f294475ceed67a910 Mon Sep 17 00:00:00 2001 From: Gillian Petro <96886803+gspetro-NOAA@users.noreply.github.com> Date: Wed, 11 Oct 2023 21:21:49 -0400 Subject: [PATCH 20/43] format note block The note block must be indented to render properly. --- docs/UsersGuide/source/BackgroundInfo/TechnicalOverview.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/UsersGuide/source/BackgroundInfo/TechnicalOverview.rst b/docs/UsersGuide/source/BackgroundInfo/TechnicalOverview.rst index 2b457358ec..adb89610e3 100644 --- a/docs/UsersGuide/source/BackgroundInfo/TechnicalOverview.rst +++ b/docs/UsersGuide/source/BackgroundInfo/TechnicalOverview.rst @@ -95,8 +95,8 @@ Optional but recommended prerequisites for all systems: * Python packages ``scipy``, ``matplotlib``, ``pygrib``, ``cartopy``, and ``pillow`` for graphics .. note:: -The SRW build will install conda, and necessary conda environments for running the workflow and the -graphics automatically when the ``conda`` target is included at build time. + The SRW build will install conda, and necessary conda environments for running the workflow and the + graphics automatically when the ``conda`` target is included at build time. .. _SRWStructure: From 4a19ec53801f87d2d1bf67ddeb9e27e15a329868 Mon Sep 17 00:00:00 2001 From: Gillian Petro <96886803+gspetro-NOAA@users.noreply.github.com> Date: Wed, 11 Oct 2023 21:46:35 -0400 Subject: [PATCH 21/43] Rm dead link to MacMorePackages Remove reference to the MacMorePackages section. That section was deleted in favor of the conda env installation approach. --- docs/UsersGuide/source/BackgroundInfo/TechnicalOverview.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/UsersGuide/source/BackgroundInfo/TechnicalOverview.rst b/docs/UsersGuide/source/BackgroundInfo/TechnicalOverview.rst index adb89610e3..0c613b7058 100644 --- a/docs/UsersGuide/source/BackgroundInfo/TechnicalOverview.rst +++ b/docs/UsersGuide/source/BackgroundInfo/TechnicalOverview.rst @@ -78,7 +78,7 @@ The following software is also required to run the SRW Application, but the :ter * Only **MPICH** or **OpenMPI** can be built with HPC-Stack. Other implementations must be installed separately by the user (if desired). -For MacOS systems, some additional software packages are needed. When possible, it is recommended that users install and/or upgrade this software (along with software listed above) using the `Homebrew `__ package manager for MacOS. See :doc:`HPC-Stack Documentation: Chapter 3 ` and :numref:`Chapter %s ` for further guidance on installing these prerequisites on MacOS. +For MacOS systems, some additional software packages are needed. When possible, it is recommended that users install and/or upgrade this software (along with software listed above) using the `Homebrew `__ package manager for MacOS. See :doc:`HPC-Stack Documentation: Chapter 3 ` for further guidance on installing these prerequisites on MacOS. * bash v4.x * GNU compiler suite v11 or higher with gfortran From 1466e1489c6802990e08235dd7bf542aa3199ee3 Mon Sep 17 00:00:00 2001 From: Christina Holt <56881914+christinaholtNOAA@users.noreply.github.com> Date: Tue, 17 Oct 2023 09:36:33 -0600 Subject: [PATCH 22/43] Update docs/UsersGuide/source/BuildingRunningTesting/RunSRW.rst Co-authored-by: Gillian Petro <96886803+gspetro-NOAA@users.noreply.github.com> --- docs/UsersGuide/source/BuildingRunningTesting/RunSRW.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/UsersGuide/source/BuildingRunningTesting/RunSRW.rst b/docs/UsersGuide/source/BuildingRunningTesting/RunSRW.rst index 3ab35742c8..5f51c4840e 100644 --- a/docs/UsersGuide/source/BuildingRunningTesting/RunSRW.rst +++ b/docs/UsersGuide/source/BuildingRunningTesting/RunSRW.rst @@ -125,9 +125,9 @@ specifically miniforge, and install the SRW-required environments if the ``conda provided. For example, the following command will build all the default SRW components on the hera platform using the Intel compiler, and will also install conda and environments: -``` -./devbuild.sh --platform=hera --compiler=intel default conda -``` +.. code-block:: console + + ./devbuild.sh --platform=hera --compiler=intel default conda From 1caae9605ccb78c71742f7c6490a5b7f7dc0f7d6 Mon Sep 17 00:00:00 2001 From: "Christina.Holt" Date: Tue, 17 Oct 2023 20:07:50 +0000 Subject: [PATCH 23/43] Updating docs with Gillian's feedback. --- .../source/BuildingRunningTesting/BuildSRW.rst | 18 +++++++++++++++++- docs/UsersGuide/source/Reference/FAQ.rst | 2 +- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/docs/UsersGuide/source/BuildingRunningTesting/BuildSRW.rst b/docs/UsersGuide/source/BuildingRunningTesting/BuildSRW.rst index 5b871fe87f..fa21fb1010 100644 --- a/docs/UsersGuide/source/BuildingRunningTesting/BuildSRW.rst +++ b/docs/UsersGuide/source/BuildingRunningTesting/BuildSRW.rst @@ -196,10 +196,26 @@ On Level 1 systems for which a modulefile is provided under the ``modulefiles`` .. code-block:: console - ./devbuild.sh --platform= + ./devbuild.sh --platform= conda where ```` is replaced with the name of the platform the user is working on. Valid values include: ``cheyenne`` | ``gaea`` | ``hera`` | ``jet`` | ``linux`` | ``macos`` | ``noaacloud`` | ``orion`` +Here, ``conda`` is included as a target, which will also install conda and SRW environments as part +of the build process. The location defaults to inside the SRW clone in ufs-srweather-app/conda, +however users can set any path on their system using the ``--conda-dir`` flag. If conda is already +installed in that location, conda installation will be skipped. The following example uses a +pre-installed conda installation at ``/path/to/conda`` + +.. code-block:: console + + ./devbuild.sh --platform= --conda-dir /path/to/conda + +To install conda in an arbitrary location, use both the ``conda`` target and the ``--conda-dir`` +flag. + +Running ``./devbuild.sh`` will show the usage statement for all available flags and targets for this +script. + .. note:: Although build modulefiles exist for generic Linux and MacOS machines, users will need to alter these according to the instructions in Sections :numref:`%s ` & :numref:`%s `. Users on these systems may have more success building the SRW App with the :ref:`CMake Approach ` instead. diff --git a/docs/UsersGuide/source/Reference/FAQ.rst b/docs/UsersGuide/source/Reference/FAQ.rst index 48c44680ed..702b0bfc7e 100644 --- a/docs/UsersGuide/source/Reference/FAQ.rst +++ b/docs/UsersGuide/source/Reference/FAQ.rst @@ -226,7 +226,7 @@ In addition to the options above, many standard terminal commands can be run to How can I run a new experiment? ================================== -To run a new experiment at a later time, users need to rerun the commands in :numref:`Section %s ` that reactivate the *workflow_tools* environment: +To run a new experiment at a later time, users need to rerun the commands in :numref:`Section %s ` that reactivate the *srw_app* environment: .. code-block:: console From a2410ef1409372fbd7d3a4f4888533d87400c615 Mon Sep 17 00:00:00 2001 From: "Christina.Holt" Date: Tue, 17 Oct 2023 20:12:58 +0000 Subject: [PATCH 24/43] Update quickstart, too --- docs/UsersGuide/source/BuildingRunningTesting/Quickstart.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/UsersGuide/source/BuildingRunningTesting/Quickstart.rst b/docs/UsersGuide/source/BuildingRunningTesting/Quickstart.rst index 387e8d6d2e..e05246c892 100644 --- a/docs/UsersGuide/source/BuildingRunningTesting/Quickstart.rst +++ b/docs/UsersGuide/source/BuildingRunningTesting/Quickstart.rst @@ -40,7 +40,7 @@ For a detailed explanation of how to build and run the SRW App on any supported .. code-block:: console - ./devbuild.sh --platform= + ./devbuild.sh --platform= conda where ```` is replaced with the name of the user's platform/system. Valid values include: ``cheyenne`` | ``gaea`` | ``hera`` | ``jet`` | ``linux`` | ``macos`` | ``noaacloud`` | ``orion`` | ``wcoss2`` From c2b6d2e57ae8d4cadd59a1938a456c7169d81823 Mon Sep 17 00:00:00 2001 From: "Christina.Holt" Date: Wed, 18 Oct 2023 19:45:13 +0000 Subject: [PATCH 25/43] Reverting changes for containers. --- .../source/BuildingRunningTesting/ContainerQuickstart.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/UsersGuide/source/BuildingRunningTesting/ContainerQuickstart.rst b/docs/UsersGuide/source/BuildingRunningTesting/ContainerQuickstart.rst index 129645da26..d0e0d0507a 100644 --- a/docs/UsersGuide/source/BuildingRunningTesting/ContainerQuickstart.rst +++ b/docs/UsersGuide/source/BuildingRunningTesting/ContainerQuickstart.rst @@ -271,9 +271,9 @@ The ``wflow_`` modulefile will then output instructions to activate th .. code-block:: console Please do the following to activate conda: - > conda activate srw_app + > conda activate regional_workflow -then the user should run ``conda activate srw_app``. This will activate the ``srw_app`` conda environment. The command(s) will vary from system to system, but the user should see ``(srw_app)`` in front of the Terminal prompt at this point. +then the user should run ``conda activate regional_workflow``. This will activate the ``regional_workflow`` conda environment. The command(s) will vary from system to system, but the user should see ``(regional_workflow)`` in front of the Terminal prompt at this point. .. _SetUpConfigFileC: From 3fd7f2f7cf3484ef40cc40150c9f99d973d539ef Mon Sep 17 00:00:00 2001 From: "Christina.Holt" Date: Wed, 18 Oct 2023 19:46:25 +0000 Subject: [PATCH 26/43] Reverting changes to VX chapter. --- docs/UsersGuide/source/BuildingRunningTesting/VXCases.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/UsersGuide/source/BuildingRunningTesting/VXCases.rst b/docs/UsersGuide/source/BuildingRunningTesting/VXCases.rst index 950e7ac2c2..af8ace30a8 100644 --- a/docs/UsersGuide/source/BuildingRunningTesting/VXCases.rst +++ b/docs/UsersGuide/source/BuildingRunningTesting/VXCases.rst @@ -93,7 +93,7 @@ First, navigate to the ``ufs-srweather-app/ush`` directory. Then, load the workf Users running a csh/tcsh shell would run ``source /path/to/etc/lmod-setup.csh `` in place of the first command above. -After loading the workflow, users should follow the instructions printed to the console. Usually, the instructions will tell the user to run ``conda activate srw_app``. +After loading the workflow, users should follow the instructions printed to the console. Usually, the instructions will tell the user to run ``conda activate regional_workflow``. Configure the Verification Sample Case ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ From bd8009f29cacb1870a82ec56b1ee6d3d6dcc9d54 Mon Sep 17 00:00:00 2001 From: Christina Holt <56881914+christinaholtNOAA@users.noreply.github.com> Date: Wed, 18 Oct 2023 13:50:58 -0600 Subject: [PATCH 27/43] Update devbuild.sh Co-authored-by: Michael Lueken <63728921+MichaelLueken@users.noreply.github.com> --- devbuild.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devbuild.sh b/devbuild.sh index 6ce45ca3a0..786840a6fd 100755 --- a/devbuild.sh +++ b/devbuild.sh @@ -218,7 +218,7 @@ else conda activate fi -# Conda environment should have linux utilties to perform these tasks on macos. +# Conda environment should have linux utilities to perform these tasks on macos. SRW_DIR=$(cd "$(dirname "$(readlink -f -n "${BASH_SOURCE[0]}" )" )" && pwd -P) MACHINE_SETUP=${SRW_DIR}/src/UFS_UTILS/sorc/machine-setup.sh BUILD_DIR="${SRW_DIR}/build" From db0de87cf08fbb38629a7280f3c09b8b3522347a Mon Sep 17 00:00:00 2001 From: "Christina.Holt" Date: Wed, 18 Oct 2023 19:55:02 +0000 Subject: [PATCH 28/43] Don't overwrite defaults. --- devbuild.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/devbuild.sh b/devbuild.sh index 6ce45ca3a0..ff2c3c63bb 100755 --- a/devbuild.sh +++ b/devbuild.sh @@ -221,8 +221,8 @@ fi # Conda environment should have linux utilties to perform these tasks on macos. SRW_DIR=$(cd "$(dirname "$(readlink -f -n "${BASH_SOURCE[0]}" )" )" && pwd -P) MACHINE_SETUP=${SRW_DIR}/src/UFS_UTILS/sorc/machine-setup.sh -BUILD_DIR="${SRW_DIR}/build" -INSTALL_DIR=${SRW_DIR} +BUILD_DIR="${BUILD_DIR:-${SRW_DIR}/build}" +INSTALL_DIR=${INSTALL_DIR:-$SRW_DIR} CONDA_BUILD_DIR="$(readlink -f "${CONDA_BUILD_DIR}")" echo ${CONDA_BUILD_DIR} > ${SRW_DIR}/conda_loc From 0e03b3926ff1e654f97bfd023e641ce7915c7959 Mon Sep 17 00:00:00 2001 From: Christina Holt <56881914+christinaholtNOAA@users.noreply.github.com> Date: Wed, 18 Oct 2023 15:21:54 -0600 Subject: [PATCH 29/43] Update devbuild.sh Co-authored-by: Michael Kavulich --- devbuild.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/devbuild.sh b/devbuild.sh index 2b18017b3f..28de6f6ea1 100755 --- a/devbuild.sh +++ b/devbuild.sh @@ -189,7 +189,6 @@ while :; do done # build conda and conda environments, if requested. -set -x if [ "${BUILD_CONDA}" = "on" ] ; then if [ ! -d "${CONDA_BUILD_DIR}" ] ; then os=$(uname) From ec19437f59f36051de2d4e298f76bb9027aa28b7 Mon Sep 17 00:00:00 2001 From: "Christina.Holt" Date: Wed, 18 Oct 2023 22:11:15 +0000 Subject: [PATCH 30/43] Addressing some of Mike's review comments. --- devbuild.sh | 14 ++++++++++---- tests/README.md | 6 ++++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/devbuild.sh b/devbuild.sh index 2b18017b3f..a768487f4a 100755 --- a/devbuild.sh +++ b/devbuild.sh @@ -41,6 +41,8 @@ OPTIONS installation prefix --bin-dir=BIN_DIR installation binary directory name ("exec" by default; any name is available) + --conda-dir=CONDA_DIR + installation location for miniconda (SRW clone conda subdirectory by default) --build-type=BUILD_TYPE build type; defaults to RELEASE (e.g. DEBUG | RELEASE | RELWITHDEBINFO) @@ -52,9 +54,12 @@ OPTIONS build with verbose output TARGETS - default = builds the default list of apps (also not passing any target does the same) - all = builds all apps - Or any combinations of (ufs, ufs_utils, upp) + default = builds the default list of components for the specified application + (also not passing any target does the same) + all = builds all standard components for ATM + conda = installs miniconda + conda_only = installs miniconda, but no other + Or any combinations of (ufs, ufs_utils, upp, nexus, aqm_utils, conda) NOTE: See User's Guide for detailed build instructions @@ -176,6 +181,7 @@ while :; do all) DEFAULT_BUILD=false; BUILD_UFS="on"; BUILD_UFS_UTILS="on"; BUILD_UPP="on";; conda) BUILD_CONDA="on";; + conda_only) BUILD_CONDA="on"; DEFAULT_BUILD=false;; ufs) DEFAULT_BUILD=false; BUILD_UFS="on" ;; ufs_utils) DEFAULT_BUILD=false; BUILD_UFS_UTILS="on" ;; upp) DEFAULT_BUILD=false; BUILD_UPP="on" ;; @@ -196,7 +202,7 @@ if [ "${BUILD_CONDA}" = "on" ] ; then test $os == Darwin && os=MacOSX hardware=$(uname -m) installer=Miniforge3-${os}-${hardware}.sh - curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/${installer}" + curl -L -O "https://github.com/conda-forge/miniforge/releases/23.3.1-1/download/${installer}" bash ./${installer} -bfp "${CONDA_BUILD_DIR}" rm ${installer} fi diff --git a/tests/README.md b/tests/README.md index 3670d50635..b9b9b2c0f3 100644 --- a/tests/README.md +++ b/tests/README.md @@ -46,10 +46,12 @@ The unit tests in the test_python/ directory test various parts of the workflow ### Set PYTHONPATH -First, you will need to set the PYTHONPATH environment variable to include the ush/ directory: +First, you will need to set the PYTHONPATH environment variable to include the ush/ directory and +the a few of the workflow-toools subdirectories. From the top level of the ufs-srweather-app clone +run the following command: ``` -export PYTHONPATH=/path/to/ufs-srweather-app/ush:${PYTHONPATH} +export PYTHONPATH=$(pwd)/ush:$(pwd)/ush/python_utils/workflow-tools:$(pwd)/ush/python_utils/workflow-tools/src ``` ### Set up HPSS tests From 09c3917b7cd7f5db6234bdb4cc977c4281b88067 Mon Sep 17 00:00:00 2001 From: "Christina.Holt" Date: Thu, 19 Oct 2023 18:00:17 +0000 Subject: [PATCH 31/43] Fix issue with URL. --- devbuild.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devbuild.sh b/devbuild.sh index fa24d5038d..7ab66adb46 100755 --- a/devbuild.sh +++ b/devbuild.sh @@ -201,7 +201,7 @@ if [ "${BUILD_CONDA}" = "on" ] ; then test $os == Darwin && os=MacOSX hardware=$(uname -m) installer=Miniforge3-${os}-${hardware}.sh - curl -L -O "https://github.com/conda-forge/miniforge/releases/23.3.1-1/download/${installer}" + curl -L -O "https://github.com/conda-forge/miniforge/releases/download/23.3.1-1/${installer}" bash ./${installer} -bfp "${CONDA_BUILD_DIR}" rm ${installer} fi From 79d9abcbffc3842df28245c1bfe46c24fa5a3532 Mon Sep 17 00:00:00 2001 From: "Christina.Holt" Date: Fri, 20 Oct 2023 14:00:30 +0000 Subject: [PATCH 32/43] Turn conda on by default, off for AQM. --- devbuild.sh | 10 +++++----- .../source/BuildingRunningTesting/BuildSRW.rst | 13 +++++-------- .../source/BuildingRunningTesting/Quickstart.rst | 2 +- .../source/BuildingRunningTesting/RunSRW.rst | 2 +- graphics_environment.yml | 1 - 5 files changed, 12 insertions(+), 16 deletions(-) diff --git a/devbuild.sh b/devbuild.sh index 7ab66adb46..e0a421838c 100755 --- a/devbuild.sh +++ b/devbuild.sh @@ -57,9 +57,8 @@ TARGETS default = builds the default list of components for the specified application (also not passing any target does the same) all = builds all standard components for ATM - conda = installs miniconda conda_only = installs miniconda, but no other - Or any combinations of (ufs, ufs_utils, upp, nexus, aqm_utils, conda) + Or any combinations of (ufs, ufs_utils, upp, nexus, aqm_utils) NOTE: See User's Guide for detailed build instructions @@ -119,7 +118,7 @@ VERBOSE=false # Turn off all apps to build and choose default later DEFAULT_BUILD=true -BUILD_CONDA="off" +BUILD_CONDA="on" BUILD_UFS="off" BUILD_UFS_UTILS="off" BUILD_UPP="off" @@ -180,8 +179,7 @@ while :; do default) ;; all) DEFAULT_BUILD=false; BUILD_UFS="on"; BUILD_UFS_UTILS="on"; BUILD_UPP="on";; - conda) BUILD_CONDA="on";; - conda_only) BUILD_CONDA="on"; DEFAULT_BUILD=false;; + conda_only) DEFAULT_BUILD=false;; ufs) DEFAULT_BUILD=false; BUILD_UFS="on" ;; ufs_utils) DEFAULT_BUILD=false; BUILD_UFS_UTILS="on" ;; upp) DEFAULT_BUILD=false; BUILD_UPP="on" ;; @@ -258,9 +256,11 @@ if [ "${APPLICATION}" = "ATMAQ" ]; then if [ "${DEFAULT_BUILD}" = true ]; then BUILD_NEXUS="on" BUILD_AQM_UTILS="on" + BUILD_CONDA="off" fi if [ "${PLATFORM}" = "wcoss2" ]; then BUILD_POST_STAT="on" + BUILD_CONDA="off" else BUILD_POST_STAT="off" fi diff --git a/docs/UsersGuide/source/BuildingRunningTesting/BuildSRW.rst b/docs/UsersGuide/source/BuildingRunningTesting/BuildSRW.rst index fa21fb1010..ccaa2fa6cb 100644 --- a/docs/UsersGuide/source/BuildingRunningTesting/BuildSRW.rst +++ b/docs/UsersGuide/source/BuildingRunningTesting/BuildSRW.rst @@ -196,12 +196,12 @@ On Level 1 systems for which a modulefile is provided under the ``modulefiles`` .. code-block:: console - ./devbuild.sh --platform= conda + ./devbuild.sh --platform= where ```` is replaced with the name of the platform the user is working on. Valid values include: ``cheyenne`` | ``gaea`` | ``hera`` | ``jet`` | ``linux`` | ``macos`` | ``noaacloud`` | ``orion`` -Here, ``conda`` is included as a target, which will also install conda and SRW environments as part -of the build process. The location defaults to inside the SRW clone in ufs-srweather-app/conda, +Starting with SRW v2.2.0 will install miniconda and SRW environments as part +of the build process. The location defaults to inside the SRW clone in ``ufs-srweather-app/conda``, however users can set any path on their system using the ``--conda-dir`` flag. If conda is already installed in that location, conda installation will be skipped. The following example uses a pre-installed conda installation at ``/path/to/conda`` @@ -210,11 +210,8 @@ pre-installed conda installation at ``/path/to/conda`` ./devbuild.sh --platform= --conda-dir /path/to/conda -To install conda in an arbitrary location, use both the ``conda`` target and the ``--conda-dir`` -flag. - -Running ``./devbuild.sh`` will show the usage statement for all available flags and targets for this -script. +Running ``./devbuild.sh`` without any arguments will show the usage statement for all available +flags and targets for this script. .. note:: Although build modulefiles exist for generic Linux and MacOS machines, users will need to alter these according to the instructions in Sections :numref:`%s ` & :numref:`%s `. Users on these systems may have more success building the SRW App with the :ref:`CMake Approach ` instead. diff --git a/docs/UsersGuide/source/BuildingRunningTesting/Quickstart.rst b/docs/UsersGuide/source/BuildingRunningTesting/Quickstart.rst index e05246c892..387e8d6d2e 100644 --- a/docs/UsersGuide/source/BuildingRunningTesting/Quickstart.rst +++ b/docs/UsersGuide/source/BuildingRunningTesting/Quickstart.rst @@ -40,7 +40,7 @@ For a detailed explanation of how to build and run the SRW App on any supported .. code-block:: console - ./devbuild.sh --platform= conda + ./devbuild.sh --platform= where ```` is replaced with the name of the user's platform/system. Valid values include: ``cheyenne`` | ``gaea`` | ``hera`` | ``jet`` | ``linux`` | ``macos`` | ``noaacloud`` | ``orion`` | ``wcoss2`` diff --git a/docs/UsersGuide/source/BuildingRunningTesting/RunSRW.rst b/docs/UsersGuide/source/BuildingRunningTesting/RunSRW.rst index 5f51c4840e..4c92779f0b 100644 --- a/docs/UsersGuide/source/BuildingRunningTesting/RunSRW.rst +++ b/docs/UsersGuide/source/BuildingRunningTesting/RunSRW.rst @@ -127,7 +127,7 @@ platform using the Intel compiler, and will also install conda and environments: .. code-block:: console - ./devbuild.sh --platform=hera --compiler=intel default conda + ./devbuild.sh --platform=hera --compiler=intel default diff --git a/graphics_environment.yml b/graphics_environment.yml index 78b3e3c762..732561b6b6 100644 --- a/graphics_environment.yml +++ b/graphics_environment.yml @@ -13,5 +13,4 @@ dependencies: - pyproj=2.6* - pytest=7.1* - pyyaml=6.0* - - pyyaml=6.0* - scipy=1.9* From e666780d2cdd9601d45d29715136bae5287af48d Mon Sep 17 00:00:00 2001 From: "Christina.Holt" Date: Fri, 20 Oct 2023 14:04:23 +0000 Subject: [PATCH 33/43] Remove conda target from test build script. --- tests/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/build.sh b/tests/build.sh index ea3dd91939..b1d7a00091 100755 --- a/tests/build.sh +++ b/tests/build.sh @@ -42,7 +42,7 @@ machine=$(echo "${MACHINE}" | tr '[A-Z]' '[a-z]') # scripts in sorc need lower compiler=${2:-"intel"} -components=${3:-"default conda"} +components=${3:-"default"} #----------------------------------------------------------------------- # Check that machine is valid From a34c0e4c84c94cdae6b643e6c1cc2efb7550e998 Mon Sep 17 00:00:00 2001 From: "Christina.Holt" Date: Mon, 23 Oct 2023 15:03:27 +0000 Subject: [PATCH 34/43] Addressing Gillian's comments. --- devclean.sh | 53 ++++++++++++++----- .../source/BuildingRunningTesting/RunSRW.rst | 14 ----- 2 files changed, 39 insertions(+), 28 deletions(-) diff --git a/devclean.sh b/devclean.sh index 36fbc36898..6a7b729f0b 100755 --- a/devclean.sh +++ b/devclean.sh @@ -16,12 +16,16 @@ OPTIONS removes the "build" directory, keeps the "bin", "lib" and other build artifacts intact --clean removes "bin", "build" directories, and other build artifacts (same as "-a", "--all") - --install-dir=INSTALL_DIR + --conda + removes "conda" directory and conda_loc file in SRW + --install-dir=INSTALL_DIR installation directory name (\${SRW_DIR} by default) --build-dir=BUILD_DIR main build directory, absolute path (\${SRW_DIR}/build/ by default) --bin-dir=BIN_DIR binary directory name ("exec" by default); full path is \${INSTALL_DIR}/\${BIN_DIR}) + --conda-dir=CONDA_DIR + directory where conda is installed. caution: if outside the SRW clone, it may have broader use --sub-modules remove sub-module directories. They will need to be checked out again by sourcing "\${SRW_DIR}/manage_externals/checkout_externals" before attempting subsequent builds -v, --verbose @@ -38,6 +42,7 @@ Settings: INSTALL_DIR=${INSTALL_DIR} BUILD_DIR=${BUILD_DIR} BIN_DIR=${BIN_DIR} + CONDA_DIR=${CONDA_DIR} REMOVE=${REMOVE} VERBOSE=${VERBOSE} @@ -61,6 +66,7 @@ SRW_DIR=$(cd "$(dirname "$(readlink -f -n "${BASH_SOURCE[0]}" )" )" && pwd -P) INSTALL_DIR=${INSTALL_DIR:-${SRW_DIR}} BUILD_DIR=${BUILD_DIR:-"${SRW_DIR}/build"} BIN_DIR="exec" +CONDA_DIR=${CONDA_DIR:-"${SRW_DIR}/conda"} REMOVE=false VERBOSE=false @@ -82,12 +88,15 @@ while :; do --remove) REMOVE=true ;; --remove=?*|--remove=) usage_error "$1 argument ignored." ;; --clean) CLEAN=true ;; + --conda) REMOVE_CONDA=true ;; --install-dir=?*) INSTALL_DIR=${1#*=} ;; --install-dir|--install-dir=) usage_error "$1 requires argument." ;; --build-dir=?*) BUILD_DIR=${1#*=} ;; --build-dir|--build-dir=) usage_error "$1 requires argument." ;; --bin-dir=?*) BIN_DIR=${1#*=} ;; --bin-dir|--bin-dir=) usage_error "$1 requires argument." ;; + --conda-dir=?*) CONDA_DIR=${1#*=} ;; + --conda-dir|--conda-dir=) usage_error "$1 requires argument." ;; --sub-modules) INCLUDE_SUB_MODULES=true ;; --verbose|-v) VERBOSE=true ;; --verbose=?*|--verbose=) usage_error "$1 argument ignored." ;; @@ -117,32 +126,48 @@ if [ "${REMOVE}" = true ] && [ "${CLEAN}" = false ] ; then elif [ "${CLEAN}" = true ]; then printf '%s\n' "Remove build directory, bin directory, and other build artifacts " printf '%s\n' " from the installation directory = ${INSTALL_DIR} " - [[ -d "${BUILD_DIR}" ]] && rm -rf ${BUILD_DIR} && printf '%s\n' "rm -rf ${BUILD_DIR}" - [[ -d "${INSTALL_DIR}/${BIN_DIR}" ]] && ( rm -rf ${INSTALL_DIR}/${BIN_DIR} && printf '%s\n' "rm -rf ${INSTALL_DIR}/${BIN_DIR}" ) - [[ -d "${SRW_DIR}/${BIN_DIR}" ]] && ( rm -rf ${SRW_DIR}/${BIN_DIR} && printf '%s\n' "rm -rf ${SRW_DIR}/${BIN_DIR}" ) - [[ -d "${INSTALL_DIR}/share" ]] && ( rm -rf ${INSTALL_DIR}/share && printf '%s\n' "rm -rf ${INSTALL_DIR}/share" ) - [[ -d "${INSTALL_DIR}/include" ]] && ( rm -rf ${INSTALL_DIR}/include && printf '%s\n' "rm -rf ${INSTALL_DIR}/include" ) - [[ -d "${INSTALL_DIR}/lib" ]] && rm -rf ${INSTALL_DIR}/lib && printf '%s\n' "rm -rf ${INSTALL_DIR}/lib" - [[ -d "${INSTALL_DIR}/lib64" ]] && rm -rf ${INSTALL_DIR}/lib && printf '%s\n' "rm -rf ${INSTALL_DIR}/lib64" - [[ -d "${SRW_DIR}/manage_externals/manic" ]] && rm -f ${SRW_DIR}/manage_externals/manic/*.pyc && printf '%s\n' "rm -f ${SRW_DIR}/manage_externals/manic/*.pyc" + + directories=( \ + "${BUILD_DIR}" \ + "${INSTALL_DIR}/${BIN_DIR}" \ + "${INSTALL_DIR}/share" \ + "${INSTALL_DIR}/include" \ + "${INSTALL_DIR}/lib" \ + "${INSTALL_DIR}/lib64" \ + "${SRW_DIR}/manage_externals/manic" \ + ) + for directory in $directories; do + [[ -d directory ]] && rm -rf $directory && print '%s\n' "rm -rf $directory" + done echo " " fi -# Clean all the submodules if requested. NB: Need to check out them again before attempting subsequent builds, by sourcing ${SRW_DIR}/manage_externals/checkout_externals +# Clean all the submodules if requested. Note: Need to check out them again before attempting subsequent builds, by sourcing ${SRW_DIR}/manage_externals/checkout_externals if [ ${INCLUDE_SUB_MODULES} == true ]; then printf '%s\n' "Removing submodules ..." declare -a submodules='()' submodules=(${SRW_DIR}/sorc/*) -# echo " submodules are: ${submodules[@]} (total of ${#submodules[@]}) " +# echo " submodules are: ${submodules[@]} (total of ${#submodules[@]}) " if [ ${#submodules[@]} -ge 1 ]; then for sub in ${submodules[@]}; do [[ -d "${sub}" ]] && ( rm -rf ${sub} && printf '%s\n' "rm -rf ${sub}" ); done fi - printf '%s\n' "NB: Need to check out submodules again for any subsequent builds, " \ + printf '%s\n' "Note: Need to check out submodules again for any subsequent builds, " \ " by sourcing ${SRW_DIR}/manage_externals/checkout_externals " fi # -echo " " + +# Clean conda if requested +if [ ${REMOVE_CONDA} == true ] ; then + printf '%s\n' "Removing conda location file" + rm -rf ${SRW_DIR}/conda_loc + printf '%s\n' "Removing conda installation" + rm -rf ${CONDA_DIR} +fi + + + +echo " " echo "All the requested cleaning tasks have been completed" -echo " " +echo " " exit 0 diff --git a/docs/UsersGuide/source/BuildingRunningTesting/RunSRW.rst b/docs/UsersGuide/source/BuildingRunningTesting/RunSRW.rst index 4c92779f0b..4368dbcca1 100644 --- a/docs/UsersGuide/source/BuildingRunningTesting/RunSRW.rst +++ b/docs/UsersGuide/source/BuildingRunningTesting/RunSRW.rst @@ -117,20 +117,6 @@ to install the latest version of miniforge and automatically create the environm Managed environments will no longer be updated on Tier I platforms for newer versions of SRW. -Installing miniconda and creating environments -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -In addition to building the SRW App components, the ``devbuild.sh`` script will install miniconda, -specifically miniforge, and install the SRW-required environments if the ``conda`` target is -provided. For example, the following command will build all the default SRW components on the hera -platform using the Intel compiler, and will also install conda and environments: - -.. code-block:: console - - ./devbuild.sh --platform=hera --compiler=intel default - - - .. _Load-WF-L1: Loading the Workflow Environment From 579c2e3647825fee62ee7e18b3835496f3acce7f Mon Sep 17 00:00:00 2001 From: Christina Holt <56881914+christinaholtNOAA@users.noreply.github.com> Date: Mon, 30 Oct 2023 14:04:02 -0600 Subject: [PATCH 35/43] Update tests/README.md Co-authored-by: Michael Lueken <63728921+MichaelLueken@users.noreply.github.com> --- tests/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/README.md b/tests/README.md index b9b9b2c0f3..2f1613254a 100644 --- a/tests/README.md +++ b/tests/README.md @@ -47,7 +47,7 @@ The unit tests in the test_python/ directory test various parts of the workflow ### Set PYTHONPATH First, you will need to set the PYTHONPATH environment variable to include the ush/ directory and -the a few of the workflow-toools subdirectories. From the top level of the ufs-srweather-app clone +a few of the workflow-tools subdirectories. From the top level of the ufs-srweather-app clone run the following command: ``` From e4e9a27a5a85736a906cd0c8f67f11b8f9d1e9f1 Mon Sep 17 00:00:00 2001 From: Christina Holt <56881914+christinaholtNOAA@users.noreply.github.com> Date: Mon, 30 Oct 2023 14:04:35 -0600 Subject: [PATCH 36/43] Update docs/UsersGuide/source/BuildingRunningTesting/BuildSRW.rst Co-authored-by: Michael Lueken <63728921+MichaelLueken@users.noreply.github.com> --- docs/UsersGuide/source/BuildingRunningTesting/BuildSRW.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/UsersGuide/source/BuildingRunningTesting/BuildSRW.rst b/docs/UsersGuide/source/BuildingRunningTesting/BuildSRW.rst index ccaa2fa6cb..1828341e06 100644 --- a/docs/UsersGuide/source/BuildingRunningTesting/BuildSRW.rst +++ b/docs/UsersGuide/source/BuildingRunningTesting/BuildSRW.rst @@ -200,7 +200,7 @@ On Level 1 systems for which a modulefile is provided under the ``modulefiles`` where ```` is replaced with the name of the platform the user is working on. Valid values include: ``cheyenne`` | ``gaea`` | ``hera`` | ``jet`` | ``linux`` | ``macos`` | ``noaacloud`` | ``orion`` -Starting with SRW v2.2.0 will install miniconda and SRW environments as part +Directly following the release of SRW v2.2.0, the App will install miniconda and SRW environments as part of the build process. The location defaults to inside the SRW clone in ``ufs-srweather-app/conda``, however users can set any path on their system using the ``--conda-dir`` flag. If conda is already installed in that location, conda installation will be skipped. The following example uses a From 47860e50a658177957136bda25cc4d6fa50736bd Mon Sep 17 00:00:00 2001 From: "Christina.Holt" Date: Mon, 20 Nov 2023 13:39:02 +0000 Subject: [PATCH 37/43] Adding AQM to the supported environments --- devbuild.sh | 44 ++++++++++++------- modulefiles/{tasks/hera => }/python_srw.lua | 3 ++ modulefiles/python_srw_cmaq.lua | 2 + modulefiles/tasks/cheyenne/aqm_ics.local.lua | 2 +- modulefiles/tasks/cheyenne/aqm_lbcs.local.lua | 2 +- .../tasks/cheyenne/fire_emission.local.lua | 2 +- .../miniconda_regional_workflow_cmaq.lua | 6 --- .../tasks/cheyenne/nexus_emission.local.lua | 2 +- .../tasks/cheyenne/nexus_gfs_sfc.local.lua | 2 +- .../tasks/cheyenne/nexus_post_split.local.lua | 2 +- .../tasks/cheyenne/point_source.local.lua | 2 +- .../tasks/cheyenne/pre_post_stat.local.lua | 2 +- modulefiles/tasks/derecho/aqm_ics.local.lua | 2 +- modulefiles/tasks/derecho/aqm_lbcs.local.lua | 2 +- .../tasks/derecho/fire_emission.local.lua | 2 +- .../miniconda_regional_workflow_cmaq.lua | 6 --- .../tasks/derecho/nexus_emission.local.lua | 2 +- .../tasks/derecho/nexus_gfs_sfc.local.lua | 2 +- .../tasks/derecho/nexus_post_split.local.lua | 2 +- .../tasks/derecho/point_source.local.lua | 2 +- .../tasks/derecho/pre_post_stat.local.lua | 2 +- modulefiles/tasks/hera/aqm_ics.local.lua | 2 +- .../tasks/hera/fire_emission.local.lua | 2 +- .../hera/miniconda_regional_workflow_cmaq.lua | 4 -- .../tasks/hera/nexus_emission.local.lua | 2 +- .../tasks/hera/nexus_post_split.local.lua | 2 +- modulefiles/tasks/hera/point_source.local.lua | 2 +- modulefiles/tasks/hercules/aqm_ics.local.lua | 2 +- .../tasks/hercules/fire_emission.local.lua | 2 +- .../miniconda_regional_workflow_cmaq.lua | 4 -- .../tasks/hercules/nexus_emission.local.lua | 2 +- .../tasks/hercules/nexus_post_split.local.lua | 2 +- .../tasks/hercules/point_source.local.lua | 2 +- modulefiles/tasks/orion/aqm_ics.local.lua | 2 +- .../tasks/orion/fire_emission.local.lua | 2 +- .../miniconda_regional_workflow_cmaq.lua | 4 -- .../tasks/orion/nexus_emission.local.lua | 2 +- .../tasks/orion/nexus_post_split.local.lua | 2 +- .../tasks/orion/point_source.local.lua | 2 +- 39 files changed, 63 insertions(+), 72 deletions(-) rename modulefiles/{tasks/hera => }/python_srw.lua (52%) create mode 100644 modulefiles/python_srw_cmaq.lua delete mode 100644 modulefiles/tasks/cheyenne/miniconda_regional_workflow_cmaq.lua delete mode 100644 modulefiles/tasks/derecho/miniconda_regional_workflow_cmaq.lua delete mode 100644 modulefiles/tasks/hera/miniconda_regional_workflow_cmaq.lua delete mode 100644 modulefiles/tasks/hercules/miniconda_regional_workflow_cmaq.lua delete mode 100644 modulefiles/tasks/orion/miniconda_regional_workflow_cmaq.lua diff --git a/devbuild.sh b/devbuild.sh index e0a421838c..ea88c5ce9e 100755 --- a/devbuild.sh +++ b/devbuild.sh @@ -192,6 +192,27 @@ while :; do shift done +# Ensure uppercase / lowercase ============================================ +APPLICATION=$(echo ${APPLICATION} | tr '[a-z]' '[A-Z]') +PLATFORM=$(echo ${PLATFORM} | tr '[A-Z]' '[a-z]') +COMPILER=$(echo ${COMPILER} | tr '[A-Z]' '[a-z]') + +# check if PLATFORM is set +if [ -z $PLATFORM ] ; then + printf "\nERROR: Please set PLATFORM.\n\n" + usage + exit 0 +fi +# set PLATFORM (MACHINE) +MACHINE="${PLATFORM}" +printf "PLATFORM(MACHINE)=${PLATFORM}\n" >&2 + + +# Conda is not used on WCOSS2 +if [ "${PLATFORM}" = "wcoss2" ]; then + BUILD_CONDA="off" +fi + # build conda and conda environments, if requested. if [ "${BUILD_CONDA}" = "on" ] ; then if [ ! -d "${CONDA_BUILD_DIR}" ] ; then @@ -216,6 +237,12 @@ if [ "${BUILD_CONDA}" = "on" ] ; then if ! conda env list | grep -q "^srw_graphics\s" ; then mamba env create -n srw_graphics --file graphics_environment.yml fi + if [ "${APPLICATION}" = "ATMAQ" ]; then + if ! conda env list | grep -q "^srw_graphics\s" ; then + mamba env create -n srw_aqm --file aqm_environment.yml + fi + fi + else source ${CONDA_BUILD_DIR}/etc/profile.d/conda.sh conda activate @@ -229,21 +256,6 @@ INSTALL_DIR=${INSTALL_DIR:-$SRW_DIR} CONDA_BUILD_DIR="$(readlink -f "${CONDA_BUILD_DIR}")" echo ${CONDA_BUILD_DIR} > ${SRW_DIR}/conda_loc -# Ensure uppercase / lowercase ============================================ -APPLICATION=$(echo ${APPLICATION} | tr '[a-z]' '[A-Z]') -PLATFORM=$(echo ${PLATFORM} | tr '[A-Z]' '[a-z]') -COMPILER=$(echo ${COMPILER} | tr '[A-Z]' '[a-z]') - -# check if PLATFORM is set -if [ -z $PLATFORM ] ; then - printf "\nERROR: Please set PLATFORM.\n\n" - usage - exit 0 -fi -# set PLATFORM (MACHINE) -MACHINE="${PLATFORM}" -printf "PLATFORM(MACHINE)=${PLATFORM}\n" >&2 - # choose default apps to build if [ "${DEFAULT_BUILD}" = true ]; then BUILD_UFS="on" @@ -256,11 +268,9 @@ if [ "${APPLICATION}" = "ATMAQ" ]; then if [ "${DEFAULT_BUILD}" = true ]; then BUILD_NEXUS="on" BUILD_AQM_UTILS="on" - BUILD_CONDA="off" fi if [ "${PLATFORM}" = "wcoss2" ]; then BUILD_POST_STAT="on" - BUILD_CONDA="off" else BUILD_POST_STAT="off" fi diff --git a/modulefiles/tasks/hera/python_srw.lua b/modulefiles/python_srw.lua similarity index 52% rename from modulefiles/tasks/hera/python_srw.lua rename to modulefiles/python_srw.lua index a2dd45084c..b4621c5480 100644 --- a/modulefiles/tasks/hera/python_srw.lua +++ b/modulefiles/python_srw.lua @@ -1,2 +1,5 @@ +unload("python") +unload("miniconda3") + load("conda") setenv("SRW_ENV", "srw_app") diff --git a/modulefiles/python_srw_cmaq.lua b/modulefiles/python_srw_cmaq.lua new file mode 100644 index 0000000000..49bbdfa46e --- /dev/null +++ b/modulefiles/python_srw_cmaq.lua @@ -0,0 +1,2 @@ +load("conda") +setenv("SRW_ENV", "srw_aqm") diff --git a/modulefiles/tasks/cheyenne/aqm_ics.local.lua b/modulefiles/tasks/cheyenne/aqm_ics.local.lua index de700dbbc6..1040aab9a6 100644 --- a/modulefiles/tasks/cheyenne/aqm_ics.local.lua +++ b/modulefiles/tasks/cheyenne/aqm_ics.local.lua @@ -1,3 +1,3 @@ load(pathJoin("cmake", os.getenv("cmake_ver") or "3.22.0")) load("nco/4.9.5") -load("miniconda_regional_workflow_cmaq") +load("python_srw_cmaq") diff --git a/modulefiles/tasks/cheyenne/aqm_lbcs.local.lua b/modulefiles/tasks/cheyenne/aqm_lbcs.local.lua index de700dbbc6..1040aab9a6 100644 --- a/modulefiles/tasks/cheyenne/aqm_lbcs.local.lua +++ b/modulefiles/tasks/cheyenne/aqm_lbcs.local.lua @@ -1,3 +1,3 @@ load(pathJoin("cmake", os.getenv("cmake_ver") or "3.22.0")) load("nco/4.9.5") -load("miniconda_regional_workflow_cmaq") +load("python_srw_cmaq") diff --git a/modulefiles/tasks/cheyenne/fire_emission.local.lua b/modulefiles/tasks/cheyenne/fire_emission.local.lua index f8a53ee074..b62670156f 100644 --- a/modulefiles/tasks/cheyenne/fire_emission.local.lua +++ b/modulefiles/tasks/cheyenne/fire_emission.local.lua @@ -1,2 +1,2 @@ load("ncarenv") -load("miniconda_regional_workflow_cmaq") +load("python_srw_cmaq") diff --git a/modulefiles/tasks/cheyenne/miniconda_regional_workflow_cmaq.lua b/modulefiles/tasks/cheyenne/miniconda_regional_workflow_cmaq.lua deleted file mode 100644 index f0852058eb..0000000000 --- a/modulefiles/tasks/cheyenne/miniconda_regional_workflow_cmaq.lua +++ /dev/null @@ -1,6 +0,0 @@ -unload("python") -load("conda") -prepend_path("MODULEPATH","/glade/work/epicufsrt/contrib/miniconda3/modulefiles") -load(pathJoin("miniconda3", os.getenv("miniconda3_ver") or "4.12.0")) - -setenv("SRW_ENV", "regional_workflow_cmaq") diff --git a/modulefiles/tasks/cheyenne/nexus_emission.local.lua b/modulefiles/tasks/cheyenne/nexus_emission.local.lua index b7fc0590e9..c46ead59a9 100644 --- a/modulefiles/tasks/cheyenne/nexus_emission.local.lua +++ b/modulefiles/tasks/cheyenne/nexus_emission.local.lua @@ -2,4 +2,4 @@ load("nco/4.9.5") load("mpt/2.25") load("ncarenv") -load("miniconda_regional_workflow_cmaq") +load("python_srw_cmaq") diff --git a/modulefiles/tasks/cheyenne/nexus_gfs_sfc.local.lua b/modulefiles/tasks/cheyenne/nexus_gfs_sfc.local.lua index f8a53ee074..b62670156f 100644 --- a/modulefiles/tasks/cheyenne/nexus_gfs_sfc.local.lua +++ b/modulefiles/tasks/cheyenne/nexus_gfs_sfc.local.lua @@ -1,2 +1,2 @@ load("ncarenv") -load("miniconda_regional_workflow_cmaq") +load("python_srw_cmaq") diff --git a/modulefiles/tasks/cheyenne/nexus_post_split.local.lua b/modulefiles/tasks/cheyenne/nexus_post_split.local.lua index 16805914aa..c957eff552 100644 --- a/modulefiles/tasks/cheyenne/nexus_post_split.local.lua +++ b/modulefiles/tasks/cheyenne/nexus_post_split.local.lua @@ -1,3 +1,3 @@ load(pathJoin("nco", os.getenv("nco_ver") or "4.9.5")) load("ncarenv") -load("miniconda_regional_workflow_cmaq") +load("python_srw_cmaq") diff --git a/modulefiles/tasks/cheyenne/point_source.local.lua b/modulefiles/tasks/cheyenne/point_source.local.lua index f8a53ee074..b62670156f 100644 --- a/modulefiles/tasks/cheyenne/point_source.local.lua +++ b/modulefiles/tasks/cheyenne/point_source.local.lua @@ -1,2 +1,2 @@ load("ncarenv") -load("miniconda_regional_workflow_cmaq") +load("python_srw_cmaq") diff --git a/modulefiles/tasks/cheyenne/pre_post_stat.local.lua b/modulefiles/tasks/cheyenne/pre_post_stat.local.lua index 262919b475..7dcdc5969b 100644 --- a/modulefiles/tasks/cheyenne/pre_post_stat.local.lua +++ b/modulefiles/tasks/cheyenne/pre_post_stat.local.lua @@ -1,2 +1,2 @@ load("nco/4.9.5") -load("miniconda_regional_workflow_cmaq") +load("python_srw_cmaq") diff --git a/modulefiles/tasks/derecho/aqm_ics.local.lua b/modulefiles/tasks/derecho/aqm_ics.local.lua index de700dbbc6..1040aab9a6 100644 --- a/modulefiles/tasks/derecho/aqm_ics.local.lua +++ b/modulefiles/tasks/derecho/aqm_ics.local.lua @@ -1,3 +1,3 @@ load(pathJoin("cmake", os.getenv("cmake_ver") or "3.22.0")) load("nco/4.9.5") -load("miniconda_regional_workflow_cmaq") +load("python_srw_cmaq") diff --git a/modulefiles/tasks/derecho/aqm_lbcs.local.lua b/modulefiles/tasks/derecho/aqm_lbcs.local.lua index de700dbbc6..1040aab9a6 100644 --- a/modulefiles/tasks/derecho/aqm_lbcs.local.lua +++ b/modulefiles/tasks/derecho/aqm_lbcs.local.lua @@ -1,3 +1,3 @@ load(pathJoin("cmake", os.getenv("cmake_ver") or "3.22.0")) load("nco/4.9.5") -load("miniconda_regional_workflow_cmaq") +load("python_srw_cmaq") diff --git a/modulefiles/tasks/derecho/fire_emission.local.lua b/modulefiles/tasks/derecho/fire_emission.local.lua index f8a53ee074..b62670156f 100644 --- a/modulefiles/tasks/derecho/fire_emission.local.lua +++ b/modulefiles/tasks/derecho/fire_emission.local.lua @@ -1,2 +1,2 @@ load("ncarenv") -load("miniconda_regional_workflow_cmaq") +load("python_srw_cmaq") diff --git a/modulefiles/tasks/derecho/miniconda_regional_workflow_cmaq.lua b/modulefiles/tasks/derecho/miniconda_regional_workflow_cmaq.lua deleted file mode 100644 index 1ecbec291f..0000000000 --- a/modulefiles/tasks/derecho/miniconda_regional_workflow_cmaq.lua +++ /dev/null @@ -1,6 +0,0 @@ -unload("python") -load("conda") -prepend_path("MODULEPATH","/glade/work/epicufsrt/contrib/derecho/miniconda3/modulefiles") -load(pathJoin("miniconda3", os.getenv("miniconda3_ver") or "4.12.0")) - -setenv("SRW_ENV", "regional_workflow_cmaq") diff --git a/modulefiles/tasks/derecho/nexus_emission.local.lua b/modulefiles/tasks/derecho/nexus_emission.local.lua index b94435c230..09f38a17dd 100644 --- a/modulefiles/tasks/derecho/nexus_emission.local.lua +++ b/modulefiles/tasks/derecho/nexus_emission.local.lua @@ -1,4 +1,4 @@ load("nco/5.0.6") load("ncarenv") -load("miniconda_regional_workflow_cmaq") +load("python_srw_cmaq") diff --git a/modulefiles/tasks/derecho/nexus_gfs_sfc.local.lua b/modulefiles/tasks/derecho/nexus_gfs_sfc.local.lua index f8a53ee074..b62670156f 100644 --- a/modulefiles/tasks/derecho/nexus_gfs_sfc.local.lua +++ b/modulefiles/tasks/derecho/nexus_gfs_sfc.local.lua @@ -1,2 +1,2 @@ load("ncarenv") -load("miniconda_regional_workflow_cmaq") +load("python_srw_cmaq") diff --git a/modulefiles/tasks/derecho/nexus_post_split.local.lua b/modulefiles/tasks/derecho/nexus_post_split.local.lua index 8874da32a8..a03758c9c6 100644 --- a/modulefiles/tasks/derecho/nexus_post_split.local.lua +++ b/modulefiles/tasks/derecho/nexus_post_split.local.lua @@ -1,3 +1,3 @@ load(pathJoin("nco", os.getenv("nco_ver") or "5.0.6")) load("ncarenv") -load("miniconda_regional_workflow_cmaq") +load("python_srw_cmaq") diff --git a/modulefiles/tasks/derecho/point_source.local.lua b/modulefiles/tasks/derecho/point_source.local.lua index f8a53ee074..b62670156f 100644 --- a/modulefiles/tasks/derecho/point_source.local.lua +++ b/modulefiles/tasks/derecho/point_source.local.lua @@ -1,2 +1,2 @@ load("ncarenv") -load("miniconda_regional_workflow_cmaq") +load("python_srw_cmaq") diff --git a/modulefiles/tasks/derecho/pre_post_stat.local.lua b/modulefiles/tasks/derecho/pre_post_stat.local.lua index 262919b475..7dcdc5969b 100644 --- a/modulefiles/tasks/derecho/pre_post_stat.local.lua +++ b/modulefiles/tasks/derecho/pre_post_stat.local.lua @@ -1,2 +1,2 @@ load("nco/4.9.5") -load("miniconda_regional_workflow_cmaq") +load("python_srw_cmaq") diff --git a/modulefiles/tasks/hera/aqm_ics.local.lua b/modulefiles/tasks/hera/aqm_ics.local.lua index 4202cbf232..0e7132d749 100644 --- a/modulefiles/tasks/hera/aqm_ics.local.lua +++ b/modulefiles/tasks/hera/aqm_ics.local.lua @@ -1,2 +1,2 @@ -load("miniconda_regional_workflow_cmaq") +load("python_srw_cmaq") load(pathJoin("nco", os.getenv("nco_ver") or "4.9.3")) diff --git a/modulefiles/tasks/hera/fire_emission.local.lua b/modulefiles/tasks/hera/fire_emission.local.lua index ef04528a3f..8aa737aa65 100644 --- a/modulefiles/tasks/hera/fire_emission.local.lua +++ b/modulefiles/tasks/hera/fire_emission.local.lua @@ -1,3 +1,3 @@ load("hpss") -load("miniconda_regional_workflow_cmaq") +load("python_srw_cmaq") load(pathJoin("nco", os.getenv("nco_ver") or "4.9.3")) diff --git a/modulefiles/tasks/hera/miniconda_regional_workflow_cmaq.lua b/modulefiles/tasks/hera/miniconda_regional_workflow_cmaq.lua deleted file mode 100644 index c0094e0ab2..0000000000 --- a/modulefiles/tasks/hera/miniconda_regional_workflow_cmaq.lua +++ /dev/null @@ -1,4 +0,0 @@ -prepend_path("MODULEPATH","/scratch1/NCEPDEV/nems/role.epic/miniconda3/modulefiles") -load(pathJoin("miniconda3", os.getenv("miniconda3_ver") or "4.12.0")) - -setenv("SRW_ENV", "regional_workflow_cmaq") diff --git a/modulefiles/tasks/hera/nexus_emission.local.lua b/modulefiles/tasks/hera/nexus_emission.local.lua index 5a7b0cece6..c7ac9dcb90 100644 --- a/modulefiles/tasks/hera/nexus_emission.local.lua +++ b/modulefiles/tasks/hera/nexus_emission.local.lua @@ -1,2 +1,2 @@ load(pathJoin("nco", os.getenv("nco_ver") or "4.9.3")) -load("miniconda_regional_workflow_cmaq") +load("python_srw_cmaq") diff --git a/modulefiles/tasks/hera/nexus_post_split.local.lua b/modulefiles/tasks/hera/nexus_post_split.local.lua index 4202cbf232..0e7132d749 100644 --- a/modulefiles/tasks/hera/nexus_post_split.local.lua +++ b/modulefiles/tasks/hera/nexus_post_split.local.lua @@ -1,2 +1,2 @@ -load("miniconda_regional_workflow_cmaq") +load("python_srw_cmaq") load(pathJoin("nco", os.getenv("nco_ver") or "4.9.3")) diff --git a/modulefiles/tasks/hera/point_source.local.lua b/modulefiles/tasks/hera/point_source.local.lua index 07cacc8ce2..89feda226c 100644 --- a/modulefiles/tasks/hera/point_source.local.lua +++ b/modulefiles/tasks/hera/point_source.local.lua @@ -1 +1 @@ -load("miniconda_regional_workflow_cmaq") +load("python_srw_cmaq") diff --git a/modulefiles/tasks/hercules/aqm_ics.local.lua b/modulefiles/tasks/hercules/aqm_ics.local.lua index 5a7b0cece6..c7ac9dcb90 100644 --- a/modulefiles/tasks/hercules/aqm_ics.local.lua +++ b/modulefiles/tasks/hercules/aqm_ics.local.lua @@ -1,2 +1,2 @@ load(pathJoin("nco", os.getenv("nco_ver") or "4.9.3")) -load("miniconda_regional_workflow_cmaq") +load("python_srw_cmaq") diff --git a/modulefiles/tasks/hercules/fire_emission.local.lua b/modulefiles/tasks/hercules/fire_emission.local.lua index 5a7b0cece6..c7ac9dcb90 100644 --- a/modulefiles/tasks/hercules/fire_emission.local.lua +++ b/modulefiles/tasks/hercules/fire_emission.local.lua @@ -1,2 +1,2 @@ load(pathJoin("nco", os.getenv("nco_ver") or "4.9.3")) -load("miniconda_regional_workflow_cmaq") +load("python_srw_cmaq") diff --git a/modulefiles/tasks/hercules/miniconda_regional_workflow_cmaq.lua b/modulefiles/tasks/hercules/miniconda_regional_workflow_cmaq.lua deleted file mode 100644 index c785373386..0000000000 --- a/modulefiles/tasks/hercules/miniconda_regional_workflow_cmaq.lua +++ /dev/null @@ -1,4 +0,0 @@ -prepend_path("MODULEPATH","/work/noaa/epic/role-epic/contrib/hercules/miniconda3/modulefiles") -load(pathJoin("miniconda3", os.getenv("miniconda3_ver") or "4.12.0")) - -setenv("SRW_ENV", "regional_workflow_cmaq") diff --git a/modulefiles/tasks/hercules/nexus_emission.local.lua b/modulefiles/tasks/hercules/nexus_emission.local.lua index 5a7b0cece6..c7ac9dcb90 100644 --- a/modulefiles/tasks/hercules/nexus_emission.local.lua +++ b/modulefiles/tasks/hercules/nexus_emission.local.lua @@ -1,2 +1,2 @@ load(pathJoin("nco", os.getenv("nco_ver") or "4.9.3")) -load("miniconda_regional_workflow_cmaq") +load("python_srw_cmaq") diff --git a/modulefiles/tasks/hercules/nexus_post_split.local.lua b/modulefiles/tasks/hercules/nexus_post_split.local.lua index 5a7b0cece6..c7ac9dcb90 100644 --- a/modulefiles/tasks/hercules/nexus_post_split.local.lua +++ b/modulefiles/tasks/hercules/nexus_post_split.local.lua @@ -1,2 +1,2 @@ load(pathJoin("nco", os.getenv("nco_ver") or "4.9.3")) -load("miniconda_regional_workflow_cmaq") +load("python_srw_cmaq") diff --git a/modulefiles/tasks/hercules/point_source.local.lua b/modulefiles/tasks/hercules/point_source.local.lua index 07cacc8ce2..89feda226c 100644 --- a/modulefiles/tasks/hercules/point_source.local.lua +++ b/modulefiles/tasks/hercules/point_source.local.lua @@ -1 +1 @@ -load("miniconda_regional_workflow_cmaq") +load("python_srw_cmaq") diff --git a/modulefiles/tasks/orion/aqm_ics.local.lua b/modulefiles/tasks/orion/aqm_ics.local.lua index 5a7b0cece6..c7ac9dcb90 100644 --- a/modulefiles/tasks/orion/aqm_ics.local.lua +++ b/modulefiles/tasks/orion/aqm_ics.local.lua @@ -1,2 +1,2 @@ load(pathJoin("nco", os.getenv("nco_ver") or "4.9.3")) -load("miniconda_regional_workflow_cmaq") +load("python_srw_cmaq") diff --git a/modulefiles/tasks/orion/fire_emission.local.lua b/modulefiles/tasks/orion/fire_emission.local.lua index 5a7b0cece6..c7ac9dcb90 100644 --- a/modulefiles/tasks/orion/fire_emission.local.lua +++ b/modulefiles/tasks/orion/fire_emission.local.lua @@ -1,2 +1,2 @@ load(pathJoin("nco", os.getenv("nco_ver") or "4.9.3")) -load("miniconda_regional_workflow_cmaq") +load("python_srw_cmaq") diff --git a/modulefiles/tasks/orion/miniconda_regional_workflow_cmaq.lua b/modulefiles/tasks/orion/miniconda_regional_workflow_cmaq.lua deleted file mode 100644 index 890f642185..0000000000 --- a/modulefiles/tasks/orion/miniconda_regional_workflow_cmaq.lua +++ /dev/null @@ -1,4 +0,0 @@ -prepend_path("MODULEPATH","/work/noaa/epic/role-epic/contrib/orion/miniconda3/modulefiles") -load(pathJoin("miniconda3", os.getenv("miniconda3_ver") or "4.12.0")) - -setenv("SRW_ENV", "regional_workflow_cmaq") diff --git a/modulefiles/tasks/orion/nexus_emission.local.lua b/modulefiles/tasks/orion/nexus_emission.local.lua index 5a7b0cece6..c7ac9dcb90 100644 --- a/modulefiles/tasks/orion/nexus_emission.local.lua +++ b/modulefiles/tasks/orion/nexus_emission.local.lua @@ -1,2 +1,2 @@ load(pathJoin("nco", os.getenv("nco_ver") or "4.9.3")) -load("miniconda_regional_workflow_cmaq") +load("python_srw_cmaq") diff --git a/modulefiles/tasks/orion/nexus_post_split.local.lua b/modulefiles/tasks/orion/nexus_post_split.local.lua index 5a7b0cece6..c7ac9dcb90 100644 --- a/modulefiles/tasks/orion/nexus_post_split.local.lua +++ b/modulefiles/tasks/orion/nexus_post_split.local.lua @@ -1,2 +1,2 @@ load(pathJoin("nco", os.getenv("nco_ver") or "4.9.3")) -load("miniconda_regional_workflow_cmaq") +load("python_srw_cmaq") diff --git a/modulefiles/tasks/orion/point_source.local.lua b/modulefiles/tasks/orion/point_source.local.lua index 07cacc8ce2..89feda226c 100644 --- a/modulefiles/tasks/orion/point_source.local.lua +++ b/modulefiles/tasks/orion/point_source.local.lua @@ -1 +1 @@ -load("miniconda_regional_workflow_cmaq") +load("python_srw_cmaq") From 59039e86d63e000741d2ca6dafc16e8168accbec Mon Sep 17 00:00:00 2001 From: "Christina.Holt" Date: Mon, 20 Nov 2023 13:40:20 +0000 Subject: [PATCH 38/43] Adding aqm environment file. --- aqm_environment.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 aqm_environment.yml diff --git a/aqm_environment.yml b/aqm_environment.yml new file mode 100644 index 0000000000..5ae414d21e --- /dev/null +++ b/aqm_environment.yml @@ -0,0 +1,12 @@ +name: srw_aqm +channels: + - conda-forge +dependencies: + - esmpy + - netcdf4=1.6.* + - numpy=1.23.* + - pylint=2.17* + - pytest=7.2* + - scipy=1.10.* + - uwtools=1.0.0 + - xarray=2022.11.* From a358c526fa76fc87cd1fe352241740c1a8f92894 Mon Sep 17 00:00:00 2001 From: "Christina.Holt" Date: Mon, 20 Nov 2023 14:16:18 +0000 Subject: [PATCH 39/43] Fix a typo for creating environment. --- devbuild.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devbuild.sh b/devbuild.sh index ea88c5ce9e..6ec2615e23 100755 --- a/devbuild.sh +++ b/devbuild.sh @@ -238,7 +238,7 @@ if [ "${BUILD_CONDA}" = "on" ] ; then mamba env create -n srw_graphics --file graphics_environment.yml fi if [ "${APPLICATION}" = "ATMAQ" ]; then - if ! conda env list | grep -q "^srw_graphics\s" ; then + if ! conda env list | grep -q "^srw_aqm\s" ; then mamba env create -n srw_aqm --file aqm_environment.yml fi fi From fff3a25f68cdbe341a4c7c8ed0f733fb756852b6 Mon Sep 17 00:00:00 2001 From: "Christina.Holt" Date: Tue, 21 Nov 2023 18:51:25 +0000 Subject: [PATCH 40/43] Fixing python environments for AQM. --- aqm_environment.yml | 1 + devclean.sh | 7 ++++--- modulefiles/build_gaea_intel.lua | 2 -- modulefiles/build_hera_gnu.lua | 2 -- modulefiles/build_hera_intel.lua | 4 ---- modulefiles/build_hercules_intel.lua | 2 -- modulefiles/build_jet_intel.lua | 2 -- scripts/exregional_make_grid.sh | 1 + ush/load_modules_run_task.sh | 4 ++-- 9 files changed, 8 insertions(+), 17 deletions(-) diff --git a/aqm_environment.yml b/aqm_environment.yml index 5ae414d21e..03d72f6706 100644 --- a/aqm_environment.yml +++ b/aqm_environment.yml @@ -1,6 +1,7 @@ name: srw_aqm channels: - conda-forge + - ufs-community dependencies: - esmpy - netcdf4=1.6.* diff --git a/devclean.sh b/devclean.sh index 6a7b729f0b..8d13b0f061 100755 --- a/devclean.sh +++ b/devclean.sh @@ -80,6 +80,7 @@ if [[ ("$1" == "--help") || ("$1" == "-h") ]]; then usage exit 0 fi + # process optional arguments while :; do case $1 in @@ -104,7 +105,7 @@ while :; do default) ALL_CLEAN=false ;; # unknown -?*|?*) usage_error "Unknown option $1" ;; - *) usage; break ;; + *) break ;; esac shift done @@ -137,7 +138,7 @@ elif [ "${CLEAN}" = true ]; then "${SRW_DIR}/manage_externals/manic" \ ) for directory in $directories; do - [[ -d directory ]] && rm -rf $directory && print '%s\n' "rm -rf $directory" + [[ -d $directory ]] && rm -rfv $directory done echo " " fi @@ -156,7 +157,7 @@ fi # # Clean conda if requested -if [ ${REMOVE_CONDA} == true ] ; then +if [ "${REMOVE_CONDA}" = true ] ; then printf '%s\n' "Removing conda location file" rm -rf ${SRW_DIR}/conda_loc printf '%s\n' "Removing conda installation" diff --git a/modulefiles/build_gaea_intel.lua b/modulefiles/build_gaea_intel.lua index df93eb2f17..d9d1a007d5 100644 --- a/modulefiles/build_gaea_intel.lua +++ b/modulefiles/build_gaea_intel.lua @@ -15,11 +15,9 @@ prepend_path("MODULEPATH", "/lustre/f2/pdata/esrl/gsd/spack-stack/modulefiles") load("stack-intel/2022.0.2") load("stack-cray-mpich/7.7.20") -load("stack-python/3.9.12") load("cmake/3.23.1") load("srw_common") -load("ufs-pyenv") -- Need at runtime load("alps") diff --git a/modulefiles/build_hera_gnu.lua b/modulefiles/build_hera_gnu.lua index 578ed64cbb..d4a67e44b2 100644 --- a/modulefiles/build_hera_gnu.lua +++ b/modulefiles/build_hera_gnu.lua @@ -10,7 +10,6 @@ prepend_path("MODULEPATH", "/scratch1/NCEPDEV/jcsda/jedipara/spack-stack/modulef load("stack-gcc/9.2.0") load("stack-openmpi/4.1.5") -load("stack-python/3.9.12") load("cmake/3.23.1") load("srw_common") @@ -18,7 +17,6 @@ load("srw_common") load(pathJoin("nccmp", os.getenv("nccmp_ver") or "1.9.0.1")) load(pathJoin("nco", os.getenv("nco_ver") or "5.0.6")) load(pathJoin("openblas", os.getenv("openblas_ver") or "0.3.19")) -load("ufs-pyenv") setenv("CMAKE_C_COMPILER","mpicc") setenv("CMAKE_CXX_COMPILER","mpicxx") diff --git a/modulefiles/build_hera_intel.lua b/modulefiles/build_hera_intel.lua index f04f4d4df1..df19b0a583 100644 --- a/modulefiles/build_hera_intel.lua +++ b/modulefiles/build_hera_intel.lua @@ -17,9 +17,6 @@ load(pathJoin("stack-intel", stack_intel_ver)) stack_impi_ver=os.getenv("stack_impi_ver") or "2021.5.1" load(pathJoin("stack-intel-oneapi-mpi", stack_impi_ver)) -stack_python_ver=os.getenv("stack_python_ver") or "3.9.12" -load(pathJoin("stack-python", stack_python_ver)) - cmake_ver=os.getenv("cmake_ver") or "3.20.1" load(pathJoin("cmake", cmake_ver)) @@ -27,7 +24,6 @@ load("srw_common") load(pathJoin("nccmp", os.getenv("nccmp_ver") or "1.9.0.1")) load(pathJoin("nco", os.getenv("nco_ver") or "4.9.3")) -load("ufs-pyenv") setenv("CMAKE_C_COMPILER","mpiicc") setenv("CMAKE_CXX_COMPILER","mpiicpc") diff --git a/modulefiles/build_hercules_intel.lua b/modulefiles/build_hercules_intel.lua index 1772460542..3ca93978eb 100644 --- a/modulefiles/build_hercules_intel.lua +++ b/modulefiles/build_hercules_intel.lua @@ -10,14 +10,12 @@ prepend_path("MODULEPATH", "/work/noaa/da/role-da/spack-stack/modulefiles") load("stack-intel/2021.7.1") load("stack-intel-oneapi-mpi/2021.7.1") -load("stack-python/3.9.14") load("cmake/3.26.3") load("srw_common") load("nccmp/1.9.0.1") load("nco/5.0.6") -load("ufs-pyenv") setenv("CFLAGS","-diag-disable=10441") setenv("FFLAGS","-diag-disable=10441") diff --git a/modulefiles/build_jet_intel.lua b/modulefiles/build_jet_intel.lua index fd19234474..9e26cb0489 100644 --- a/modulefiles/build_jet_intel.lua +++ b/modulefiles/build_jet_intel.lua @@ -10,7 +10,6 @@ prepend_path("MODULEPATH", "/lfs4/HFIP/hfv3gfs/spack-stack/modulefiles") load("stack-intel/2021.5.0") load("stack-intel-oneapi-mpi/2021.5.1") -load("stack-python/3.9.12") load("cmake/3.23.1") load("srw_common") @@ -18,7 +17,6 @@ load("srw_common") load("prod-util/1.2.2") load("nccmp/1.9.0.1") load("nco/5.0.6") -load("ufs-pyenv") setenv("CMAKE_C_COMPILER","mpiicc") setenv("CMAKE_CXX_COMPILER","mpiicpc") diff --git a/scripts/exregional_make_grid.sh b/scripts/exregional_make_grid.sh index 88472a8343..19c82ac92b 100755 --- a/scripts/exregional_make_grid.sh +++ b/scripts/exregional_make_grid.sh @@ -278,6 +278,7 @@ generation executable (exec_fp): # # Call the python script to create the namelist file. # +echo PYTHON: $(which python) ${USHdir}/set_namelist.py -q -u "$settings" -o ${rgnl_grid_nml_fp} || \ print_err_msg_exit "\ Call to python script set_namelist.py to set the variables in the diff --git a/ush/load_modules_run_task.sh b/ush/load_modules_run_task.sh index 24c8de80c3..8765c3f698 100755 --- a/ush/load_modules_run_task.sh +++ b/ush/load_modules_run_task.sh @@ -172,11 +172,11 @@ specified task (task_name) failed: task_name = \"${task_name}\" modulefile_local = \"${modulefile_local}\" modules_dir = \"${modules_dir}\"" -elif [ -f ${modules_dir}/python_srw.lua ] ; then +elif [ -f ${default_modules_dir}/python_srw.lua ] ; then module load python_srw || print_err_msg_exit "\ Loading SRW common python module failed. Expected python_srw.lua in the modules directory here: - modules_dir = \"${modules_dir}\"" + modules_dir = \"${default_modules_dir}\"" fi module list From 387373e85b5fea32760138835b8bf109c158f81e Mon Sep 17 00:00:00 2001 From: "Christina.Holt" Date: Mon, 27 Nov 2023 14:51:52 +0000 Subject: [PATCH 41/43] Address review comments. --- modulefiles/tasks/orion/run_vx.local.lua | 2 ++ scripts/exregional_make_grid.sh | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/modulefiles/tasks/orion/run_vx.local.lua b/modulefiles/tasks/orion/run_vx.local.lua index 62646d0992..850f296af2 100644 --- a/modulefiles/tasks/orion/run_vx.local.lua +++ b/modulefiles/tasks/orion/run_vx.local.lua @@ -18,8 +18,10 @@ setenv("METPLUS_VERSION", metplus_ver) setenv("METPLUS_ROOT", base_metplus) setenv("METPLUS_PATH", base_metplus) + if (mode() == "unload") then unload(pathJoin("met", met_ver)) unload(pathJoin("metplus",metplus_ver)) end +load("stack-python/3.9.7") load("python_srw") diff --git a/scripts/exregional_make_grid.sh b/scripts/exregional_make_grid.sh index 19c82ac92b..88472a8343 100755 --- a/scripts/exregional_make_grid.sh +++ b/scripts/exregional_make_grid.sh @@ -278,7 +278,6 @@ generation executable (exec_fp): # # Call the python script to create the namelist file. # -echo PYTHON: $(which python) ${USHdir}/set_namelist.py -q -u "$settings" -o ${rgnl_grid_nml_fp} || \ print_err_msg_exit "\ Call to python script set_namelist.py to set the variables in the From 1e3a8f9b58e77f0c8f1216d957ff3bec01cb34ca Mon Sep 17 00:00:00 2001 From: "Christina.Holt" Date: Mon, 27 Nov 2023 17:32:57 +0000 Subject: [PATCH 42/43] Changes for Jenkins pipeline failures. --- .cicd/Jenkinsfile | 20 ++++++++++---------- .cicd/scripts/srw_ftest.sh | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.cicd/Jenkinsfile b/.cicd/Jenkinsfile index 6e453f6f25..6629e60d4f 100644 --- a/.cicd/Jenkinsfile +++ b/.cicd/Jenkinsfile @@ -137,16 +137,6 @@ pipeline { } } - // Run the unittest functional tests that require an HPC platform - stage('Functional UnitTests') { - steps { - dir ("${env.SRW_PLATFORM}") { - echo "Running unittest on retrieve_data.py" - sh 'bash --login "${WORKSPACE}/${SRW_PLATFORM}/.cicd/scripts/srw_unittest.sh"' - } - } - } - // Run the unified build script; if successful create a tarball of the build and upload to S3 stage('Build') { steps { @@ -164,6 +154,16 @@ pipeline { } } + // Run the unittest functional tests that require an HPC platform + stage('Functional UnitTests') { + steps { + dir ("${env.SRW_PLATFORM}") { + echo "Running unittest on retrieve_data.py" + sh 'bash --login "${WORKSPACE}/${SRW_PLATFORM}/.cicd/scripts/srw_unittest.sh"' + } + } + } + // Try a few Workflow Task scripts to make sure E2E tests can be launched in a follow-on 'Test' stage stage('Functional WorkflowTaskTests') { steps { diff --git a/.cicd/scripts/srw_ftest.sh b/.cicd/scripts/srw_ftest.sh index 7a787a7137..cdbf1db2a8 100755 --- a/.cicd/scripts/srw_ftest.sh +++ b/.cicd/scripts/srw_ftest.sh @@ -85,7 +85,7 @@ module load build_${platform,,}_${SRW_COMPILER} module load wflow_${platform,,} [[ ${FORGIVE_CONDA} == true ]] && set +e +u # Some platforms have incomplete python3 or conda support, but wouldn't necessarily block workflow tests -conda activate workflow_tools +conda activate srw_app set -e -u export PYTHONPATH=${workspace}/ush/python_utils/workflow-tools:${workspace}/ush/python_utils/workflow-tools/src From e9b6318a9ba07988f30c0179caab4f9c2e0c2ca8 Mon Sep 17 00:00:00 2001 From: "Christina.Holt" Date: Tue, 28 Nov 2023 20:51:34 +0000 Subject: [PATCH 43/43] Updating docs. --- docs/UsersGuide/source/BackgroundInfo/TechnicalOverview.rst | 4 ---- .../source/BuildingRunningTesting/ContainerQuickstart.rst | 4 ++-- docs/UsersGuide/source/BuildingRunningTesting/VXCases.rst | 4 ++-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/docs/UsersGuide/source/BackgroundInfo/TechnicalOverview.rst b/docs/UsersGuide/source/BackgroundInfo/TechnicalOverview.rst index 0c613b7058..af64357675 100644 --- a/docs/UsersGuide/source/BackgroundInfo/TechnicalOverview.rst +++ b/docs/UsersGuide/source/BackgroundInfo/TechnicalOverview.rst @@ -94,10 +94,6 @@ Optional but recommended prerequisites for all systems: * Rocoto Workflow Management System (1.3.1) * Python packages ``scipy``, ``matplotlib``, ``pygrib``, ``cartopy``, and ``pillow`` for graphics -.. note:: - The SRW build will install conda, and necessary conda environments for running the workflow and the - graphics automatically when the ``conda`` target is included at build time. - .. _SRWStructure: diff --git a/docs/UsersGuide/source/BuildingRunningTesting/ContainerQuickstart.rst b/docs/UsersGuide/source/BuildingRunningTesting/ContainerQuickstart.rst index d0e0d0507a..bcc17e73ce 100644 --- a/docs/UsersGuide/source/BuildingRunningTesting/ContainerQuickstart.rst +++ b/docs/UsersGuide/source/BuildingRunningTesting/ContainerQuickstart.rst @@ -271,9 +271,9 @@ The ``wflow_`` modulefile will then output instructions to activate th .. code-block:: console Please do the following to activate conda: - > conda activate regional_workflow + > conda activate workflow_tools -then the user should run ``conda activate regional_workflow``. This will activate the ``regional_workflow`` conda environment. The command(s) will vary from system to system, but the user should see ``(regional_workflow)`` in front of the Terminal prompt at this point. +then the user should run ``conda activate workflow_tools``. This will activate the ``workflow_tools`` conda environment. The command(s) will vary from system to system, but the user should see ``(workflow_tools)`` in front of the Terminal prompt at this point. .. _SetUpConfigFileC: diff --git a/docs/UsersGuide/source/BuildingRunningTesting/VXCases.rst b/docs/UsersGuide/source/BuildingRunningTesting/VXCases.rst index af8ace30a8..b5f77363c3 100644 --- a/docs/UsersGuide/source/BuildingRunningTesting/VXCases.rst +++ b/docs/UsersGuide/source/BuildingRunningTesting/VXCases.rst @@ -93,7 +93,7 @@ First, navigate to the ``ufs-srweather-app/ush`` directory. Then, load the workf Users running a csh/tcsh shell would run ``source /path/to/etc/lmod-setup.csh `` in place of the first command above. -After loading the workflow, users should follow the instructions printed to the console. Usually, the instructions will tell the user to run ``conda activate regional_workflow``. +After loading the workflow, users should follow the instructions printed to the console. Usually, the instructions will tell the user to run ``conda activate srw_app``. Configure the Verification Sample Case ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -189,7 +189,7 @@ If a problem occurs and a task goes DEAD, view the task log files in ``$EXPTDIR/ Generate Plots ^^^^^^^^^^^^^^^^^ -The plots are created using the graphics generation script that comes with the SRW App v2.1.0 release. Information on the plots and instructions on how to run the script can be found in :doc:`Chapter 12 ` of the v2.1.0 release documentation. If the python environment is already loaded (i.e., ``(regional_workflow)`` is visible in the command prompt), users can navigate to the directory with the plotting scripts and run ``plot_allvars.py``: +The plots are created using the graphics generation script that comes with the SRW App v2.1.0 release. Information on the plots and instructions on how to run the script can be found in :doc:`Chapter 12 ` of the v2.1.0 release documentation. If the python environment is already loaded (i.e., ``(srw_graphics)`` is visible in the command prompt), users can navigate to the directory with the plotting scripts and run ``plot_allvars.py``: .. code-block:: console