Skip to content

Commit

Permalink
added a module build_linux_gnu, updated build_macos_gnu (#313)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
natalie-perlin authored Jun 22, 2022
1 parent 5a062db commit b6843a7
Show file tree
Hide file tree
Showing 4 changed files with 148 additions and 23 deletions.
91 changes: 91 additions & 0 deletions modulefiles/build_linux_compiler
Original file line number Diff line number Diff line change
@@ -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 \" "
}


35 changes: 19 additions & 16 deletions modulefiles/build_macos_gnu
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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 \" "
}


29 changes: 29 additions & 0 deletions modulefiles/wflow_linux
Original file line number Diff line number Diff line change
@@ -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


16 changes: 9 additions & 7 deletions modulefiles/wflow_macos
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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

0 comments on commit b6843a7

Please sign in to comment.