diff --git a/modulefiles/ufs_container.intel.lua b/modulefiles/ufs_container.intel.lua new file mode 100644 index 0000000000..aa95cae0dc --- /dev/null +++ b/modulefiles/ufs_container.intel.lua @@ -0,0 +1,31 @@ +help([[ +Load environment to compile ufs-weather-model in a container using Intel +]]) + +prepend_path("MODULEPATH", "/opt/spack-stack/spack-stack-1.9.2/envs/unified-env/install/modulefiles/Core") +prepend_path("MODULEPATH", "/opt/spack-stack/spack-stack-1.9.2/envs/unified-env/install/modulefiles/intel-oneapi-mpi/2021.13-argr3sd/gcc/11.4.0") + +stack_oneapi_ver=os.getenv("stack_oneapi_ver") or "2024.2.0" +stack_impi_ver=os.getenv("stack_impi_ver") or "2021.13" + +load(pathJoin("stack-oneapi", stack_oneapi_ver)) +load(pathJoin("stack-intel-oneapi-mpi", stack_impi_ver)) + +cmake_ver=os.getenv("cmake_ver") or "3.27.9" +load(pathJoin("cmake", cmake_ver)) + +load("ufs_common") + +nccmp_ver=os.getenv("nccmp_ver") or "1.9.0.1" +load(pathJoin("nccmp", nccmp_ver)) + +setenv("CC", "mpiicx") +setenv("CXX", "mpiicpx") +setenv("FC", "mpiifort") +setenv("I_MPI_CC", "icx") +setenv("I_MPI_CXX", "icpx") +setenv("I_MPI_F90", "ifort") + +setenv("CMAKE_Platform", "container.intel") + +whatis("Description: UFS build environment") diff --git a/tests/compile.sh b/tests/compile.sh index 6dcbde8240..3b54cb6c78 100755 --- a/tests/compile.sh +++ b/tests/compile.sh @@ -66,6 +66,9 @@ case ${MACHINE_ID} in fi if [[ ${MACHINE_ID} == gaeac6 ]]; then module reset + elif [[ ${MACHINE_ID} == container ]]; then + source /usr/lmod/lmod/init/bash + module purge elif [[ ${MACHINE_ID} == hercules ]]; then module purge fi diff --git a/tests/detect_machine.sh b/tests/detect_machine.sh index 27e56f990b..df8bb21134 100755 --- a/tests/detect_machine.sh +++ b/tests/detect_machine.sh @@ -8,6 +8,12 @@ # # Thank you for your contribution +# Overwrite auto-detect if in container +if [[ -d /opt/spack-stack && -v SINGULARITY_CONTAINER ]]; then + # We are in a container + MACHINE_ID=container +fi + # If the MACHINE_ID variable is set, skip this script. [[ -n ${MACHINE_ID:-} ]] && return @@ -70,6 +76,12 @@ fi # Overwrite auto-detect with MACHINE if set MACHINE_ID=${MACHINE:-${MACHINE_ID}} +# Overwrite auto-detect if in container +if [[ -d /opt/spack-stack && -v SINGULARITY_CONTAINER ]]; then + # We are in a container + MACHINE_ID=container +fi + # If MACHINE_ID is no longer UNKNNOWN, return it if [[ "${MACHINE_ID}" != "UNKNOWN" ]]; then return @@ -112,6 +124,9 @@ elif [[ -d /gpfs/f6 && -d /ncrc ]]; then elif [[ -d /data/prod ]]; then # We are on SSEC's S4 MACHINE_ID=s4 +elif [[ -d /opt/spack-stack && -v SINGULARITY_CONTAINER ]]; then + # We are in a container + MACHINE_ID=container else echo WARNING: UNKNOWN PLATFORM 1>&2 fi diff --git a/tests/module-setup.sh b/tests/module-setup.sh index c6171337bf..dcdcecf139 100755 --- a/tests/module-setup.sh +++ b/tests/module-setup.sh @@ -82,6 +82,11 @@ elif [[ ${MACHINE_ID} = gaeac6 ]]; then fi module reset +elif [[ ${MACHINE_ID} = container ]] ; then + # We are in a container + source /usr/lmod/lmod/init/bash + module purge + elif [[ ${MACHINE_ID} = noaacloud ]] ; then # We are on NOAA Cloud module purge