Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### Changed

- Move to use spack-stack 1.9 for modules at NCCS

### Fixed
### Removed
### Added
Expand Down
127 changes: 26 additions & 101 deletions g5_modules
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
# Name: g5_modules
#
# Purposes -
# * provide single location for BASEDIR and module values
# * provide single location for module values
# * initialize the following:
# - set BASEDIR
# - update LD_LIBRARY_PATH with BASEDIR lib (if useldlibs is set)
# - load library modules
# * echo expected BASEDIR and library module values when queried
# * echo expected library module values when queried
#
# Notes:
# 1. The script will not function correctly if the scriptname
Expand Down Expand Up @@ -74,9 +72,6 @@ if (($node =~ discover*) || ($node =~ borg*) || \

set site = "NCCS"

# NCCS now has both SLES15 and SLES12 machines
set OS_VERSION=`grep VERSION_ID /etc/os-release | cut -d= -f2 | cut -d. -f1 | sed 's/"//g'`

else if (($node =~ pfe*) || ($node =~ afe*) || \
($node =~ r[0-9]*i[0-9]*n[0-9]*) || \
($node =~ r[0-9]*c[0-9]*t[0-9]*n[0-9]*)) then
Expand Down Expand Up @@ -117,51 +112,41 @@ X86_64:
set modinit = DUMMY

set usemodules = 0
set useldlibs = 0

#========#
# NCCS #
#========#
if ( $site == NCCS ) then

set mod1 = GEOSenv

if ( $OS_VERSION == 12 ) then

set mod2 = comp/gcc/12.1.0
set mod3 = comp/intel/2021.6.0
set mod4 = mpi/impi/2021.6.0
set mod5 = python/GEOSpyD/Min24.4.0-0_py3.11_AND_Min4.8.3_py2.7
set basedir = /discover/swdev/gmao_SIteam/Baselibs/ESMA-Baselibs-7.32.0/x86_64-pc-linux-gnu/ifort_2021.6.0-intelmpi_2021.6.0-SLES12
set usemod1 = /discover/swdev/gmao_SIteam/modulefiles-SLES12

else

set mod2 = comp/gcc/12.3.0
set mod3 = comp/intel/2024.2.0
set mod4 = mpi/impi/2021.13
set mod5 = python/GEOSpyD/24.3.0-0/3.11
set basedir = /discover/swdev/gmao_SIteam/Baselibs/ESMA-Baselibs-7.32.0/x86_64-pc-linux-gnu/ifort_2021.13.0-intelmpi_2021.13.0-SLES15
set usemod1 = /discover/swdev/gmao_SIteam/modulefiles-SLES15

endif

set mods = ( $mod1 $mod2 $mod3 $mod4 $mod5 )
set usemod1 = /discover/swdev/gmao_SIteam/modulefiles-SLES15
set usemod2 = /discover/swdev/jcsda/spack-stack/scu17/modulefiles
set usemod3 = /gpfsm/dswdev/jcsda/spack-stack/scu17/spack-stack-1.9.0/envs/ue-oneapi-2024.2.0/install/modulefiles/Core

set mod1 = stack-oneapi/2024.2.0
set mod2 = stack-intel-oneapi-mpi/2021.13
set mod3 = stack-python/3.11.7
set mod4 = git
set mod5 = cmake
set mod6 = esmf/8.8.0
set mod7 = gftl
set mod8 = gftl-shared
set mod9 = pflogger
set mod10 = fargparse
set mod11 = udunits

set mods = ( $mod1 $mod2 $mod3 $mod4 $mod5 $mod6 $mod7 $mod8 $mod9 $mod10 $mod11 )
set modinit = /usr/share/modules/init/csh

set usemods = ( $usemod1 )
set usemods = ( $usemod1 $usemod2 $usemod3 )
set usemodules = 1

set useldlibs = 1

#=======#
# NAS #
#=======#
else if ( $site == NAS ) then

set mod1 = GEOSenv

set basedir = /nobackup/gmao_SIteam/Baselibs/ESMA-Baselibs-7.32.0/x86_64-pc-linux-gnu/ifort_2021.13.0-mpt_2.30
set mod2 = comp-gcc/12.3.0-TOSS4
set mod3 = comp-intel/2024.2.0-ifort
set mod4 = mpi-hpe/mpt
Expand All @@ -177,14 +162,11 @@ else if ( $site == NAS ) then
set usemods = ( $usemod1 $usemod2 $usemod3 )
set usemodules = 1

set useldlibs = 0

#=================#
# GMAO DESKTOP #
#=================#
else if ( $site == GMAO.desktop ) then

set basedir=/ford1/share/gmao_SIteam/Baselibs/ESMA-Baselibs-7.32.0/x86_64-pc-linux-gnu/ifort_2021.13.0-intelmpi_2021.13

set mod1 = GEOSenv

Expand All @@ -200,10 +182,6 @@ else if ( $site == GMAO.desktop ) then
set usemods = ( $usemod1 )
set usemodules = 1

# Testing shows adding BASEDIR lib to LD_LIBRARY_PATH
# causes issues with the TCL modules on the GMAO machines
set useldlibs = 0

endif

goto ACTION
Expand All @@ -220,7 +198,6 @@ ARM64:
set modinit = DUMMY

set usemodules = 0
set useldlibs = 0

goto ACTION

Expand All @@ -235,10 +212,7 @@ ACTION:
set wrapper = 0
if ( $#argv > 0 ) then

if ( $1 == basedir ) then
echo $basedir

else if ( $1 == modules ) then
if ( $1 == modules ) then
echo $mods

else if ( $1 == modinit ) then
Expand All @@ -247,9 +221,6 @@ if ( $#argv > 0 ) then
else if ( $1 == usemodules ) then
echo $usemods

else if ( $1 == useldlibs ) then
echo $useldlibs

else if ( $1 == ESMA_FC ) then
echo $ESMA_FC

Expand Down Expand Up @@ -278,35 +249,9 @@ SETVALUES:
# SET VALUES #
#================#
#-------------------------------------------------------------------------
# set environment variables, BASEDIR and LD_LIBRARY_PATH; and load modules
# set environment variables, and LD_LIBRARY_PATH; and load modules
#-------------------------------------------------------------------------

# setenv BASEDIR
#---------------
if ($?basedir) then
if (! $wrapper) echo -n "${scriptname}: Setting BASEDIR"
setenv BASEDIR $basedir
else if ($?BASEDIR) then
if (! $wrapper) echo -n "${scriptname}: BASEDIR found in environment"
else
echo
echo "BASEDIR not found in environment or set by ${scriptname}"
exit 3
endif

# add BASEDIR lib to LD_LIBRARY_PATH, if not already there
#---------------------------------------------------------

if ($useldlibs) then
if ($?LD_LIBRARY_PATH) then
echo $LD_LIBRARY_PATH | grep $BASEDIR/$arch/lib > /dev/null
if ($status) then # == 1, if not found
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:$BASEDIR/$arch/lib
endif
else
setenv LD_LIBRARY_PATH $BASEDIR/$arch/lib
endif

# add individual $ld_libraries to LD_LIBRARY_PATH, if not already there
#----------------------------------------------------------------------
if ($?ld_libraries) then
Expand All @@ -317,18 +262,8 @@ if ($useldlibs) then
end
endif

if ($?LD_LIBRARY64_PATH) then
echo $LD_LIBRARY64_PATH | grep $BASEDIR/$arch/lib > /dev/null
if ($status) then # == 1, if not found
setenv LD_LIBRARY64_PATH ${LD_LIBRARY64_PATH}:$BASEDIR/$arch/lib
endif
endif
endif

# Set UDUNITS2_XML_PATH
# ---------------------
setenv UDUNITS2_XML_PATH $BASEDIR/$arch/share/udunits/udunits2.xml

# load library modules
#---------------------
if (-e $modinit) then
Expand Down Expand Up @@ -362,9 +297,6 @@ if (! $wrapper) echo " for $node"
if ($wrapper) then
set outfil = ".g5_modules.sh"

if ($?BASEDIR) then
echo "export BASEDIR=$BASEDIR" >! $outfil
endif
if ($?LD_LIBRARY_PATH) then
echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH" >> $outfil
endif
Expand Down Expand Up @@ -400,20 +332,16 @@ usage:
more <<EOF

NAME
$scriptname - Script to handle BASEDIR and library module definitions
$scriptname - Script to handle library module definitions

DESCRIPTION

This script provides a single location for storing the BASEDIR and
This script provides a single location for storing the
library module name information. Previous to this script, this
information was coded in multiple files.

This script will set the BASEDIR environment variable to its proper value,
add the BASEDIR lib directory to LD_LIBRARY_PATH (if necessary), and will
load library modules when sourced.

If the script is called with "basedir", "modules", "modinit", or
"useldlibs", then it will echo the values to standard output without
If the script is called with "modules", "modinit", or
then it will echo the values to standard output without
modifying the environment.

SYNOPSIS
Expand All @@ -427,11 +355,8 @@ SYNOPSIS
OPTIONS

help echo usage
basedir echo expected value for BASEDIR environment variable
modules echo expected list of modules
modinit echo location of csh module initialization script
useldlibs echo logical indicating whether BASEDIR lib should be
added to LD_LIBRARY_PATH
usemodules echo logical indicating whether "module use directory(s)"
is needed prior to loading other modules
ESMA_FC echo value of ESMA_FC if set
Expand Down
7 changes: 0 additions & 7 deletions g5_modules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@ if [ ! -e $g5modules ]; then
return 1
fi

# Basedir
export BASEDIR=$(csh $g5modules basedir)

# UDUNITS2_XML_PATH
arch=$(uname -s)
export UDUNITS2_XML_PATH=$BASEDIR/$arch/share/udunits/udunits2.xml

# Modules
source $MODULESHOME/init/bash
module purge
Expand Down
Loading