Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
islas committed Oct 16, 2024
2 parents b3eebb3 + d66e442 commit 75a6ff2
Show file tree
Hide file tree
Showing 103 changed files with 4,044 additions and 2,523 deletions.
22 changes: 22 additions & 0 deletions .ci/env/derecho.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh

echo "Setting up derecho environment"
workingDirectory=$PWD
. /etc/profile.d/z00_modules.sh
echo "Loading modules : $*"
cmd="module purge"
echo $cmd && eval "${cmd}"

# We should be handed in the modules to load
while [ $# -gt 0 ]; do
cmd="module load $1"
echo $cmd && eval "${cmd}"
shift
done

# Go back to working directory if for unknown reason HPC config changing your directory on you
if [ "$workingDirectory" != "$PWD" ]; then
echo "derecho module loading changed working directory"
echo " Moving back to $workingDirectory"
cd $workingDirectory
fi
46 changes: 46 additions & 0 deletions .ci/env/helpers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/sh

# Useful string manipulation functions, leaving in for posterity
# https://stackoverflow.com/a/8811800
# contains(string, substring)
#
# Returns 0 if the specified string contains the specified substring,
# otherwise returns 1.
contains()
{
string="$1"
substring="$2"

if [ "${string#*"$substring"}" != "$string" ]; then
echo 0 # $substring is in $string
else
echo 1 # $substring is not in $string
fi
}

setenvStr()
{
# Changing IFS produces the most consistent results
tmpIFS=$IFS
IFS=","
string="$1"
for s in $string; do
if [ ! -z $s ]; then
eval "echo export \"$s\""
eval "export \"$s\""
fi
done
IFS=$tmpIFS
}

banner()
{
lengthBanner=$1
shift
# https://www.shellscript.sh/examples/banner/
printf "#%${lengthBanner}s#\n" | tr " " "="
printf "# %-$(( ${lengthBanner} - 2 ))s #\n" "`date`"
printf "# %-$(( ${lengthBanner} - 2 ))s #\n" " "
printf "# %-$(( ${lengthBanner} - 2 ))s #\n" "$*"
printf "#%${lengthBanner}s#\n" | tr " " "="
}
16 changes: 16 additions & 0 deletions .ci/env/hostenv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

# Allow selection of hostname, and if none is provided use the current machine
# While this may seem unintuitive at first, it provides the flexibility of using
# "named" configurations without being explicitly tied to fqdn
hostname=$AS_HOST
if [ -z "$hostname" ]; then
hostname=$( python3 -c "import socket; print( socket.getfqdn() )" )
fi

if [ $( contains ${hostname} hsn.de.hpc ) -eq 0 ]; then
# Derecho HPC SuSE PBS
. .ci/env/derecho.sh
else
echo "No known environment for '${hostname}', using current"
fi
1 change: 1 addition & 0 deletions .ci/hpc-workflows
Submodule hpc-workflows added at dfc8e6
108 changes: 108 additions & 0 deletions .ci/tests/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
#!/bin/sh
help()
{
echo "./build.sh as_host workingdir [options] [-- <hostenv.sh options>]"
echo " as_host First argument must be the host configuration to use for environment loading"
echo " workingdir First argument must be the working dir to immediate cd to"
echo " -c Configuration build type, piped directly into configure"
echo " -n Configuration nesting type, piped directly into configure"
echo " -o Configuration optstring passed into configure"
echo " -b Build command passed into compile"
echo " -e environment variables in comma-delimited list, e.g. var=1,foo,bar=0"
echo " -- <hostenv.sh options> Directly pass options to hostenv.sh, equivalent to hostenv.sh <options>"
echo " -h Print this message"
echo ""
echo "If you wish to use an env var in your arg such as '-c \$SERIAL -e SERIAL=32', you must"
echo "you will need to do '-c \\\$SERIAL -e SERIAL=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:n:o:b:e:h opt; do
case $opt in
c)
configuration="$OPTARG"
;;
n)
nesting="$OPTARG"
;;
o)
configOpt="$OPTARG"
;;
b)
buildCommand="$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 "configuration=\"$configuration\""
eval "nesting=\"$nesting\""
eval "configOpt=\"$configOpt\""
eval "buildCommand=\"$buildCommand\""

./clean -a

echo "Compiling with option $configuration nesting=$nesting and additional flags '$configOpt'"
./configure $configOpt << EOF
$configuration
$nesting
EOF

if [ ! -f configure.wrf ]; then
echo "Failed to configure"
exit 1
fi

echo "./compile $buildCommand"
./compile $buildCommand

result=$?

if [ $result -ne 0 ]; then
echo "Failed to compile"
exit 1
fi

# And a *very* special check because WRF compiles the WRF way and force-ignores all make errors
# putting the onus on US to check for things
if [ ! -x ./main/wrf.exe ]; then # There's a bunch of other execs but this is the most important and
# doing more checks to accomodate just reinforces this bad design
echo "Failed to compile"
exit 1
fi

echo "TEST $(basename $0) PASS"
91 changes: 91 additions & 0 deletions .ci/wrf_compilation_tests-make.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
"submit_options" :
{
"timelimit" : "00:20:00",
"working_directory" : "..",
"arguments" :
{
"base_env_numprocs" : [ "-e", "NUM_PROCS=4" ],

".*make.*::args_nesting" : [ "-n", "1" ],
".*make.*::args_configopt" : [ "-o", "-d" ],
".*make.*::args_build_tgt" : [ "-b", "em_real -j $NUM_PROCS" ]
},
"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" ]
}
}
},

"make-gnu-serial" : { "steps" : { "build" : { "command" : ".ci/tests/build.sh", "arguments" : [ "-c", "32" ] } } },
"make-gnu-sm" : { "steps" : { "build" : { "command" : ".ci/tests/build.sh", "arguments" : [ "-c", "33" ] } } },
"make-gnu-dm" : { "steps" : { "build" : { "command" : ".ci/tests/build.sh", "arguments" : [ "-c", "34" ] } } },
"make-gnu-dm+sm" : { "steps" : { "build" : { "command" : ".ci/tests/build.sh", "arguments" : [ "-c", "35" ] } } },

"make-intel-classic-serial" : {
"submit_options" : { "hsn.de.hpc" : { "timelimit" : "00:30:00" } },
"steps" : { "build" : { "command" : ".ci/tests/build.sh", "arguments" : [ "-c", "13" ] } }
},
"make-intel-classic-sm" : {
"submit_options" : { "hsn.de.hpc" : { "timelimit" : "00:30:00" } },
"steps" : { "build" : { "command" : ".ci/tests/build.sh", "arguments" : [ "-c", "14" ] } }
},
"make-intel-classic-dm" : {
"submit_options" : { "hsn.de.hpc" : { "timelimit" : "00:30:00" } },
"steps" : { "build" : { "command" : ".ci/tests/build.sh", "arguments" : [ "-c", "15" ] } }
},
"make-intel-classic-dm+sm" : {
"submit_options" : { "hsn.de.hpc" : { "timelimit" : "00:30:00" } },
"steps" : { "build" : { "command" : ".ci/tests/build.sh", "arguments" : [ "-c", "16" ] } }
},

"make-intel-llvm-serial" : {
"submit_options" : { "hsn.de.hpc" : { "timelimit" : "00:30:00" } },
"steps" : { "build" : { "command" : ".ci/tests/build.sh", "arguments" : [ "-c", "76" ] } }
},
"make-intel-llvm-sm" : {
"submit_options" : { "hsn.de.hpc" : { "timelimit" : "00:30:00" } },
"steps" : { "build" : { "command" : ".ci/tests/build.sh", "arguments" : [ "-c", "77" ] } }
},
"make-intel-llvm-dm" : {
"submit_options" : { "hsn.de.hpc" : { "timelimit" : "00:30:00" } },
"steps" : { "build" : { "command" : ".ci/tests/build.sh", "arguments" : [ "-c", "78" ] } }
},
"make-intel-llvm-dm+sm" : {
"submit_options" : { "hsn.de.hpc" : { "timelimit" : "00:30:00" } },
"steps" : { "build" : { "command" : ".ci/tests/build.sh", "arguments" : [ "-c", "79" ] } }
},

"make-pgi-serial" : {
"submit_options" : { "hsn.de.hpc" : { "timelimit" : "00:30:00" } },
"steps" : { "build" : { "command" : ".ci/tests/build.sh", "arguments" : [ "-c", "1" ] } }
},
"make-pgi-sm" : {
"submit_options" : { "hsn.de.hpc" : { "timelimit" : "00:30:00" } },
"steps" : { "build" : { "command" : ".ci/tests/build.sh", "arguments" : [ "-c", "2" ] } }
},
"make-pgi-dm" : {
"submit_options" : { "hsn.de.hpc" : { "timelimit" : "00:30:00" } },
"steps" : { "build" : { "command" : ".ci/tests/build.sh", "arguments" : [ "-c", "3" ] } }
},
"make-pgi-dm+sm" : {
"submit_options" : { "hsn.de.hpc" : { "timelimit" : "00:30:00" } },
"steps" : { "build" : { "command" : ".ci/tests/build.sh", "arguments" : [ "-c", "4" ] } }
}
}
Loading

0 comments on commit 75a6ff2

Please sign in to comment.