diff --git a/easybuild/easyblocks/t/tensorflow.py b/easybuild/easyblocks/t/tensorflow.py index c72aec1ea1..cd567547d6 100644 --- a/easybuild/easyblocks/t/tensorflow.py +++ b/easybuild/easyblocks/t/tensorflow.py @@ -701,6 +701,7 @@ def configure_step(self): }) else: raise EasyBuildError("TensorFlow has a strict dependency on cuDNN if CUDA is enabled") + if nccl_root: nccl_version = get_software_version('NCCL') # Ignore the PKG_REVISION identifier if it exists (i.e., report 2.4.6 for 2.4.6-1 or 2.4.6-2) @@ -883,6 +884,16 @@ def build_step(self): # Make TF find our modules. LD_LIBRARY_PATH gets automatically added by configure.py cpaths, libpaths = self.system_libs_info[1:] + + # add absolute path to libnccl.so.2 directory provided by NCCL + # when LD_LIBRARY_PATH is filtered and LIBRARY_PATH is not filtered. + # E.g. in an environment such as EESSI. + nccl_root = get_software_root('NCCL') + if nccl_root: + filtered_env_vars = build_option('filter_env_vars') or [] + if 'LD_LIBRARY_PATH' in filtered_env_vars and 'LIBRARY_PATH' not in filtered_env_vars: + libpaths.append(os.path.join(nccl_root, get_software_libdir('NCCL'))) + if cpaths: action_env['CPATH'] = ':'.join(cpaths) if libpaths: