-
Notifications
You must be signed in to change notification settings - Fork 64
{2023.06} Rebuild EESSI-extend
module to use $EESSI_ACCELERATOR_TARGET
#810
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ocaisa
merged 42 commits into
EESSI:2023.06-software.eessi.io
from
trz42:2023.06-software.eessi.io-use-accel-target-with-eessi-extend
Nov 21, 2024
Merged
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
a122c6e
adjust installpath if EESSI_ACCELERATOR_TARGET is set
truib 7cead8e
add rebuild easystack for EESSI-extend
truib 58c1da5
adding changes from PR #812 to validate them here
truib 679d180
use script that loads and installs EESSI-extend
truib f9243d8
facilitate a bit debugging
truib 68a882f
fix module command arg typo
truib 37c1e9c
run module avail with --ignore_cache
truib a83cde8
use previous overlay-upper dir(s) as left-most lowerdirs
truib 16dce19
use alternative approach to remove software to be rebuilt
truib bcb0b65
fix syntax error
truib 0fb455d
remove script is not run by root anymore
truib 75e9c35
add debug info
truib 5ba88d3
set 777 perms
truib 47fe73c
add more debug info
truib acf987c
add even more debug info
truib 32e6d69
add lower dirs to build step
truib afa1356
limit perm to 700
truib 9eebad7
source configure_easybuild and run in subshell
truib 2af57ee
set 770 perms
truib 2184b30
alternative approach to remove files/directories; one-by-one in depth…
truib 2438c47
pre-package hook for EESSI-extend that stats all files/dirs in instal…
truib 29004ce
fix syntax error
truib cf076be
fix another code error
truib 60b3f31
print file permissions
truib ace7d7e
convert permissions to octal value
truib f760fd2
show file creation time too
truib 7315145
disable hook, use recursive rm and do ls on specific directory
truib ea6a842
recreate 'installdir/easybuild' and use keeppreviousinstall option
truib e5d3692
remove using keeppreviousinstall
truib 0fe18c2
show contents and recreate specific/problematic directory
truib ddfec84
only make directories and module file writable
truib c7916ec
remove hooks
truib 1c24b7a
clean up lower dir changes
truib 5fd8fd7
need to create directory for module file in lower_dirs
truib f7baeaf
add try-amend keeppreviousinstal=True option in easystack
truib 3db71ef
need keeppreviousinstall already in load_eessi_... script
truib c56712e
revert to using standard method (fakeroot) to remove existing install…
truib d1264e1
first load/install EESSI-extend module, then install CUDA and libraries
truib d226151
Merge branch '2023.06-software.eessi.io' of github-trz:EESSI/software…
truib fedfd77
tweak script to just load EESSI-extend, and exit if it couldn't be lo…
truib 8401bdd
Merge branch '2023.06-software.eessi.io' of github-trz:EESSI/software…
truib 8e87c33
various changes to address suggestions
truib File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -229,22 +229,34 @@ if [[ "${EESSI_CVMFS_REPO}" != /cvmfs/dev.eessi.io ]]; then | |||||||||
${TOPDIR}/install_scripts.sh --prefix ${EESSI_PREFIX} | ||||||||||
fi | ||||||||||
|
||||||||||
echo ">> Configuring EasyBuild..." | ||||||||||
|
||||||||||
# Make sure EESSI-extend is not loaded, and configure location variables for a | ||||||||||
# CVMFS installation | ||||||||||
module unload EESSI-extend | ||||||||||
unset EESSI_USER_INSTALL | ||||||||||
unset EESSI_PROJECT_INSTALL | ||||||||||
unset EESSI_SITE_INSTALL | ||||||||||
export EESSI_CVMFS_INSTALL=1 | ||||||||||
|
||||||||||
# We now run 'source load_eessi_extend_module.sh' to load or install and load the | ||||||||||
# EESSI-extend module which sets up all build environment settings. | ||||||||||
# The script requires the EESSI_VERSION given as argument, a couple of | ||||||||||
# environment variables set (TMPDIR, EB and EASYBUILD_INSTALLPATH) and the | ||||||||||
# function check_exit_code defined. | ||||||||||
# NOTE 1, the script exits if those variables/functions are undefined. | ||||||||||
# NOTE 2, loading the EESSI-extend module may adjust the value of EASYBUILD_INSTALLPATH, | ||||||||||
# e.g., to point to the installation directory for accelerators. | ||||||||||
# NOTE 3, we have to set a default for EASYBUILD_INSTALLPATH here in cases the | ||||||||||
# EESSI-extend module itself needs to be installed. | ||||||||||
export EASYBUILD_INSTALLPATH=${EESSI_PREFIX}/software/${EESSI_OS_TYPE}/${EESSI_SOFTWARE_SUBDIR_OVERRIDE} | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
source load_eessi_extend_module.sh ${EESSI_VERSION} | ||||||||||
|
||||||||||
# Install full CUDA SDK and cu* libraries in host_injections | ||||||||||
# Hardcode this for now, see if it works | ||||||||||
# TODO: We should make a nice yaml and loop over all CUDA versions in that yaml to figure out what to install | ||||||||||
# Allow skipping CUDA SDK install in e.g. CI environments | ||||||||||
# The install_cuda... script uses EasyBuild. So, we need to check if we have EB | ||||||||||
# or skip this step. | ||||||||||
echo "Going to install full CUDA SDK and cu* libraries under host_injections if necessary" | ||||||||||
module_avail_out=$TMPDIR/ml.out | ||||||||||
module avail 2>&1 | grep EasyBuild &> ${module_avail_out} | ||||||||||
if [[ $? -eq 0 ]]; then | ||||||||||
echo_green ">> Found an EasyBuild module" | ||||||||||
else | ||||||||||
echo_yellow ">> No EasyBuild module found: skipping step to install CUDA (see output in ${module_avail_out})" | ||||||||||
export skip_cuda_install=True | ||||||||||
fi | ||||||||||
|
||||||||||
temp_install_storage=${TMPDIR}/temp_install_storage | ||||||||||
mkdir -p ${temp_install_storage} | ||||||||||
if [ -z "${skip_cuda_install}" ] || [ ! "${skip_cuda_install}" ]; then | ||||||||||
|
@@ -253,7 +265,7 @@ if [ -z "${skip_cuda_install}" ] || [ ! "${skip_cuda_install}" ]; then | |||||||||
--accept-cuda-eula \ | ||||||||||
--accept-cudnn-eula | ||||||||||
else | ||||||||||
echo "Skipping installation of CUDA SDK and cu* libraries in host_injections, since the --skip-cuda-install flag was passed OR no EasyBuild module was found" | ||||||||||
echo "Skipping installation of CUDA SDK and cu* libraries in host_injections, since the --skip-cuda-install flag was passed" | ||||||||||
fi | ||||||||||
|
||||||||||
# Install NVIDIA drivers in host_injections (if they exist) | ||||||||||
|
@@ -263,18 +275,6 @@ if command_exists "nvidia-smi"; then | |||||||||
fi | ||||||||||
|
||||||||||
|
||||||||||
echo ">> Configuring EasyBuild..." | ||||||||||
|
||||||||||
# Make sure that we use the EESSI_CVMFS_INSTALL | ||||||||||
# Since the path is set when loading EESSI-extend, we reload it to make sure it works - even if it is already loaded | ||||||||||
# Note we need to do this after running install_cuda_and_libraries, since that does installations in the EESSI_SITE_INSTALL | ||||||||||
unset EESSI_USER_INSTALL | ||||||||||
unset EESSI_PROJECT_INSTALL | ||||||||||
unset EESSI_SITE_INSTALL | ||||||||||
export EESSI_CVMFS_INSTALL=1 | ||||||||||
module unload EESSI-extend | ||||||||||
module load EESSI-extend/${EESSI_VERSION}-easybuild | ||||||||||
|
||||||||||
if [ ! -z "${shared_fs_path}" ]; then | ||||||||||
shared_eb_sourcepath=${shared_fs_path}/easybuild/sources | ||||||||||
echo ">> Using ${shared_eb_sourcepath} as shared EasyBuild source path" | ||||||||||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
easystacks/software.eessi.io/2023.06/rebuilds/20241112-eb-4.9.4-EESSI-extend.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# 2024.11.12 | ||
# for installations under /cvmfs, if EESSI_ACCELERATOR_TARGET is set, | ||
# EESSI-extend should adjust EASYBUILD_INSTALLPATH and set | ||
# EASYBUILD_CUDA_COMPUTE_CAPABILITIES | ||
easyconfigs: | ||
- EESSI-extend-2023.06-easybuild.eb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
# Script to load the environment module for EESSI-extend. | ||
# If that module is not available yet, a specific version will be installed using the latest EasyBuild. | ||
# | ||
# This script must be sourced, since it makes changes in the current environment, like loading an EESSI-extend module. | ||
# | ||
# Assumptions (if one is not satisfied the script prints a message and exits) | ||
# - EESSI version is given as first argument | ||
# - TMPDIR is set | ||
# - EB is set | ||
# - EASYBUILD_INSTALLPATH needs to be set | ||
# - Function check_exit_code is defined; | ||
# scripts/utils.sh in EESSI/software-layer repository defines this function, hence | ||
# scripts/utils.sh shall be sourced before this script is run | ||
# | ||
# This script is part of the EESSI software layer, see | ||
# https://github.com/EESSI/software-layer.git | ||
# | ||
# author: Kenneth Hoste (@boegel, HPC-UGent) | ||
# author: Alan O'Cais (@ocaisa, CECAM) | ||
# author: Thomas Roeblitz (@trz42, University of Bergen) | ||
# | ||
# license: GPLv2 | ||
# | ||
# | ||
set -o pipefail | ||
|
||
# this script is *sourced*, not executed, so can't rely on $0 to determine path to self or script name | ||
# $BASH_SOURCE points to correct path or script name, see also http://mywiki.wooledge.org/BashFAQ/028 | ||
if [ $# -ne 1 ]; then | ||
echo "Usage: source ${BASH_SOURCE} <EESSI-extend version>" >&2 | ||
exit 1 | ||
fi | ||
|
||
EESSI_EXTEND_VERSION="${1}-easybuild" | ||
|
||
# make sure that environment variables that we expect to be set are indeed set | ||
if [ -z "${TMPDIR}" ]; then | ||
echo "\$TMPDIR is not set; exiting" >&2 | ||
exit 2 | ||
fi | ||
|
||
# ${EB} is used to specify which 'eb' command should be used; | ||
# can potentially be more than just 'eb', for example when using 'eb --optarch=GENERIC' | ||
if [ -z "${EB}" ]; then | ||
echo "\$EB is not set; exiting" >&2 | ||
exit 2 | ||
fi | ||
|
||
# ${EASYBUILD_INSTALLPATH} points to the installation path and needs to be set | ||
if [ -z "${EASYBUILD_INSTALLPATH}" ]; then | ||
echo "\$EASYBUILD_INSTALLPATH is not set; exiting" >&2 | ||
exit 2 | ||
fi | ||
|
||
# make sure that utility functions are defined (cfr. scripts/utils.sh script in EESSI/software-layer repo) | ||
type check_exit_code | ||
if [ $? -ne 0 ]; then | ||
echo "check_exit_code function is not defined; exiting" >&2 | ||
exit 3 | ||
fi | ||
|
||
echo ">> Checking for EESSI-extend module..." | ||
|
||
ml_av_eessi_extend_out=${TMPDIR}/ml_av_eessi_extend.out | ||
# need to use --ignore_cache to avoid the case that the module was removed (to be | ||
# rebuilt) but it is still in the cache | ||
module --ignore_cache avail 2>&1 | grep -i EESSI-extend/${EESSI_EXTEND_VERSION} &> ${ml_av_eessi_extend_out} | ||
|
||
if [[ $? -eq 0 ]]; then | ||
echo_green ">> Module for EESSI-extend/${EESSI_EXTEND_VERSION} found!" | ||
else | ||
echo_yellow ">> No module yet for EESSI-extend/${EESSI_EXTEND_VERSION}, installing it..." | ||
|
||
EB_TMPDIR=${TMPDIR}/ebtmp | ||
echo ">> Using temporary installation of EasyBuild (in ${EB_TMPDIR})..." | ||
pip_install_out=${TMPDIR}/pip_install.out | ||
pip3 install --prefix ${EB_TMPDIR} easybuild &> ${pip_install_out} | ||
|
||
# keep track of original $PATH and $PYTHONPATH values, so we can restore them | ||
ORIG_PATH=${PATH} | ||
ORIG_PYTHONPATH=${PYTHONPATH} | ||
|
||
# source configure_easybuild to use correct eb settings | ||
( | ||
export EASYBUILD_PREFIX=${TMPDIR}/easybuild | ||
export EASYBUILD_READ_ONLY_INSTALLDIR=1 | ||
|
||
echo ">> Final installation in ${EASYBUILD_INSTALLPATH}..." | ||
export PATH=${EB_TMPDIR}/bin:${PATH} | ||
export PYTHONPATH=$(ls -d ${EB_TMPDIR}/lib/python*/site-packages):${PYTHONPATH} | ||
eb_install_out=${TMPDIR}/eb_install.out | ||
ok_msg="EESSI-extend/${EESSI_EXTEND_VERSION} installed, let's go!" | ||
fail_msg="Installing EESSI-extend/${EESSI_EXTEND_VERSION} failed, that's not good... (output: ${eb_install_out})" | ||
# while always adding --try-amend=keep... may do no harm, we could make | ||
# an attempt to figure out if it is needed, e.g., when we are rebuilding | ||
${EB} "EESSI-extend-${EESSI_EXTEND_VERSION}.eb" --try-amend=keeppreviousinstall=True 2>&1 | tee ${eb_install_out} | ||
check_exit_code $? "${ok_msg}" "${fail_msg}" | ||
) | ||
|
||
# restore origin $PATH and $PYTHONPATH values, and clean up environment variables that are no longer needed | ||
export PATH=${ORIG_PATH} | ||
export PYTHONPATH=${ORIG_PYTHONPATH} | ||
unset EB_TMPDIR ORIG_PATH ORIG_PYTHONPATH | ||
|
||
module --ignore_cache avail EESSI-extend/${EESSI_EXTEND_VERSION} &> ${ml_av_eessi_extend_out} | ||
if [[ $? -eq 0 ]]; then | ||
echo_green ">> EESSI-extend/${EESSI_EXTEND_VERSION} module installed!" | ||
else | ||
fatal_error "EESSI-extend/${EESSI_EXTEND_VERSION} module failed to install?! (output of 'pip install' in ${pip_install_out}, output of 'eb' in ${eb_install_out}, output of 'module avail EESSI-extend' in ${ml_av_eessi_extend_out})" | ||
fi | ||
fi | ||
|
||
echo ">> Loading EESSI-extend/${EESSI_EXTEND_VERSION} module..." | ||
module --ignore_cache load EESSI-extend/${EESSI_EXTEND_VERSION} | ||
|
||
unset EESSI_EXTEND_VERSION |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.