From b6843a7ebae75eb2728d1fcbef4eb96a1add02e6 Mon Sep 17 00:00:00 2001 From: Natalie Perlin <68030316+natalie-perlin@users.noreply.github.com> Date: Wed, 22 Jun 2022 14:57:32 -0400 Subject: [PATCH] added a module build_linux_gnu, updated build_macos_gnu (#313) * added a module build_linux_gnu, updated build_macos_gnu * updated modulefiles for linux and macos * added rocoto module loading template to linux and macos wflow_x modules * updated wflow_linux and wflow_macos Use env. variable $HOME to correspond the way the virtual environment was set during the build stage --- modulefiles/build_linux_compiler | 91 ++++++++++++++++++++++++++++++++ modulefiles/build_macos_gnu | 35 ++++++------ modulefiles/wflow_linux | 29 ++++++++++ modulefiles/wflow_macos | 16 +++--- 4 files changed, 148 insertions(+), 23 deletions(-) create mode 100644 modulefiles/build_linux_compiler create mode 100644 modulefiles/wflow_linux diff --git a/modulefiles/build_linux_compiler b/modulefiles/build_linux_compiler new file mode 100644 index 0000000000..0845311fd3 --- /dev/null +++ b/modulefiles/build_linux_compiler @@ -0,0 +1,91 @@ +#%Module + +proc ModulesHelp { } { + puts stderr "This module needs to be customized for the user's Linux environment:" + puts stderr "specify compilers, path for HPC-stack, load the modules, set compiler and linker flags" +} + +module-whatis "Loads libraries needed for building SRW on Linux" + +# This path should point to your HPCstack installation directory +setenv HPCstack "/home/username/hpc-stack/install" + +# Load HPC stack +module use $env(HPCstack)/modulefiles/stack +module load hpc +module load hpc-python +# +module load hpc-gnu +module load openmpi +module load hpc-openmpi + +module load jasper/2.0.25 +module load zlib/1.2.11 + +module load hdf5/1.10.6 +module load netcdf/4.7.4 +module load pio/2.5.3 +module load esmf/8.3.0b09 +module load fms/2022.01 + +module load bacio/2.4.1 +module load crtm/2.3.0 +module load g2/3.4.3 +module load g2tmpl/1.10.0 +module load ip/3.3.3 +module load sp/2.3.3 +module load w3nco/2.4.1 +module load upp/10.0.10 + +module load gftl-shared/1.3.3 +module load yafyaml/0.5.1 +module load mapl/2.11.0-esmf-8.3.0b09 +module load gfsio/1.4.1 +module load landsfcutil/2.4.1 +module load nemsio/2.5.2 +module load nemsiogfs/2.5.3 +module load sfcio/1.4.1 +module load sigio/2.3.2 +module load w3emc/2.7.3 +module load wgrib2/2.0.8 + +# Set the env. variables for the serial compilers (CC, FC, CXX), if not present +setenv CC "/usr/local/bin/gcc" +setenv FC "/usr/local/bin/gfortran" +setenv CXX "/usr/local/bin/g++" + +# Set MPI compilers depending on the MPI libraries built: +setenv MPI_CC mpicc +setenv MPI_CXX mpicxx +setenv MPI_FC mpif90 + +# Set compilers and platform names for CMake: +setenv CMAKE_C_COMPILER $env(MPI_CC) +setenv CMAKE_CXX_COMPILER $env(MPI_CXX) +setenv CMAKE_Fortran_COMPILER $env(MPI_FC) + +setenv CMAKE_Platform linux.gnu +#setenv CMAKE_Platform linux.intel + +setenv CMAKE_Fortran_COMPILER_ID "GNU" +#setenv CMAKE_Fortran_COMPILER_ID "Intel" + +# Set compiler and linker flags if needed: +setenv FFLAGS " -fallow-argument-mismatch" + +if { [module-info mode load] } { + puts stderr "This module needs to be customized for the user's Linux environment:" + puts stderr "load the environment modules if present, hpc-stack modules," + puts stderr "specify compilers, path for HPC-stack and SRW directory on Linux systems" + puts stderr "1) env. variable HPCstack is the hpc-stack installation directory" + puts stderr "2) Load the modules build with the hpc-stack on your system" + puts stderr "3) Specify compilers, compiler and linker flags, and a platform name" + puts stderr " The example below is for the GNU compilers built with OpenMPI libraries" + puts stderr " " + puts stderr "NB: After the module is customized, comment out the this line and the `puts stderr` lines above" + puts stderr " " + puts stderr "Please export env. variable LDFLAGS after the module is successfully loaded: + > export LDFLAGS=\"-L\$MPI_ROOT/lib \" " +} + + diff --git a/modulefiles/build_macos_gnu b/modulefiles/build_macos_gnu index 54a5d5db38..c222e56fd2 100644 --- a/modulefiles/build_macos_gnu +++ b/modulefiles/build_macos_gnu @@ -1,9 +1,11 @@ #%Module proc ModulesHelp { } { - puts stderr "Option 1: M1/arm64 platform, OS BigSur,Monterey (Darwin 20,21) " - puts stderr "Option 2: Intel/x86_64 platform, OS BigSur (Darwin 19) " - puts stderr " + puts stderr "This module needs to be customized for the user's MacOS environment:" + puts stderr "specify compilers, path for HPC-stack, load the modules, set compiler and linker flags" + puts stderr "Option 1: M1/arm64 platform, OS BigSur, Monterey (Darwin 20,21) " + puts stderr "Option 2: Intel/x86_64 platform, OS Catalina (Darwin 19) " + puts stderr " " } module-whatis "Loads libraries needed for building SRW on MacOS" @@ -15,9 +17,6 @@ if { [module-info mode load] } { # This path should point to your HPCstack installation directory setenv HPCstack "/Users/username/hpc-stack/install" -# This path should point to your SRW Application directory -setenv SRW "/Users/username/ufs-srweather-app" - # Load HPC stack module use $env(HPCstack)/modulefiles/stack module load hpc @@ -27,29 +26,27 @@ module load hpc-gnu module load openmpi module load hpc-openmpi -module use $env(SRW)/modulefiles -#module load srw_common module load jasper/2.0.25 module load zlib/1.2.11 module load hdf5/1.10.6 module load netcdf/4.7.4 module load pio/2.5.3 -module load esmf/8_2_0 -module load fms/2021.04 +module load esmf/8.3.0b09 +module load fms/2022.01 module load bacio/2.4.1 module load crtm/2.3.0 -module load g2/3.4.5 +module load g2/3.4.3 module load g2tmpl/1.10.0 module load ip/3.3.3 module load sp/2.3.3 module load w3nco/2.4.1 module load upp/10.0.10 -module load gftl-shared/v1.3.6 -module load yafyaml/v0.5.1 -module load mapl/2.12.2-esmf-8_2_0 +module load gftl-shared/1.3.3 +module load yafyaml/0.5.1 +module load mapl/2.12.2-esmf-8.3.0b09 module load gfsio/1.4.1 module load landsfcutil/2.4.1 module load nemsio/2.5.2 @@ -82,6 +79,12 @@ setenv CMAKE_Platform macos.gnu setenv CMAKE_Fortran_COMPILER_ID "GNU" setenv FFLAGS "-DNO_QUAD_PRECISION -fallow-argument-mismatch " -# export the environment variable LDFLAGS from the command line -# after loading the current module: +# export the env. variable LDFLAGS after loading the current module # export LDFLAGS="-L$MPI_ROOT/lib" +if { [module-info mode load] } { + puts stderr " " + puts stderr "Please export env. variable LDFLAGS after the module is successfully loaded: + > export LDFLAGS=\"-L\$MPI_ROOT/lib \" " +} + + diff --git a/modulefiles/wflow_linux b/modulefiles/wflow_linux new file mode 100644 index 0000000000..2d4a4e33e9 --- /dev/null +++ b/modulefiles/wflow_linux @@ -0,0 +1,29 @@ +#%Module + +proc ModulesHelp { } { + puts stderr "This module activates python environement for running SRW on general Linux" +} + +module-whatis "This module activates python environment for running SRW on general Linux" + +setenv CMAKE_Platform linux + +# This path should point to your python virtual environment directory, +# `regional_workflow`, created earlier for +# +setenv VENV "$env(HOME)/venv/regional_workflow" +if { [module-info mode load] } { + puts stderr "Verify the Python virtual environment path \$VENV shown below is correct, " + puts stderr "set to the correct path otherwise: " + puts stderr "VENV=$env(VENV) " + puts stderr "Please do the following to activate python virtual environment: + > source \$VENV/bin/activate " +} + +# Uncomment if Rocoto workflow manager is used +# This path should point to your Rocoto module location +# setenv ROCOTOmod "/Users/username/modules" +# module use $env(ROCOTOmod) +# module load rocoto + + diff --git a/modulefiles/wflow_macos b/modulefiles/wflow_macos index 5cf2c05984..6442e7e4f6 100644 --- a/modulefiles/wflow_macos +++ b/modulefiles/wflow_macos @@ -1,8 +1,7 @@ #%Module proc ModulesHelp { } { - put stderr "This module loads python environement for running SRW on" - put stderr "macOS" + puts stderr "This module activates python environement for running SRW on macOS" } module-whatis "This module activates python environment for running SRW on macOS" @@ -12,15 +11,18 @@ setenv CMAKE_Platform macos # This path should point to your python virtual environment directory, # `regional_workflow`, created earlier for # -setenv VENV "/Users/username/venv/regional_workflow" +setenv VENV "$env(HOME)/venv/regional_workflow" if { [module-info mode load] } { - puts "source $env(VENV)/bin/activate;" + puts stderr "Verify the Python virtual environment path \$VENV shown below is correct, " + puts stderr "set to the correct path otherwise: " + puts stderr "VENV=$env(VENV) " + puts stderr "Please do the following to activate python virtual environment: + > source \$VENV/bin/activate " } # Uncomment if Rocoto workflow manager is used # This path should point to your Rocoto module location -# set ROCOTOmod "/Users/username/modules" -# module use ${ROCOTOmod} +# setenv ROCOTOmod "/Users/username/modules" +# module use $env(ROCOTOmod) # module load rocoto -# module list