Skip to content

Commit d5f832d

Browse files
committed
Merge branch '2023.06-software.eessi.io' of github-trz:EESSI/software-layer into 2023.06-a64fx-2023a-eb491-apps-pytorch
2 parents 2cd3d36 + d12484b commit d5f832d

File tree

2 files changed

+75
-44
lines changed

2 files changed

+75
-44
lines changed

.github/workflows/test-software.eessi.io.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ jobs:
5252
steps:
5353
- name: Check out software-layer repository
5454
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
55+
with:
56+
fetch-depth: 0 # Fetch all history for all branches and tags
5557

5658
- name: Mount EESSI CernVM-FS pilot repository
5759
uses: cvmfs-contrib/github-action-cvmfs@55899ca74cf78ab874bdf47f5a804e47c198743c # v4.0
@@ -132,3 +134,28 @@ jobs:
132134
echo "captured missing package; test PASSED"
133135
exit 0
134136
fi
137+
138+
- name: Check that EasyBuild hook is up to date
139+
if: ${{ github.event_name == 'pull_request' }}
140+
run: |
141+
FILE="eb_hooks.py"
142+
TEMP_FILE="$(mktemp)"
143+
144+
# Fetch base branch
145+
git fetch origin ${{ github.base_ref }}
146+
147+
# Check if the hooks has changed in the PR
148+
if git diff --name-only origin/${{ github.base_ref }}...HEAD | grep -q "^$FILE$"; then
149+
echo "Hooks changed in PR. Using PR version."
150+
cp "$FILE" "$TEMP_FILE"
151+
else
152+
echo "File not changed in PR. Using default branch version."
153+
git show origin/${{ github.base_ref }}:$FILE > "$TEMP_FILE"
154+
fi
155+
156+
# Compare the hooks to what is shipped in the repository
157+
# (it is overkill, but harmless, to do this for every architecture)
158+
export EESSI_SOFTWARE_SUBDIR_OVERRIDE=${{matrix.EESSI_SOFTWARE_SUBDIR_OVERRIDE}}
159+
source /cvmfs/software.eessi.io/versions/${EESSI_VERSION}/init/bash
160+
module load EESSI-extend
161+
diff "$TEMP_FILE" "$EASYBUILD_HOOKS"

eb_hooks.py

Lines changed: 48 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -965,52 +965,56 @@ def post_postproc_cuda(self, *args, **kwargs):
965965
Remove files from CUDA installation that we are not allowed to ship,
966966
and replace them with a symlink to a corresponding installation under host_injections.
967967
"""
968+
if self.name == 'CUDA':
969+
# This hook only acts on an installation under repositories that _we_ ship (*.eessi.io/versions)
970+
eessi_installation = bool(re.search(EESSI_INSTALLATION_REGEX, self.installdir))
971+
972+
if eessi_installation:
973+
print_msg("Replacing files in CUDA installation that we can not ship with symlinks to host_injections...")
974+
975+
# read CUDA EULA, construct allowlist based on section 2.6 that specifies list of files that can be shipped
976+
eula_path = os.path.join(self.installdir, 'EULA.txt')
977+
relevant_eula_lines = []
978+
with open(eula_path) as infile:
979+
copy = False
980+
for line in infile:
981+
if line.strip() == "2.6. Attachment A":
982+
copy = True
983+
continue
984+
elif line.strip() == "2.7. Attachment B":
985+
copy = False
986+
continue
987+
elif copy:
988+
relevant_eula_lines.append(line)
989+
990+
# create list without file extensions, they're not really needed and they only complicate things
991+
allowlist = ['EULA', 'README']
992+
file_extensions = ['.so', '.a', '.h', '.bc']
993+
for line in relevant_eula_lines:
994+
for word in line.split():
995+
if any(ext in word for ext in file_extensions):
996+
allowlist.append(os.path.splitext(word)[0])
997+
# The EULA of CUDA 12.4 introduced a typo (confirmed by NVIDIA):
998+
# libnvrtx-builtins_static.so should be libnvrtc-builtins_static.so
999+
if 'libnvrtx-builtins_static' in allowlist:
1000+
allowlist.remove('libnvrtx-builtins_static')
1001+
allowlist.append('libnvrtc-builtins_static')
1002+
allowlist = sorted(set(allowlist))
1003+
self.log.info(
1004+
"Allowlist for files in CUDA installation that can be redistributed: " + ', '.join(allowlist)
1005+
)
9681006

969-
# We need to check if we are doing an EESSI-distributed installation
970-
eessi_installation = bool(re.search(EESSI_INSTALLATION_REGEX, self.installdir))
971-
972-
if self.name == 'CUDA' and eessi_installation:
973-
print_msg("Replacing files in CUDA installation that we can not ship with symlinks to host_injections...")
974-
975-
# read CUDA EULA, construct allowlist based on section 2.6 that specifies list of files that can be shipped
976-
eula_path = os.path.join(self.installdir, 'EULA.txt')
977-
relevant_eula_lines = []
978-
with open(eula_path) as infile:
979-
copy = False
980-
for line in infile:
981-
if line.strip() == "2.6. Attachment A":
982-
copy = True
983-
continue
984-
elif line.strip() == "2.7. Attachment B":
985-
copy = False
986-
continue
987-
elif copy:
988-
relevant_eula_lines.append(line)
989-
990-
# create list without file extensions, they're not really needed and they only complicate things
991-
allowlist = ['EULA', 'README']
992-
file_extensions = ['.so', '.a', '.h', '.bc']
993-
for line in relevant_eula_lines:
994-
for word in line.split():
995-
if any(ext in word for ext in file_extensions):
996-
allowlist.append(os.path.splitext(word)[0])
997-
# The EULA of CUDA 12.4 introduced a typo (confirmed by NVIDIA):
998-
# libnvrtx-builtins_static.so should be libnvrtc-builtins_static.so
999-
if 'libnvrtx-builtins_static' in allowlist:
1000-
allowlist.remove('libnvrtx-builtins_static')
1001-
allowlist.append('libnvrtc-builtins_static')
1002-
allowlist = sorted(set(allowlist))
1003-
self.log.info("Allowlist for files in CUDA installation that can be redistributed: " + ', '.join(allowlist))
1004-
1005-
# Do some quick sanity checks for things we should or shouldn't have in the list
1006-
if 'nvcc' in allowlist:
1007-
raise EasyBuildError("Found 'nvcc' in allowlist: %s" % allowlist)
1008-
if 'libcudart' not in allowlist:
1009-
raise EasyBuildError("Did not find 'libcudart' in allowlist: %s" % allowlist)
1007+
# Do some quick sanity checks for things we should or shouldn't have in the list
1008+
if 'nvcc' in allowlist:
1009+
raise EasyBuildError("Found 'nvcc' in allowlist: %s" % allowlist)
1010+
if 'libcudart' not in allowlist:
1011+
raise EasyBuildError("Did not find 'libcudart' in allowlist: %s" % allowlist)
10101012

1011-
# replace files that are not distributable with symlinks into
1012-
# host_injections
1013-
replace_non_distributable_files_with_symlinks(self.log, self.installdir, self.name, allowlist)
1013+
# replace files that are not distributable with symlinks into
1014+
# host_injections
1015+
replace_non_distributable_files_with_symlinks(self.log, self.installdir, self.name, allowlist)
1016+
else:
1017+
print_msg(f"EESSI hook to respect CUDA license not triggered for installation path {self.installdir}")
10141018
else:
10151019
raise EasyBuildError("CUDA-specific hook triggered for non-CUDA easyconfig?!")
10161020

0 commit comments

Comments
 (0)