Skip to content

Commit e3f746f

Browse files
author
Caspar van Leeuwen
committed
Change host injections location for binary non-redistributable files to e.g. /cvmfs/software.eessi.io/host_injections/x86_64, i.e. only include the CPU family in the prefix, not microarchitecture or accelerator architecture. Since these are binary installs, we don't need multiple copies, and requiring site admins to run the install scripts once per micro-architecture is just annoying (and requires more storage)
1 parent b63778e commit e3f746f

2 files changed

Lines changed: 26 additions & 14 deletions

File tree

eb_hooks.py

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,7 +1199,7 @@ def post_postproc_cuda(self, *args, **kwargs):
11991199

12001200
# replace files that are not distributable with symlinks into
12011201
# host_injections
1202-
replace_non_distributable_files_with_symlinks(self.log, self.installdir, self.name, allowlist)
1202+
replace_binary_non_distributable_files_with_symlinks(self.log, self.installdir, self.name, allowlist)
12031203
else:
12041204
print_msg(f"EESSI hook to respect CUDA license not triggered for installation path {self.installdir}")
12051205
else:
@@ -1249,16 +1249,19 @@ def post_postproc_cudnn(self, *args, **kwargs):
12491249

12501250
# replace files that are not distributable with symlinks into
12511251
# host_injections
1252-
replace_non_distributable_files_with_symlinks(self.log, self.installdir, self.name, allowlist)
1252+
replace_binary_non_distributable_files_with_symlinks(self.log, self.installdir, self.name, allowlist)
12531253
else:
12541254
print_msg(f"EESSI hook to respect cuDDN license not triggered for installation path {self.installdir}")
12551255
else:
12561256
raise EasyBuildError("cuDNN-specific hook triggered for non-cuDNN easyconfig?!")
12571257

12581258

1259-
def replace_non_distributable_files_with_symlinks(log, install_dir, pkg_name, allowlist):
1259+
def replace_binary_non_distributable_files_with_symlinks(log, install_dir, pkg_name, allowlist):
12601260
"""
12611261
Replace files that cannot be distributed with symlinks into host_injections
1262+
Since these are binary files, only the CPU family will be included in the prefix,
1263+
no microarchitecture or accelerator architecture will be included. For example,
1264+
/cvmfs/software.eessi.io/host_injections/x86_64/suffix/to/actual/file
12621265
"""
12631266
# Different packages use different ways to specify which files or file
12641267
# 'types' may be redistributed. For CUDA, the 'EULA.txt' lists full file
@@ -1310,19 +1313,28 @@ def replace_non_distributable_files_with_symlinks(log, install_dir, pkg_name, al
13101313
# duplication from under host_injections (symlink to a single CUDA or cu* library
13111314
# installation for all compute capabilities)
13121315
accel_subdir = get_eessi_envvar("EESSI_ACCELERATOR_TARGET")
1313-
software_subdir = get_eessi_envvar("EESSI_SOFTWARE_SUBDIR")
1314-
cpu_family = get_eessi_envvar("EESSI_CPU_FAMILY")
13151316
# If accel_subdir is defined, remove it from the full path
13161317
# After removal of accel_subdir, host_inj_path will be something like
13171318
# /cvmfs/software.eessi.io/host_injections/.../x86_64/amd/zen4/.../CUDA/bin/nvcc
13181319
if accel_subdir:
13191320
host_inj_path = host_inj_path.replace(accel_subdir, '')
1320-
# /cvmfs/software.eessi.io/host_injections/.../x86_64/amd/zen4/.../CUDA/bin/nvcc
1321-
# If software_subdir is defined (it should always be...), replace it by only the cpu_family
1322-
# After this substitution, host_inj_path will be something like
1323-
# /cvmfs/software.eessi.io/host_injections/.../x86_64/.../CUDA/bin/nvcc
1324-
if software_subdir and cpu_family:
1325-
host_inj_path = host_inj_path.replace(software_subdir, cpu_family)
1321+
software_subdir = get_eessi_envvar("EESSI_SOFTWARE_SUBDIR")
1322+
cpu_family = get_eessi_envvar("EESSI_CPU_FAMILY")
1323+
os_type = get_eessi_envvar("EESSI_OS_TYPE")
1324+
eessi_version = get_eessi_envvar("EESSI_VERSION")
1325+
if software_subdir and cpu_family and os_type and eessi_version:
1326+
# Compose the string to be removed:
1327+
partial_path = f"{eessi_version}/software/{os_type}/{software_subdir}"
1328+
# After this, host_inj_path will be e.g.
1329+
# /cvmfs/software.eessi.io/host_injections/x86_64/software/CUDA/bin/nvcc
1330+
host_inj_path = host_inj_path.replace(partial_path, cpu_family)
1331+
else:
1332+
msg = "Failed to construct path to symlink for file (%s). All of the following values "
1333+
msg += "have to be defined: EESSI_SOFTWARE_SUBDIR='%s', EESSI_CPU_FAMILY='%s', "
1334+
msg += "EESSI_OS_TYPE='%s', EESSI_VERSION='%s'. Failed to replace non-redistributable file "
1335+
msg += "with symlink, aborting..."
1336+
raise EasyBuildError(msg, full_path, software_subdir, cpu_family, os_type, eessi_version)
1337+
13261338
# make sure source and target of symlink are not the same
13271339
if full_path == host_inj_path:
13281340
raise EasyBuildError("Source (%s) and target (%s) are the same location, are you sure you "

scripts/gpu_support/nvidia/install_cuda_and_libraries.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,10 @@ for EASYSTACK_FILE in ${TOPDIR}/easystacks/eessi-*CUDA*.yml; do
137137
# something like EESSI_SITE_SOFTWARE_PATH, but then with the CPU micro-architecture
138138
# stripped
139139
# This sed command will capture everything from the EESSI_SITE_SOFTWARE_PATH up until
140-
# the EESSI_SOFTWARE_SUBDIR in a capture group. It will the replace that with the content
140+
# the EESSI_VERSION in a capture group. It will the replace that with the content
141141
# of the capture group and then have the EESSI_CPU_FAMILY appended
142-
# Thus EESSI_SITE_CPU_FAMILY_PATH is something like /cvmfs/software.eessi.io/host_injections/.../x86_64
143-
EESSI_SITE_CPU_FAMILY_PATH=$(echo "$EESSI_SITE_SOFTWARE_PATH" | sed 's|\(.*\)'"$EESSI_SOFTWARE_SUBDIR"'|\1'"$EESSI_CPU_FAMILY"'|')
142+
# Thus EESSI_SITE_CPU_FAMILY_PATH is then something like /cvmfs/software.eessi.io/host_injections/x86_64
143+
EESSI_SITE_CPU_FAMILY_PATH=$(echo "$EESSI_SITE_SOFTWARE_PATH" | sed 's|\(.*\)'"$EESSI_VERSION"/software/"$EESSI_OS_TYPE"/"$EESSI_SOFTWARE_SUBDIR"'|\1'"$EESSI_CPU_FAMILY"'|')
144144
export EASYBUILD_INSTALLPATH=$EESSI_SITE_CPU_FAMILY_PATH
145145

146146
# Install modules in hidden .modules dir to keep track of what was installed before

0 commit comments

Comments
 (0)