From 73b917824f9c34c2ea9800470e086ade425e693d Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Thu, 3 Oct 2024 16:07:39 -0700 Subject: [PATCH 1/4] New cmake build tests --- .ci/tests/buildCMake.sh | 99 ++++++++++++++++++++++++++ .ci/wrf_compilation_tests-cmake.json | 101 +++++++++++++++++++++++++++ 2 files changed, 200 insertions(+) create mode 100755 .ci/tests/buildCMake.sh create mode 100644 .ci/wrf_compilation_tests-cmake.json diff --git a/.ci/tests/buildCMake.sh b/.ci/tests/buildCMake.sh new file mode 100755 index 0000000000..63d997128c --- /dev/null +++ b/.ci/tests/buildCMake.sh @@ -0,0 +1,99 @@ +#!/bin/sh +help() +{ + echo "./buildCMake.sh as_host workingdir [options] [-- ]" + echo " as_host First argument must be the host configuration to use for environment loading" + echo " workingdir Second argument must be the working dir to immediate cd to" + echo " -c Configuration build type, piped directly into configure" + echo " -b Build command passed into compile" + echo " -r Clean command passed into cleanCmake" + echo " -e environment variables in comma-delimited list, e.g. var=1,foo,bar=0" + echo " -- Directly pass options to hostenv.sh, equivalent to hostenv.sh " + echo " -h Print this message" + echo "" + echo "If you wish to use an env var in your arg such as '-c \$PRESELECT -e PRESELECT=GNU'," + echo "you will need to do '-c \\\$PRESELECT -e PRESELECT=32' to delay shell expansion" +} + + +echo "Input arguments:" +echo "$*" + +AS_HOST=$1 +shift +if [ $AS_HOST = "-h" ]; then + help + exit 0 +fi + +workingDirectory=$1 +shift + +cd $workingDirectory + +# Get some helper functions +. .ci/env/helpers.sh + +while getopts c:b:r:e:h opt; do + case $opt in + c) + configuration="$OPTARG" + ;; + b) + buildCommand="$OPTARG" + ;; + r) + cleanCommand="$OPTARG" + ;; + e) + envVars="$envVars,$OPTARG" + ;; + h) help; exit 0 ;; + *) help; exit 1 ;; + :) help; exit 1 ;; + \?) help; exit 1 ;; + esac +done + +shift "$((OPTIND - 1))" + +# Everything else goes to our env setup +. .ci/env/hostenv.sh $* + +# Now evaluate env vars in case it pulls from hostenv.sh +if [ ! -z "$envVars" ]; then + setenvStr "$envVars" +fi + +# Re-evaluate input values for delayed expansion +eval "cleanCommand=\"$cleanCommand\"" +eval "configuration=\"$configuration\"" +eval "buildCommand=\"$buildCommand\"" + +echo "./cleanCMake.sh -a $cleanCommand" +./cleanCMake.sh -a $cleanCommand +echo "Clean done" + +echo "./configure_new $configuration" +./configure_new $configuration +result=$? +echo "Configure done" + +if [ $result -ne 0 ]; then + echo "Failed to configure, command returned non-zero exit status" + exit 1 +fi + +echo "./compile_new $buildCommand" +./compile_new $buildCommand +result=$? +echo "Compile done" + + + +if [ $result -ne 0 ]; then + echo "Failed to compile, command returned non-zero exit status" + exit 1 +fi + +echo "TEST $(basename $0) PASS" diff --git a/.ci/wrf_compilation_tests-cmake.json b/.ci/wrf_compilation_tests-cmake.json new file mode 100644 index 0000000000..569caf2358 --- /dev/null +++ b/.ci/wrf_compilation_tests-cmake.json @@ -0,0 +1,101 @@ +{ + "submit_options" : + { + "timelimit" : "00:20:00", + "working_directory" : "..", + "arguments" : + { + "base_env_numprocs" : [ "-e", "NUM_PROCS=8" ], + + ".*cmake.*::base_env_dirs" : [ "-e", "WK_DIR=$PWD,BUILD_DIR=_build_$NAME$DM$SM,INSTALL_DIR=$WK_DIR/install_$NAME$DM$SM" ], + ".*cmake.*.::args_compilecmd" : [ "-c", "-p $NAME -d $BUILD_DIR -i $INSTALL_DIR -x -- -DCMAKE_BUILD_TYPE=Release -DWRF_CORE=ARW -DWRF_NESTING=BASIC -DWRF_CASE=EM_REAL $USE_MPI $USE_OPENMP" ], + ".*cmake.*.::args_buildcmd" : [ "-b", "$BUILD_DIR -j $NUM_PROCS" ], + ".*cmake.*.::args_cleancmd" : [ "-r", "-d $BUILD_DIR -i $INSTALL_DIR" ], + + ".*cmake.*dm.*::args_config" : [ "-e", "USE_MPI=-DUSE_MPI=ON,DM=_dm" ], + ".*cmake.*sm.*::args_config" : [ "-e", "USE_OMP=-DUSE_OMP=ON,SM=_sm" ], + + ".*cmake.*gnu.*::args_name" : [ "-e", "NAME=gnu" ], + ".*cmake.*intel-classic::args_name" : [ "-e", "NAME=ifort" ], + ".*cmake.*intel-llvm.*::args_name" : [ "-e", "NAME=ifx" ], + ".*cmake.*pgi.*::args_name" : [ "-e", "NAME=pgi" ] + }, + "hsn.de.hpc" : + { + "submission" : "PBS", + "queue" : "main", + "hpc_arguments" : + { + "node_select" : { "-l " : { "select" : 1, "ncpus" : 8 } }, + "priority" : { "-l " : { "job_priority" : "economy" } } + }, + "arguments" : + { + "base_env_numprocs" : [ "-e", "NUM_PROCS=8" ], + "very_last_modules" : [ "netcdf" ], + ".*gnu.*::test_modules" : [ "gcc" ], + ".*intel-classic.*::test_modules" : [ "intel-classic" ], + ".*intel-llvm.*::test_modules" : [ "intel-oneapi" ], + ".*pgi.*::test_modules" : [ "nvhpc" ], + ".*dm.*::test_mpi_module" : [ "cray-mpich" ], + ".*cmake.*::test_cmake_module" : [ "cmake" ] + } + } + }, + + "cmake-gnu-serial" : { "steps" : { "build" : { "command" : ".ci/tests/buildCMake.sh" } } }, + "cmake-gnu-sm" : { "steps" : { "build" : { "command" : ".ci/tests/buildCMake.sh" } } }, + "cmake-gnu-dm" : { "steps" : { "build" : { "command" : ".ci/tests/buildCMake.sh" } } }, + "cmake-gnu-dm+sm" : { "steps" : { "build" : { "command" : ".ci/tests/buildCMake.sh" } } }, + + "cmake-intel-classic-serial" : { + "submit_options" : { "hsn.de.hpc" : { "timelimit" : "00:30:00" } }, + "steps" : { "build" : { "command" : ".ci/tests/buildCMake.sh" } } + }, + "cmake-intel-classic-sm" : { + "submit_options" : { "hsn.de.hpc" : { "timelimit" : "00:30:00" } }, + "steps" : { "build" : { "command" : ".ci/tests/buildCMake.sh" } } + }, + "cmake-intel-classic-dm" : { + "submit_options" : { "hsn.de.hpc" : { "timelimit" : "00:30:00" } }, + "steps" : { "build" : { "command" : ".ci/tests/buildCMake.sh" } } + }, + "cmake-intel-classic-dm+sm" : { + "submit_options" : { "hsn.de.hpc" : { "timelimit" : "00:30:00" } }, + "steps" : { "build" : { "command" : ".ci/tests/buildCMake.sh" } } + }, + + "cmake-intel-llvm-serial" : { + "submit_options" : { "hsn.de.hpc" : { "timelimit" : "00:30:00" } }, + "steps" : { "build" : { "command" : ".ci/tests/buildCMake.sh" } } + }, + "cmake-intel-llvm-sm" : { + "submit_options" : { "hsn.de.hpc" : { "timelimit" : "00:30:00" } }, + "steps" : { "build" : { "command" : ".ci/tests/buildCMake.sh" } } + }, + "cmake-intel-llvm-dm" : { + "submit_options" : { "hsn.de.hpc" : { "timelimit" : "00:30:00" } }, + "steps" : { "build" : { "command" : ".ci/tests/buildCMake.sh" } } + }, + "cmake-intel-llvm-dm+sm" : { + "submit_options" : { "hsn.de.hpc" : { "timelimit" : "00:30:00" } }, + "steps" : { "build" : { "command" : ".ci/tests/buildCMake.sh" } } + }, + + "cmake-pgi-serial" : { + "submit_options" : { "hsn.de.hpc" : { "timelimit" : "00:30:00" } }, + "steps" : { "build" : { "command" : ".ci/tests/buildCMake.sh" } } + }, + "cmake-pgi-sm" : { + "submit_options" : { "hsn.de.hpc" : { "timelimit" : "00:30:00" } }, + "steps" : { "build" : { "command" : ".ci/tests/buildCMake.sh" } } + }, + "cmake-pgi-dm" : { + "submit_options" : { "hsn.de.hpc" : { "timelimit" : "00:30:00" } }, + "steps" : { "build" : { "command" : ".ci/tests/buildCMake.sh" } } + }, + "cmake-pgi-dm+sm" : { + "submit_options" : { "hsn.de.hpc" : { "timelimit" : "00:30:00" } }, + "steps" : { "build" : { "command" : ".ci/tests/buildCMake.sh" } } + } +} From aade977e03de167b603e17d229cef3e56fca68ae Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Mon, 18 Nov 2024 15:10:34 -0700 Subject: [PATCH 2/4] Add cmake tests to ci/cd --- .github/workflows/ci.yml | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 79a88db082..f525f78203 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,7 +68,7 @@ jobs: id : make-tests fileroot : wrf_compilation_tests-make args : -j='{"node_select":{"-l ":{"select":1}}}' - pool : 8 + pool : 16 tpool : 1 mkdirs : true tests : @@ -90,6 +90,36 @@ jobs: - make-pgi-dm+sm # add new compilation tests here + - host : derecho + hpc-workflows_path : .ci/hpc-workflows + archive : /glade/work/aislas/github/runners/wrf/derecho/logs/ + account : NMMM0012 + name : "CMake Compilation Tests" + id : cmake-tests + fileroot : wrf_compilation_tests-cmake + args : -j='{"node_select":{"-l ":{"select":1}}}' + pool : 16 + tpool : 1 + mkdirs : false + tests : + - cmake-gnu-serial + - cmake-gnu-sm + - cmake-gnu-dm + - cmake-gnu-dm+sm + - cmake-intel-classic-serial + - cmake-intel-classic-sm + - cmake-intel-classic-dm + - cmake-intel-classic-dm+sm + - cmake-intel-llvm-serial + - cmake-intel-llvm-sm + - cmake-intel-llvm-dm + - cmake-intel-llvm-dm+sm + - cmake-pgi-serial + - cmake-pgi-sm + - cmake-pgi-dm + - cmake-pgi-dm+sm + # add new compilation tests here + uses : ./.github/workflows/test_workflow.yml with : # This should be the only hard-coded value, we don't use ${{ inputs.test }} From 2092103a46f5dac58480c6ff307a4329ed7d8a87 Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Mon, 28 Apr 2025 16:47:42 -0700 Subject: [PATCH 3/4] Fix intel classic builds --- .ci/wrf_compilation_tests-cmake.json | 2 +- .ci/wrf_compilation_tests-make.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/wrf_compilation_tests-cmake.json b/.ci/wrf_compilation_tests-cmake.json index 569caf2358..ba0cd0ce5c 100644 --- a/.ci/wrf_compilation_tests-cmake.json +++ b/.ci/wrf_compilation_tests-cmake.json @@ -34,7 +34,7 @@ "base_env_numprocs" : [ "-e", "NUM_PROCS=8" ], "very_last_modules" : [ "netcdf" ], ".*gnu.*::test_modules" : [ "gcc" ], - ".*intel-classic.*::test_modules" : [ "intel-classic" ], + ".*intel-classic.*::test_modules" : [ "ncarenv/23.09", "intel-classic" ], ".*intel-llvm.*::test_modules" : [ "intel-oneapi" ], ".*pgi.*::test_modules" : [ "nvhpc" ], ".*dm.*::test_mpi_module" : [ "cray-mpich" ], diff --git a/.ci/wrf_compilation_tests-make.json b/.ci/wrf_compilation_tests-make.json index e261afbf7e..bc43e48bcc 100644 --- a/.ci/wrf_compilation_tests-make.json +++ b/.ci/wrf_compilation_tests-make.json @@ -25,7 +25,7 @@ "base_env_numprocs" : [ "-e", "NUM_PROCS=8" ], "very_last_modules" : [ "netcdf" ], ".*gnu.*::test_modules" : [ "gcc" ], - ".*intel-classic.*::test_modules" : [ "intel-classic" ], + ".*intel-classic.*::test_modules" : [ "ncarenv/23.09", "intel-classic" ], ".*intel-llvm.*::test_modules" : [ "intel-oneapi" ], ".*pgi.*::test_modules" : [ "nvhpc" ], ".*dm.*::test_mpi_module" : [ "cray-mpich" ] From 493ff616bc669a2657c7bb9ae3df04b29941fbe3 Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Mon, 28 Apr 2025 16:48:50 -0700 Subject: [PATCH 4/4] Remove barely useful manage_externals check and update test as necessary The check is commented out and noted so that in the future a potentially better check may be created instead --- .github/workflows/test_workflow.yml | 11 +++++++++++ CMakeLists.txt | 13 ++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test_workflow.yml b/.github/workflows/test_workflow.yml index a4060dcb6c..8f4a534fb3 100644 --- a/.github/workflows/test_workflow.yml +++ b/.github/workflows/test_workflow.yml @@ -100,6 +100,17 @@ jobs: submodules: true ref: ${{ inputs.event_name == 'push' && github.ref || inputs.ref }} + ############################################################################ + # WRF Specific + # More checkout, just do everything so we have it all at the ready. This unfortunately will limit testing + # of on-the-fly checkouts + - name: Checkout extra via manage_externals + id : manage_externals + run : | + cd main + ./tools/manage_externals/checkout_externals -e arch/Externals.cfg + ############################################################################ + # Immediately copy out to # of tests to do - name: Create testing directories diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c365d018b..6e8b71926e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -344,11 +344,14 @@ execute_process( OUTPUT_FILE ${LOG_FILE} ERROR_FILE ${LOG_FILE} ) -if ( ${MANAGE_EXTERNALS_STATUS} AND NOT ${MANAGE_EXTERNALS_STATUS} EQUAL 0 ) - message( FATAL_ERROR "Failed to checkout external repos via manage_externals" ) -else() - message( STATUS "Finished checking out external repos via manage_externals" ) -endif() +# The manage_externals return code only informs critical failures and not whether the code +# exists or not and so this check often leads to false positives (success) when failure +# was expected +# if ( ${MANAGE_EXTERNALS_STATUS} AND NOT ${MANAGE_EXTERNALS_STATUS} EQUAL 0 ) +# message( FATAL_ERROR "Failed to checkout external repos via manage_externals" ) +# else() +# message( STATUS "Finished checking out external repos via manage_externals" ) +# endif() ################################################################################