From df689b4e56de99c527088687e63a095ea89ef63e Mon Sep 17 00:00:00 2001 From: Jian Sun Date: Mon, 16 Oct 2023 16:13:02 -0600 Subject: [PATCH 1/5] Add build scripts and README file for Derecho --- etc/derecho/README.md | 50 ++++++++++++++++++++++++ etc/derecho/build_tuvx_derecho_gnu.sh | 51 +++++++++++++++++++++++++ etc/derecho/build_tuvx_derecho_intel.sh | 49 ++++++++++++++++++++++++ 3 files changed, 150 insertions(+) create mode 100644 etc/derecho/README.md create mode 100755 etc/derecho/build_tuvx_derecho_gnu.sh create mode 100755 etc/derecho/build_tuvx_derecho_intel.sh diff --git a/etc/derecho/README.md b/etc/derecho/README.md new file mode 100644 index 00000000..8bae1624 --- /dev/null +++ b/etc/derecho/README.md @@ -0,0 +1,50 @@ +# Building TUV-x on Derecho + +## Get the source code + +- Copy the build script you wish to use from this folder to GLADE. + There are scripts for GNU and Intel compilers, without MPI support. + +- Log in to Derecho + +- Create a directory to build TUV-x in: + +``` +mkdir my-tuvx-build +``` + +- Create an environment variable named `TUVX_HOME` pointing to the absolute path of your build directory: + +``` +export TUVX_HOME=/path/to/my-tuvx-build +``` + +## Build TUV-x + +Replace `/path/to/build_tuvx_derecho_X.sh` with the path to the build script you copied to GLADE, in the following: + +``` +cd $TUVX_HOME +. /path/to/build_tuvx_derecho_X.sh +``` + +## Run TUV-x +- Whenever you go to run TUV-x after it has been built, make sure you have the correct environment modules loaded. + Look at the top of the build script you used to find the modules required. + +- Run a test. The tests use the python numpy package, and we access this through the conda environment module on Derecho: + +``` +module load conda +conda activate npl +cd $TUVX_HOME/tuv-x-private/build +make test +``` + +- Run a configuration (this does not require any Python packages) + +``` +cd $TUVX_HOME/tuv-x-private/build +./tuv-x examples/full_config.json +``` + diff --git a/etc/derecho/build_tuvx_derecho_gnu.sh b/etc/derecho/build_tuvx_derecho_gnu.sh new file mode 100755 index 00000000..37691618 --- /dev/null +++ b/etc/derecho/build_tuvx_derecho_gnu.sh @@ -0,0 +1,51 @@ +# Downloads and builds TUV-x and its dependencies on Derecho using GNU compilers +# +# The TUVX_HOME environment variable must be set to the directory to build TUV-x +# in prior to calling this script + + +module purge +module load ncarenv/23.09 +module load craype/2.7.20 +module load gcc/12.2.0 +module load cray-libsci/23.02.1.1 +module load netcdf/4.9.2 +module load ncarcompilers/1.0.0 +module load cmake/3.26.3 + +if [[ -z "${TUVX_HOME}" ]]; then + echo "You must set the TUVX_HOME environment variable to the directory where TUV-x should be build." + return +fi + +if [[ ! -d "${TUVX_HOME}" ]]; then + echo "TUVX_HOME must point to an existing directory" + return +fi + +echo "Building JSON Fortran" + +# get & build the source code of JSON Fortran + +cd ${TUVX_HOME} +curl -LO https://github.com/jacobwilliams/json-fortran/archive/8.3.0.tar.gz +tar -zxvf 8.3.0.tar.gz +cd json-fortran-8.3.0 +mkdir build +cd build +INSTALL_DIR=$TUVX_HOME/json-fortran-8.3.0 +cmake -D SKIP_DOC_GEN:BOOL=TRUE -D CMAKE_INSTALL_PREFIX=$INSTALL_DIR .. +make install + +echo "Building TUV-x" + +# get & build the source code of TUV-x + +cd ${TUVX_HOME} +git clone git@github.com:NCAR/tuv-x-private.git +cd tuv-x-private +mkdir build +cd build +export JSON_FORTRAN_HOME=$INSTALL_DIR/jsonfortran-gnu-8.3.0 +cmake -D CMAKE_BUILD_TYPE=release -D ENABLE_MEMCHECK=OFF -D LAPACK_LIBRARIES=-lsci_gnu .. +make -j 8 diff --git a/etc/derecho/build_tuvx_derecho_intel.sh b/etc/derecho/build_tuvx_derecho_intel.sh new file mode 100755 index 00000000..e4edcb8e --- /dev/null +++ b/etc/derecho/build_tuvx_derecho_intel.sh @@ -0,0 +1,49 @@ +# Downloads and builds TUV-x and its dependencies on Derecho using Intel compilers +# +# The TUVX_HOME environment variable must be set to the directory to build TUV-x +# in prior to calling this script + +module purge +module load ncarenv/23.09 +module load intel/2023.2.1 +module load netcdf/4.9.2 +module load mkl/2023.2.0 +module load ncarcompilers/1.0.0 +module load cmake/3.26.3 + +if [[ -z "${TUVX_HOME}" ]]; then + echo "You must set the TUVX_HOME environment variable to the directory where TUV-x should be build." + return +fi + +if [[ ! -d "${TUVX_HOME}" ]]; then + echo "TUVX_HOME must point to an existing directory" + return +fi + +echo "Building JSON Fortran" + +# get & build the source code of JSON Fortran + +cd ${TUVX_HOME} +curl -LO https://github.com/jacobwilliams/json-fortran/archive/8.3.0.tar.gz +tar -zxvf 8.3.0.tar.gz +cd json-fortran-8.3.0 +mkdir build +cd build +INSTALL_DIR=$TUVX_HOME/json-fortran-8.3.0 +cmake -D SKIP_DOC_GEN:BOOL=TRUE -D CMAKE_INSTALL_PREFIX=$INSTALL_DIR .. +make install + +echo "Building TUV-x" + +# get & build the source code of TUV-x + +cd ${TUVX_HOME} +git clone git@github.com:NCAR/tuv-x-private.git +cd tuv-x-private +mkdir build +cd build +export JSON_FORTRAN_HOME=$INSTALL_DIR/jsonfortran-intel-8.3.0 +cmake -D CMAKE_BUILD_TYPE=release -D ENABLE_MEMCHECK=OFF -DBLAS_LIBRARIES=-lmkl_rt -DLAPACK_LIBRARIES=-lmkl_rt .. +make -j 8 From 50e464df3af7eb01d7ce7458cd2dba24338e6c5a Mon Sep 17 00:00:00 2001 From: Jian Sun Date: Mon, 16 Oct 2023 16:51:21 -0600 Subject: [PATCH 2/5] Update etc/derecho/README.md Co-authored-by: Matt Dawson --- etc/derecho/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/derecho/README.md b/etc/derecho/README.md index 8bae1624..0d868d57 100644 --- a/etc/derecho/README.md +++ b/etc/derecho/README.md @@ -37,7 +37,7 @@ cd $TUVX_HOME ``` module load conda conda activate npl -cd $TUVX_HOME/tuv-x-private/build +cd $TUVX_HOME/tuv-x/build make test ``` From b63c0587cc951b36c541881bbf8c64cc8e0f4177 Mon Sep 17 00:00:00 2001 From: Jian Sun Date: Mon, 16 Oct 2023 16:51:38 -0600 Subject: [PATCH 3/5] Update etc/derecho/README.md Co-authored-by: Matt Dawson --- etc/derecho/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/derecho/README.md b/etc/derecho/README.md index 0d868d57..e6a5eb8d 100644 --- a/etc/derecho/README.md +++ b/etc/derecho/README.md @@ -44,7 +44,7 @@ make test - Run a configuration (this does not require any Python packages) ``` -cd $TUVX_HOME/tuv-x-private/build +cd $TUVX_HOME/tuv-x/build ./tuv-x examples/full_config.json ``` From 89e67b0dcb77ffeb9baf30f788cee70b4a6b70f2 Mon Sep 17 00:00:00 2001 From: Jian Sun Date: Mon, 16 Oct 2023 16:51:48 -0600 Subject: [PATCH 4/5] Update etc/derecho/build_tuvx_derecho_gnu.sh Co-authored-by: Matt Dawson --- etc/derecho/build_tuvx_derecho_gnu.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/derecho/build_tuvx_derecho_gnu.sh b/etc/derecho/build_tuvx_derecho_gnu.sh index 37691618..7b8a9aab 100755 --- a/etc/derecho/build_tuvx_derecho_gnu.sh +++ b/etc/derecho/build_tuvx_derecho_gnu.sh @@ -42,8 +42,8 @@ echo "Building TUV-x" # get & build the source code of TUV-x cd ${TUVX_HOME} -git clone git@github.com:NCAR/tuv-x-private.git -cd tuv-x-private +git clone git@github.com:NCAR/tuv-x.git +cd tuv-x mkdir build cd build export JSON_FORTRAN_HOME=$INSTALL_DIR/jsonfortran-gnu-8.3.0 From 7aa4fbcbda243196c43bb977625f2550cd6ce4da Mon Sep 17 00:00:00 2001 From: Jian Sun Date: Mon, 16 Oct 2023 16:51:54 -0600 Subject: [PATCH 5/5] Update etc/derecho/build_tuvx_derecho_intel.sh Co-authored-by: Matt Dawson --- etc/derecho/build_tuvx_derecho_intel.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/derecho/build_tuvx_derecho_intel.sh b/etc/derecho/build_tuvx_derecho_intel.sh index e4edcb8e..f40586e3 100755 --- a/etc/derecho/build_tuvx_derecho_intel.sh +++ b/etc/derecho/build_tuvx_derecho_intel.sh @@ -40,8 +40,8 @@ echo "Building TUV-x" # get & build the source code of TUV-x cd ${TUVX_HOME} -git clone git@github.com:NCAR/tuv-x-private.git -cd tuv-x-private +git clone git@github.com:NCAR/tuv-x.git +cd tuv-x mkdir build cd build export JSON_FORTRAN_HOME=$INSTALL_DIR/jsonfortran-intel-8.3.0