Skip to content

Commit 5c7e69d

Browse files
committed
Merge branch 'main' into utils_function_nvidia
2 parents d9508c1 + 772e408 commit 5c7e69d

File tree

3 files changed

+93
-21
lines changed

3 files changed

+93
-21
lines changed

.github/workflows/tests_scripts.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ jobs:
4545
4646
- name: test load_easybuild_module.sh script
4747
run: |
48+
export SINGULARITY_CACHEDIR=$PWD
4849
# bind current directory into container as /software-layer-scripts
4950
export SINGULARITY_BIND="${PWD}:/software-layer-scripts"
5051
@@ -91,6 +92,7 @@ jobs:
9192
9293
- name: test install_software_layer.sh script
9394
run: |
95+
export SINGULARITY_CACHEDIR=$PWD
9496
# bind current directory into container as /software-layer-scripts
9597
export SINGULARITY_BIND="${PWD}:/software-layer-scripts"
9698
# force using x86_64/generic, to avoid triggering an installation from scratch
@@ -105,6 +107,7 @@ jobs:
105107
106108
- name: test create_directory_tarballs.sh script
107109
run: |
110+
export SINGULARITY_CACHEDIR=$PWD
108111
# bind current directory into container as /software-layer-scripts
109112
export SINGULARITY_BIND="${PWD}:/software-layer-scripts"
110113
@@ -119,6 +122,7 @@ jobs:
119122
120123
- name: test create_lmodsitepackage.py script
121124
run: |
125+
export SINGULARITY_CACHEDIR=$PWD
122126
# bind current directory into container as /software-layer-scripts
123127
export SINGULARITY_BIND="${PWD}:/software-layer-scripts"
124128
@@ -140,3 +144,22 @@ jobs:
140144
for pattern in "^Site Pkg location.*/software-layer-scripts/.lmod/SitePackage.lua" "LMOD_SITEPACKAGE_LOCATION.*/software-layer-scripts/.lmod/SitePackage.lua"; do
141145
grep "${pattern}" ${out} || (echo "Pattern '${pattern}' not found in output!" && exit 1)
142146
done
147+
148+
- name: Mount EESSI CernVM-FS repository
149+
uses: eessi/github-action-eessi@v3
150+
with:
151+
eessi_stack_version: ${{matrix.EESSI_VERSION}}
152+
use_eessi_module: true
153+
154+
- name: Verify that mounted repositories are passed through directly
155+
run: |
156+
export SINGULARITY_CACHEDIR=$PWD
157+
# run wrapper script + capture & check output
158+
export SINGULARITY_BIND="${PWD}:/software-layer-scripts"
159+
# make sure that correct EESSI version is used (required because default is a placeholder version)
160+
export EESSI_VERSION_OVERRIDE="${{matrix.EESSI_VERSION}}"
161+
162+
out="${PWD}/eb-${EB_VERSION}.out"
163+
./eessi_container.sh --access rw --mode run --verbose /software-layer-scripts/run_in_compat_layer_env.sh ls 2>&1 | tee ${out}
164+
echo $(grep "SINGULARITY_BIND" ${out})
165+
grep "SINGULARITY_BIND" ${out} | grep "software.eessi.io" || (echo "software.eessi.io did not seem to be bind mounted!" && exit 1)

eessi_container.sh

Lines changed: 63 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ display_help() {
9797
echo " container; can be given multiple times [default: not set]"
9898
echo " -r | --repository CFG - configuration file or identifier defining the"
9999
echo " repository to use; can be given multiple times;"
100-
echo " CFG may include a suffix ',access={ro,rw}' to"
101-
echo " overwrite the global access mode for this repository"
100+
echo " CFG may include suffixes ',access={ro,rw},mode={bind,fuse}' to"
101+
echo " overwrite the global access and/or mount mode for this repository"
102102
echo " [default: software.eessi.io via CVMFS config available"
103103
echo " via default container, see --container]"
104104
echo " -u | --resume DIR/TGZ - resume a previous run from a directory or tarball,"
@@ -747,7 +747,11 @@ declare -a EESSI_FUSE_MOUNTS=()
747747
# mount cvmfs-config repo (to get access to EESSI repositories such as software.eessi.io) unless env var
748748
# EESSI_DO_NOT_MOUNT_CVMFS_CONFIG_CERN_CH is defined
749749
if [ -z ${EESSI_DO_NOT_MOUNT_CVMFS_CONFIG_CERN_CH+x} ]; then
750-
EESSI_FUSE_MOUNTS+=("--fusemount" "container:cvmfs2 cvmfs-config.cern.ch /cvmfs/cvmfs-config.cern.ch")
750+
if [[ -x $(command -v cvmfs_config) ]] && cvmfs_config probe cvmfs-config.cern.ch >& /dev/null; then
751+
BIND_PATHS="${BIND_PATHS},/cvmfs/cvmfs-config.cern.ch"
752+
else
753+
EESSI_FUSE_MOUNTS+=("--fusemount" "container:cvmfs2 cvmfs-config.cern.ch /cvmfs/cvmfs-config.cern.ch")
754+
fi
751755
fi
752756

753757

@@ -756,25 +760,54 @@ for cvmfs_repo in "${REPOSITORIES[@]}"
756760
do
757761
unset cfg_repo_id
758762
[[ ${VERBOSE} -eq 1 ]] && echo "add fusemount options for CVMFS repo '${cvmfs_repo}'"
759-
# split into name and access mode if ',access=' in $cvmfs_repo
760-
if [[ ${cvmfs_repo} == *",access="* ]] ; then
761-
cvmfs_repo_name=${cvmfs_repo/,access=*/} # remove access mode specification
762-
cvmfs_repo_access=${cvmfs_repo/*,access=/} # remove repo name part
763-
else
764-
cvmfs_repo_name="${cvmfs_repo}"
765-
cvmfs_repo_access="${ACCESS}" # use globally defined access mode
766-
fi
763+
# split into name, access mode, and mount mode
764+
readarray -td, cvmfs_repo_args <<<"$cvmfs_repo"
765+
cvmfs_repo_name=$(sed -e 's/\\n//g' <<< "${cvmfs_repo_args[0]}")
766+
cvmfs_repo_access="${ACCESS}" # initialize to the default access mode
767+
for arg in ${cvmfs_repo_args[@]:1}; do
768+
if [[ $arg == "access="* ]]; then
769+
cvmfs_repo_access=${arg/access=}
770+
fi
771+
if [[ $arg == "mount="* ]]; then
772+
cvmfs_repo_mount=${arg/mount=}
773+
# check if the specified mount mode is a valid one
774+
if [[ ${cvmfs_repo_mount} != "bind" ]] && [[ ${cvmfs_repo_mount} != "fuse" ]]; then
775+
echo -e "ERROR: mount mode '${cvmfs_repo_mount}' for CVMFS repository\n '${cvmfs_repo_name}' is not known"
776+
exit ${REPOSITORY_ERROR_EXITCODE}
777+
fi
778+
fi
779+
done
780+
767781
# obtain cvmfs_repo_name from EESSI_REPOS_CFG_FILE if cvmfs_repo is in cfg_cvmfs_repos
768782
if [[ ${cfg_cvmfs_repos[${cvmfs_repo_name}]} ]]; then
769783
[[ ${VERBOSE} -eq 1 ]] && echo "repo '${cvmfs_repo_name}' is not an EESSI CVMFS repository..."
770784
# cvmfs_repo_name is actually a repository ID, use that to obtain
771785
# the actual name from the EESSI_REPOS_CFG_FILE
772786
cfg_repo_id=${cvmfs_repo_name}
787+
echo "bob $cfg_repo_id"
773788
cvmfs_repo_name=$(cfg_get_value ${cfg_repo_id} "repo_name")
789+
echo $cvmfs_repo_name
774790
fi
775791
# remove project subdir in container
776792
cvmfs_repo_name=${cvmfs_repo_name%"/${EESSI_DEV_PROJECT}"}
777793

794+
# if a mount mode was not specified, we use a bind mount if the repository is available on the host,
795+
# and otherwise we use a fuse mount
796+
if [[ -z ${cvmfs_repo_mount} ]]; then
797+
cvmfs_repo_mount="fuse"
798+
if [[ -x $(command -v cvmfs_config) ]] && cvmfs_config probe ${cvmfs_repo_name} >& /dev/null; then
799+
cvmfs_repo_mount="bind"
800+
fi
801+
fi
802+
[[ ${VERBOSE} -eq 1 ]] && echo "Using a ${cvmfs_repo_mount} mount for /cvmfs/${cvmfs_repo_name}"
803+
# if a bind mount was requested, check if the repository is really available on the host
804+
if [[ ${cvmfs_repo_mount} == "bind" ]]; then
805+
if [[ ! -x $(command -v cvmfs_config) ]] || ! cvmfs_config probe ${cvmfs_repo_name} >& /dev/null; then
806+
echo -e "ERROR: bind mount requested for CVMFS repository\n '${cvmfs_repo_name}', but it cannot be probed on the host"
807+
exit ${REPOSITORY_ERROR_EXITCODE}
808+
fi
809+
fi
810+
778811
# always create a directory for the repository (e.g., to store settings, ...)
779812
mkdir -p ${EESSI_TMPDIR}/${cvmfs_repo_name}
780813

@@ -795,9 +828,12 @@ do
795828
echo " session. Will use it as left-most directory in 'lowerdir' argument for fuse-overlayfs."
796829

797830
# make the target CernVM-FS repository available under /cvmfs_ro
798-
export EESSI_READONLY="container:cvmfs2 ${cvmfs_repo_name} /cvmfs_ro/${cvmfs_repo_name}"
799-
800-
EESSI_FUSE_MOUNTS+=("--fusemount" "${EESSI_READONLY}")
831+
if [[ ${cvmfs_repo_mount} == "fuse" ]]; then
832+
export EESSI_READONLY="container:cvmfs2 ${cvmfs_repo_name} /cvmfs_ro/${cvmfs_repo_name}"
833+
EESSI_FUSE_MOUNTS+=("--fusemount" "${EESSI_READONLY}")
834+
elif [[ ${cvmfs_repo_mount} == "bind" ]]; then
835+
BIND_PATHS="/cvmfs/${cvmfs_repo_name}:/cvmfs_ro/${cvmfs_repo_name},${BIND_PATHS}"
836+
fi
801837

802838
# now, put the overlay-upper read-only on top of the repo and make it available under the usual prefix /cvmfs
803839
if [[ "${OVERLAY_TOOL}" == "fuse-overlayfs" ]]; then
@@ -827,10 +863,14 @@ do
827863
# basic "ro" access that doesn't require any fuseoverlay-fs
828864
echo "Mounting '${cvmfs_repo_name}' 'read-only' without fuse-overlayfs."
829865

830-
export EESSI_READONLY="container:cvmfs2 ${cvmfs_repo_name} /cvmfs/${cvmfs_repo_name}"
866+
if [[ ${cvmfs_repo_mount} == "fuse" ]]; then
867+
export EESSI_READONLY="container:cvmfs2 ${cvmfs_repo_name} /cvmfs/${cvmfs_repo_name}"
868+
EESSI_FUSE_MOUNTS+=("--fusemount" "${EESSI_READONLY}")
869+
export EESSI_FUSE_MOUNTS
870+
elif [[ ${cvmfs_repo_mount} == "bind" ]]; then
871+
BIND_PATHS="/cvmfs/${cvmfs_repo_name},${BIND_PATHS}"
872+
fi
831873

832-
EESSI_FUSE_MOUNTS+=("--fusemount" "${EESSI_READONLY}")
833-
export EESSI_FUSE_MOUNTS
834874
fi
835875
elif [[ ${cvmfs_repo_access} == "rw" ]] ; then
836876
# use repo-specific overlay directories
@@ -840,9 +880,12 @@ do
840880
[[ ${VERBOSE} -eq 1 ]] && echo -e "TMP directory contents:\n$(ls -l ${EESSI_TMPDIR})"
841881

842882
# set environment variables for fuse mounts in Singularity container
843-
export EESSI_READONLY="container:cvmfs2 ${cvmfs_repo_name} /cvmfs_ro/${cvmfs_repo_name}"
844-
845-
EESSI_FUSE_MOUNTS+=("--fusemount" "${EESSI_READONLY}")
883+
if [[ ${cvmfs_repo_mount} == "fuse" ]]; then
884+
export EESSI_READONLY="container:cvmfs2 ${cvmfs_repo_name} /cvmfs_ro/${cvmfs_repo_name}"
885+
EESSI_FUSE_MOUNTS+=("--fusemount" "${EESSI_READONLY}")
886+
elif [[ ${cvmfs_repo_mount} == "bind" ]]; then
887+
BIND_PATHS="/cvmfs/${cvmfs_repo_name}:/cvmfs_ro/${cvmfs_repo_name},${BIND_PATHS}"
888+
fi
846889

847890
if [[ "${OVERLAY_TOOL}" == "fuse-overlayfs" ]]; then
848891
EESSI_WRITABLE_OVERLAY="container:fuse-overlayfs"

scripts/gpu_support/nvidia/install_cuda_and_libraries.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,16 @@ for EASYSTACK_FILE in ${TOPDIR}/easystacks/eessi-*CUDA*.yml; do
130130
module --ignore_cache load EESSI-extend/${EESSI_EXTEND_VERSION}
131131
unset EESSI_EXTEND_VERSION
132132

133+
# If there is a GPU on the node, the installation path will by default have an
134+
# accelerator subdirectory. For CUDA and cu*, these are binary installations and
135+
# don't care about the target compute capability. Our hooks are aware of this and
136+
# therefore expect CUDA to be available under EESSI_SITE_SOFTWARE_PATH
137+
export EASYBUILD_INSTALLPATH=$EESSI_SITE_SOFTWARE_PATH
138+
133139
# Install modules in hidden .modules dir to keep track of what was installed before
134140
# (this action is temporary, and we do not call Lmod again within the current shell context, but in EasyBuild
135141
# subshells, so loaded modules are not automatically unloaded)
136-
MODULEPATH=${EESSI_SITE_SOFTWARE_PATH}/.modules/all
142+
MODULEPATH=${EASYBUILD_INSTALLPATH}/.modules/all
137143
echo "set MODULEPATH=${MODULEPATH}"
138144

139145
# We don't want hooks used in this install, we need vanilla installations

0 commit comments

Comments
 (0)