Skip to content

Commit

Permalink
Allow for both site and user extensions to EESSI
Browse files Browse the repository at this point in the history
  • Loading branch information
ocaisa committed Nov 7, 2023
1 parent f1a0e71 commit 98f20cd
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 15 deletions.
30 changes: 20 additions & 10 deletions EESSI-2023.06-extend.eb → EESSI-extend-2023.06-easybuild.eb
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
easyblock = 'Binary'

name = 'EESSI'
name = 'EESSI-extend'
version = '2023.06'
versionsuffix = '-extend'
# May have different ways to extend EESSI in future (manually, other tools,...)
versionsuffix = '-easybuild'

homepage = 'https://eessi.github.io/docs/'

Expand All @@ -13,9 +14,10 @@ description = """
personal workstations and cloud infrastructure.
This module allows you to extend EESSI using the same configuration for
EasyBuild as EESSI itself uses. It installs the modules in a special location
that is configurable in the CVMFS configuration (so can be on a shared
filesystem), and automatically found when using the default EESSI environment.
EasyBuild as EESSI itself uses. The default installation is the users
home directory, but this can be overridden for a site installation (by setting
EESSI_SITE_INSTALL) or for a direct installation under CVMFS (by setting
EESSI_CVMFS_INSTALL).
"""

toolchain = SYSTEM
Expand Down Expand Up @@ -55,14 +57,20 @@ modluafooter = """
if (mode() == "load") then
-- Use a working directory for temporary build files
if (os.getenv("WORKING_DIR") == nil) then
LmodMessage("-- Using /tmp as a temporary working directory for installations, you can override this by setting the environment variable WORKING_DIR and reloading the module (e.g., /dev/shm is a common option)")
LmodMessage("-- Using /tmp/$USER as a temporary working directory for installations, you can override this by setting the environment variable WORKING_DIR and reloading the module (e.g., /dev/shm is a common option)")
end
end
working_dir = os.getenv("WORKING_DIR") or "/tmp"
working_dir = os.getenv("WORKING_DIR") or pathJoin("/tmp", os.getenv("USER"))
-- Gather the EPREFIX to use as a sysroot
sysroot = os.getenv("EPREFIX")
sysroot = os.getenv("EESSI_EPREFIX")
-- Use an installation prefix that we _should_ have write access to
easybuild_installpath = string.gsub(os.getenv("EESSI_SOFTWARE_PATH"), 'versions', 'host_injections')
if (os.getenv("EESSI_CVMFS_INSTALL") ~= nil) then
easybuild_installpath = os.getenv("EESSI_SOFTWARE_PATH")
elseif (os.getenv("EESSI_SITE_INSTALL") ~= nil) then
easybuild_installpath = string.gsub(os.getenv("EESSI_SOFTWARE_PATH"), 'versions', 'host_injections')
else
easybuild_installpath = string.gsub(os.getenv("EESSI_SOFTWARE_PATH"), os.getenv("EESSI_CVMFS_REPO"), pathJoin(os.getenv("HOME"), "eessi"))
end
if (mode() == "load") then
LmodMessage("-- To create installations for EESSI, you _must_ have write permissions to " .. easybuild_installpath)
-- Advise them to reuse sources
Expand All @@ -74,7 +82,9 @@ end
setenv ("EASYBUILD_SYSROOT", sysroot)
setenv ("EASYBUILD_PREFIX", pathJoin(working_dir, "easybuild"))
setenv ("EASYBUILD_INSTALLPATH", easybuild_installpath)
always_load("EasyBuild")
if not ( isloaded("EasyBuild") ) then
load("EasyBuild")
end
"""

sanity_check_paths = {
Expand Down
2 changes: 1 addition & 1 deletion init/Magic_Castle/bash
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ source $(dirname "$BASH_SOURCE")/../eessi_environment_variables

# Provide a clean MODULEPATH
export MODULEPATH_ROOT=$EESSI_MODULEPATH
export MODULEPATH=$EESSI_EXTEND_MODULEPATH:$EESSI_MODULEPATH
export MODULEPATH=$EESSI_USER_MODULEPATH:$EESSI_SITE_MODULEPATH:$EESSI_MODULEPATH

# Extensions are too many, let's not print them by default (requires Lmod 8.4.12)
export LMOD_AVAIL_EXTENSIONS=no
Expand Down
6 changes: 4 additions & 2 deletions init/bash
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ if [ $? -eq 0 ]; then
# prepend location of modules for EESSI software stack to $MODULEPATH
echo "Prepending $EESSI_MODULEPATH to \$MODULEPATH..." >> $output
module use $EESSI_MODULEPATH
echo "Prepending $EESSI_EXTEND_MODULEPATH to \$MODULEPATH..." >> $output
module use $EESSI_EXTEND_MODULEPATH
echo "Prepending site path $EESSI_SITE_MODULEPATH to \$MODULEPATH..." >> $output
module use $EESSI_SITE_MODULEPATH
echo "Prepending user path $EESSI_SITE_MODULEPATH to \$MODULEPATH..." >> $output
module use $EESSI_USER_MODULEPATH

#echo >> $output
#echo "*** Known problems in the ${EESSI_PILOT_VERSION} pilot software stack ***" >> $output
Expand Down
6 changes: 4 additions & 2 deletions init/eessi_environment_variables
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ if [ -d $EESSI_PREFIX ]; then
if [ -d $EESSI_MODULEPATH ]; then
export EESSI_MODULEPATH=$EESSI_MODULEPATH
echo "Using ${EESSI_MODULEPATH} as the directory to be added to MODULEPATH." >> $output
export EESSI_EXTEND_MODULEPATH=${EESSI_MODULEPATH/versions/host_injections}
echo "Using ${EESSI_EXTEND_MODULEPATH} as the extension directory to be added to MODULEPATH." >> $output
export EESSI_SITE_MODULEPATH=${EESSI_MODULEPATH/versions/host_injections}
echo "Using ${EESSI_SITE_MODULEPATH} as the site extension directory to be added to MODULEPATH." >> $output
export EESSI_USER_MODULEPATH=${EESSI_MODULEPATH/${EESSI_CVMFS_REPO}/${HOME}\/eessi}
echo "Using ${EESSI_USER_MODULEPATH} as the user extension directory to be added to MODULEPATH." >> $output
else
error "EESSI module path at $EESSI_MODULEPATH not found!"
false
Expand Down

0 comments on commit 98f20cd

Please sign in to comment.