Skip to content

Commit

Permalink
various changes to address suggestions
Browse files Browse the repository at this point in the history
- EESSI-install-software.sh
  - rearranged setting up build environment and improved comments to make choices more clear
  - moved test if EasyBuild exists into install_cuda_and_libraries.sh, removed unnecessary export of environment variables and clarified comments accordingly
- .../rebuilds/20241112-eb-4.9.4-EESSI-extend.yml
  - removed outdated comments
- load_eessi_extend_module.sh
  - replaced sourcing configure_easybuild with two needed EASYBUILD_ environment settings
- install_cuda_and_libraries.sh
  - removed comment and setting of EESSI_SITE_INSTALL
  - clarified comment when saving MODULEPATH
  - added a check if the required EasyBuild version exists and only if so use it to process the easystack file that required it
  • Loading branch information
truib committed Nov 20, 2024
1 parent 8401bdd commit 8e87c33
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 38 deletions.
39 changes: 13 additions & 26 deletions EESSI-install-software.sh
Original file line number Diff line number Diff line change
Expand Up @@ -231,54 +231,41 @@ 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
# 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
module unload EESSI-extend

# The EESSI-extend module is being loaded (or installed if it doesn't exist yet).
# 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, the script exits if those variables/functions are undefined.
# 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}
# Loading the EESSI-extend module may adjust the value of EASYBUILD_INSTALLPATH,
# e.g., to point to the installation directory for accelerators.
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
# need to ensure that some variables will be available to the script
# TMPDIR, EB, EESSI_VERSION, for EASYBUILD_INSTALLPATH (EESSI_PREFIX,
# EESSI_OS_TYPE, EESSI_SOFTWARE_SUBDIR_OVERRIDE)
export TMPDIR EB EESSI_VERSION EESSI_PREFIX EESSI_OS_TYPE EESSI_SOFTWARE_SUBDIR_OVERRIDE
${EESSI_PREFIX}/scripts/gpu_support/nvidia/install_cuda_and_libraries.sh \
-t ${temp_install_storage} \
--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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,3 @@
# EASYBUILD_CUDA_COMPUTE_CAPABILITIES
easyconfigs:
- EESSI-extend-2023.06-easybuild.eb
# the options are added to load_eessi_extend_module.sh
# - EESSI-extend-2023.06-easybuild.eb:
# options:
# try-amend: keeppreviousinstall=True
4 changes: 2 additions & 2 deletions load_eessi_extend_module.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ else

# source configure_easybuild to use correct eb settings
(
EESSI_MAIN_DIR=$(dirname $(readlink -f $BASH_SOURCE))
source ${EESSI_MAIN_DIR}/configure_easybuild
export EASYBUILD_PREFIX=${TMPDIR}/easybuild
export EASYBUILD_READ_ONLY_INSTALLDIR=1

echo ">> Final installation in ${EASYBUILD_INSTALLPATH}..."
export PATH=${EB_TMPDIR}/bin:${PATH}
Expand Down
16 changes: 10 additions & 6 deletions scripts/gpu_support/nvidia/install_cuda_and_libraries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ done
# Make sure EESSI is initialised
check_eessi_initialised

# Make sure that `EESSI-extend` will install in the site installation path EESSI_SITE_SOFTWARE_PATH
export EESSI_SITE_INSTALL=1
echo "EESSI_SITE_SOFTWARE_PATH=${EESSI_SITE_SOFTWARE_PATH}"

# we need a directory we can use for temporary storage
if [[ -z "${TEMP_DIR}" ]]; then
tmpdir=$(mktemp -d)
Expand All @@ -93,7 +89,7 @@ else
fi
echo "Created temporary directory '${tmpdir}'"

# use EESSI_SITE_SOFTWARE_PATH/.modules/all as MODULEPATH
# Store MODULEPATH so it can be restored at the end of each loop iteration
SAVE_MODULEPATH=${MODULEPATH}

for EASYSTACK_FILE in ${TOPDIR}/easystacks/eessi-*CUDA*.yml; do
Expand All @@ -103,8 +99,16 @@ for EASYSTACK_FILE in ${TOPDIR}/easystacks/eessi-*CUDA*.yml; do
eb_version=$(echo ${EASYSTACK_FILE} | sed 's/.*eb-\([0-9.]*\).*/\1/g')

# Load EasyBuild version for this easystack file _before_ loading EESSI-extend
module avail EasyBuild
module_avail_out=${tmpdir}/ml.out
module avail 2>&1 | grep EasyBuild/${eb_version} &> ${module_avail_out}
if [[ $? -eq 0 ]]; then
echo_green ">> Found an EasyBuild/${eb_version} module"
else
echo_yellow ">> No EasyBuild/${eb_version} module found: skipping step to install easystack file ${easystack_file} (see output in ${module_avail_out})"
continue
fi
module load EasyBuild/${eb_version}

# Make sure EESSI-extend does a site install here
# We need to reload it with the current environment variables set
unset EESSI_CVMFS_INSTALL
Expand Down

0 comments on commit 8e87c33

Please sign in to comment.