Skip to content

Commit

Permalink
add post_sanitycheck_cutensor
Browse files Browse the repository at this point in the history
  • Loading branch information
truib committed May 22, 2024
1 parent 8a9f586 commit 8a9c913
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 3 deletions.
36 changes: 35 additions & 1 deletion eb_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ def post_sanitycheck_cudnn(self, *args, **kwargs):

allowlist = ['LICENSE']

# read cuDNN LICENSE, construct allowlist based on section 2.6 that specifies list of files that can be shipped
# read cuDNN LICENSE, construct allowlist based on section "2. Distribution" that specifies list of files that can be shipped
license_path = os.path.join(self.installdir, 'LICENSE')
search_string = "2. Distribution. The following portions of the SDK are distributable under the Agreement:"
with open(license_path) as infile:
Expand All @@ -743,6 +743,39 @@ def post_sanitycheck_cudnn(self, *args, **kwargs):
raise EasyBuildError("cuDNN-specific hook triggered for non-cuDNN easyconfig?!")


def post_sanitycheck_cutensor(self, *args, **kwargs):
"""
Remove files from cuTENSOR installation that we are not allowed to ship,
and replace them with a symlink to a corresponding installation under host_injections.
"""
if self.name == 'cuTENSOR':
print_msg("Replacing files in cuTENSOR installation that we can not ship with symlinks to host_injections...")

allowlist = ['LICENSE']

# read cuTENSOR LICENSE, construct allowlist based on section "2. Distribution" that specifies list of files that can be shipped
license_path = os.path.join(self.installdir, 'LICENSE')
search_string = "2. Distribution. The following portions of the SDK are distributable under the Agreement:"
with open(license_path) as infile:
for line in infile:
if line.strip().startswith(search_string):
# remove search string, split into words, remove trailing
# dots '.' and only retain words starting with a dot '.'
distributable = line[len(search_string):]
for word in distributable.split():
if word[0] == '.':
allowlist.append(word.rstrip('.'))

allowlist = sorted(set(allowlist))
self.log.info("Allowlist for files in cuTENSOR installation that can be redistributed: " + ', '.join(allowlist))

# replace files that are not distributable with symlinks into
# host_injections
replace_non_distributable_files_with_symlinks(self.name, allowlist)
else:
raise EasyBuildError("cuTENSOR-specific hook triggered for non-cuTENSOR easyconfig?!")


def inject_gpu_property(ec):
"""
Add 'gpu' property EESSI<PACKAGE>VERSION envvars and drop dependencies to
Expand Down Expand Up @@ -844,4 +877,5 @@ def inject_gpu_property(ec):
POST_SANITYCHECK_HOOKS = {
'CUDA': post_sanitycheck_cuda,
'cuDNN': post_sanitycheck_cudnn,
'cuTENSOR': post_sanitycheck_cutensor,
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
easyconfigs:
- CUDA-12.1.1.eb
- cuDNN-8.9.2.26-CUDA-12.1.1.eb
- CUDA-12.1.1.eb
- cuDNN-8.9.2.26-CUDA-12.1.1.eb
- cuTENSOR-2.0.1.2-CUDA-12.1.1.eb

0 comments on commit 8a9c913

Please sign in to comment.