From f8a640bb0d1469b5842643399b7ff46715bb34ba Mon Sep 17 00:00:00 2001 From: Wei Huang Date: Tue, 28 May 2024 14:59:21 +0000 Subject: [PATCH 1/5] to compile on GCP and Azure --- sorc/machine-setup.sh | 48 ++++++++++++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/sorc/machine-setup.sh b/sorc/machine-setup.sh index 18388c66f..a7d79208d 100644 --- a/sorc/machine-setup.sh +++ b/sorc/machine-setup.sh @@ -38,17 +38,43 @@ elif [[ -d /scratch1 ]] ; then fi target=hera module purge -elif [[ -d /gpfs && -d /ncrc ]] ; then +elif [[ -d /lustre && -d /ncrc ]] ; then # We are on GAEA. if ( ! eval module help > /dev/null 2>&1 ) ; then - # We cannot simply load the module command. The GAEA - # /etc/profile modifies a number of module-related variables - # before loading the module command. Without those variables, - # the module command fails. Hence we actually have to source - # /etc/profile here. + # We cannot simply load the module command. The GAEA + # /etc/profile modifies a number of module-related variables + # before loading the module command. Without those variables, + # the module command fails. Hence we actually have to source + # /etc/profile here. + source /etc/profile + __ms_source_etc_profile=yes + else + __ms_source_etc_profile=no + fi + module purge > /dev/null 2>&1 + module purge +# clean up after purge + unset _LMFILES_ + unset _LMFILES_000 + unset _LMFILES_001 + unset LOADEDMODULES + module load modules + if [[ -d /opt/cray/ari/modulefiles ]] ; then + module use -a /opt/cray/ari/modulefiles + fi + if [[ -d /opt/cray/pe/ari/modulefiles ]] ; then + module use -a /opt/cray/pe/ari/modulefiles + fi + if [[ -d /opt/cray/pe/craype/default/modulefiles ]] ; then + module use -a /opt/cray/pe/craype/default/modulefiles + fi + if [[ -s /etc/opt/cray/pe/admin-pe/site-config ]] ; then + source /etc/opt/cray/pe/admin-pe/site-config + fi + if [[ "$__ms_source_etc_profile" == yes ]] ; then source /etc/profile + unset __ms_source_etc_profile fi - module reset target=gaea elif [[ "$(hostname)" =~ "Orion" ]]; then target="orion" @@ -67,16 +93,14 @@ elif [[ -d /data/prod ]] ; then fi target=s4 module purge -elif [[ "$(dnsdomainname)" =~ "pw" ]]; then - if [[ "${PW_CSP}" == "aws" ]]; then # TODO: Add other CSPs here. +else + if [[ "${PW_CSP}" == "aws" || "${PW_CSP}" == "azure" || "${PW_CSP}" == "google" ]]; then target=noaacloud module purge else + echo WARNING: UNKNOWN PLATFORM 1>&2 echo WARNING: UNSUPPORTED CSP PLATFORM 1>&2; exit 99 fi -else - - echo WARNING: UNKNOWN PLATFORM 1>&2 fi unset __ms_shell From 4bf2b43e4d61ddad0f6349e444a904883f51b926 Mon Sep 17 00:00:00 2001 From: Wei Huang Date: Tue, 28 May 2024 11:38:33 -0400 Subject: [PATCH 2/5] check if PW_CSP is defined --- sorc/machine-setup.sh | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/sorc/machine-setup.sh b/sorc/machine-setup.sh index a7d79208d..7a2dd19b6 100644 --- a/sorc/machine-setup.sh +++ b/sorc/machine-setup.sh @@ -94,12 +94,20 @@ elif [[ -d /data/prod ]] ; then target=s4 module purge else - if [[ "${PW_CSP}" == "aws" || "${PW_CSP}" == "azure" || "${PW_CSP}" == "google" ]]; then - target=noaacloud - module purge + if [[ ! -v PW_CSP ]]; then + echo WARNING: UNSUPPORTED CSP PLATFORM 1>&2 + echo WARNING: UNKNOWN PLATFORM 1>&2; exit 99 + elif [[ -z "${PW_CSP}" ]]; then + echo WARNING: UNSUPPORTED CSP PLATFORM 1>&2 + echo WARNING: UNKNOWN PLATFORM 1>&2; exit 99 else - echo WARNING: UNKNOWN PLATFORM 1>&2 - echo WARNING: UNSUPPORTED CSP PLATFORM 1>&2; exit 99 + if [[ "${PW_CSP}" == "aws" || "${PW_CSP}" == "azure" || "${PW_CSP}" == "google" ]]; then + target=noaacloud + module purge + else + echo WARNING: UNKNOWN PLATFORM 1>&2 + echo WARNING: UNSUPPORTED CSP PLATFORM 1>&2; exit 99 + fi fi fi From 2cedc1b69a5fb81653fcc94740807f9b02d754b3 Mon Sep 17 00:00:00 2001 From: Wei Huang Date: Thu, 6 Jun 2024 13:01:10 -0400 Subject: [PATCH 3/5] minor changes on error msg --- sorc/machine-setup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sorc/machine-setup.sh b/sorc/machine-setup.sh index 7a2dd19b6..c59a7ce7a 100644 --- a/sorc/machine-setup.sh +++ b/sorc/machine-setup.sh @@ -105,8 +105,8 @@ else target=noaacloud module purge else - echo WARNING: UNKNOWN PLATFORM 1>&2 - echo WARNING: UNSUPPORTED CSP PLATFORM 1>&2; exit 99 + echo WARNING: UNSUPPORTED CSP PLATFORM 1>&2 + echo WARNING: UNKNOWN PLATFORM 1>&2; exit 99 fi fi fi From f1461fcbc2412314ab270b3a0c743a1c985db4bb Mon Sep 17 00:00:00 2001 From: Wei Huang Date: Mon, 10 Jun 2024 14:42:18 +0000 Subject: [PATCH 4/5] remove extra changes --- sorc/machine-setup.sh | 42 ++++++++---------------------------------- 1 file changed, 8 insertions(+), 34 deletions(-) diff --git a/sorc/machine-setup.sh b/sorc/machine-setup.sh index c59a7ce7a..af65b30d0 100644 --- a/sorc/machine-setup.sh +++ b/sorc/machine-setup.sh @@ -38,43 +38,17 @@ elif [[ -d /scratch1 ]] ; then fi target=hera module purge -elif [[ -d /lustre && -d /ncrc ]] ; then +elif [[ -d /gpfs && -d /ncrc ]] ; then # We are on GAEA. if ( ! eval module help > /dev/null 2>&1 ) ; then - # We cannot simply load the module command. The GAEA - # /etc/profile modifies a number of module-related variables - # before loading the module command. Without those variables, - # the module command fails. Hence we actually have to source - # /etc/profile here. - source /etc/profile - __ms_source_etc_profile=yes - else - __ms_source_etc_profile=no - fi - module purge > /dev/null 2>&1 - module purge -# clean up after purge - unset _LMFILES_ - unset _LMFILES_000 - unset _LMFILES_001 - unset LOADEDMODULES - module load modules - if [[ -d /opt/cray/ari/modulefiles ]] ; then - module use -a /opt/cray/ari/modulefiles - fi - if [[ -d /opt/cray/pe/ari/modulefiles ]] ; then - module use -a /opt/cray/pe/ari/modulefiles - fi - if [[ -d /opt/cray/pe/craype/default/modulefiles ]] ; then - module use -a /opt/cray/pe/craype/default/modulefiles - fi - if [[ -s /etc/opt/cray/pe/admin-pe/site-config ]] ; then - source /etc/opt/cray/pe/admin-pe/site-config - fi - if [[ "$__ms_source_etc_profile" == yes ]] ; then + # We cannot simply load the module command. The GAEA + # /etc/profile modifies a number of module-related variables + # before loading the module command. Without those variables, + # the module command fails. Hence we actually have to source + # /etc/profile here. source /etc/profile - unset __ms_source_etc_profile fi + module reset target=gaea elif [[ "$(hostname)" =~ "Orion" ]]; then target="orion" @@ -102,7 +76,7 @@ else echo WARNING: UNKNOWN PLATFORM 1>&2; exit 99 else if [[ "${PW_CSP}" == "aws" || "${PW_CSP}" == "azure" || "${PW_CSP}" == "google" ]]; then - target=noaacloud + target=noaacloud module purge else echo WARNING: UNSUPPORTED CSP PLATFORM 1>&2 From 9d1512f29a012e310384049ded73fe780d126673 Mon Sep 17 00:00:00 2001 From: Wei Huang Date: Mon, 10 Jun 2024 20:42:50 +0000 Subject: [PATCH 5/5] remove CSP_PLATFORM warning, as that is already included in PLATFORM --- sorc/machine-setup.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/sorc/machine-setup.sh b/sorc/machine-setup.sh index af65b30d0..da10dabf5 100644 --- a/sorc/machine-setup.sh +++ b/sorc/machine-setup.sh @@ -69,17 +69,14 @@ elif [[ -d /data/prod ]] ; then module purge else if [[ ! -v PW_CSP ]]; then - echo WARNING: UNSUPPORTED CSP PLATFORM 1>&2 echo WARNING: UNKNOWN PLATFORM 1>&2; exit 99 elif [[ -z "${PW_CSP}" ]]; then - echo WARNING: UNSUPPORTED CSP PLATFORM 1>&2 echo WARNING: UNKNOWN PLATFORM 1>&2; exit 99 else if [[ "${PW_CSP}" == "aws" || "${PW_CSP}" == "azure" || "${PW_CSP}" == "google" ]]; then target=noaacloud module purge else - echo WARNING: UNSUPPORTED CSP PLATFORM 1>&2 echo WARNING: UNKNOWN PLATFORM 1>&2; exit 99 fi fi