Skip to content
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

drop unnecessary CUDA stub libraries from $LIBRARY_PATH #2793

Merged
merged 5 commits into from
Jul 7, 2023
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion easybuild/easyblocks/c/cuda.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,17 @@ def create_wrapper(wrapper_name, wrapper_comp):
raise EasyBuildError("Unable to find 'ldconfig' in $PATH (%s), nor in any of %s", path, sbin_dirs)

stubs_dir = os.path.join(self.installdir, 'lib64', 'stubs')

# Remove stubs which are not required as the full library is in $EBROOTCUDA/lib64 because this duplication
# causes issues (e.g. CMake warnings) when using this module (see $LIBRARY_PATH & $LD_LIBRARY_PATH)
for stub_lib in expand_glob_paths([os.path.join(stubs_dir, '*.*')]):
ocaisa marked this conversation as resolved.
Show resolved Hide resolved
real_lib = os.path.join(self.installdir, 'lib64', os.path.basename(stub_lib))
if os.path.exists(real_lib):
self.log.debug("Removing unnecessary stub library %s", stub_lib)
remove_file(stub_lib)
else:
self.log.debug("Keeping stub library %s", stub_lib)

# Run ldconfig to create missing symlinks in the stubs directory (libcuda.so.1, etc)
cmd = ' '.join([ldconfig, '-N', stubs_dir])
run_cmd(cmd)
Expand All @@ -243,7 +254,7 @@ def create_wrapper(wrapper_name, wrapper_comp):
# See e.g. https://github.com/easybuilders/easybuild-easyconfigs/issues/12348
# Workaround: Create a copy that matches this pattern
new_stubs_dir = os.path.join(self.installdir, 'stubs')
copy_dir(stubs_dir, os.path.join(new_stubs_dir, 'lib64'))
copy_dir(stubs_dir, os.path.join(new_stubs_dir, 'lib64'), symlinks=True)
Flamefire marked this conversation as resolved.
Show resolved Hide resolved
# Also create the lib dir as a symlink
symlink('lib64', os.path.join(new_stubs_dir, 'lib'), use_abspath_source=False)

Expand Down