@@ -650,6 +650,47 @@ def parse_hook_maturin(ec, eprefix):
650650 raise EasyBuildError ("maturin-specific hook triggered for non-maturin easyconfig?!" )
651651
652652
653+ def parse_hook_tensorflow_h5py_glibc (ec , eprefix ):
654+ """
655+ Fix the Python and environment used while building and running tests for TensorFlow with CUDA
656+ """
657+ cpu_target = get_eessi_envvar ('EESSI_SOFTWARE_SUBDIR' )
658+ if ec .name == 'TensorFlow' and ec .version == '2.18.1' :
659+ ec ['preconfigopts' ] = ec .get ('preconfigopts' , '' ) + (
660+ 'export GCC_HOST_COMPILER_PATH=$EBROOTGCC/bin/gcc && '
661+ 'sed -i \' s|--define=PREFIX=/usr|--define=PREFIX=\\ $EESSI_EPREFIX|g\' .bazelrc && '
662+ 'cat > /tmp/fix_h5py.py << \' EOF\' \n '
663+ 'with open("requirements_lock_3_12.txt", "r") as f:\n '
664+ ' content = f.read()\n '
665+ 'content = content.replace("h5py==3.11.0 \\ \\ ", "h5py==3.15.1 \\ \\ ")\n '
666+ 'content = content.replace(\n '
667+ ' " --hash=sha256:f4e025e852754ca833401777c25888acb96889ee2c27e7e629a19aee288833f0",\n '
668+ ' " --hash=sha256:f4e025e852754ca833401777c25888acb96889ee2c27e7e629a19aee288833f0 \\ \\ \\ n --hash=sha256:8a33bfd5dfcea037196f7778534b1ff7e36a7f40a89e648c8f2967292eb6898e"\n '
669+ ')\n '
670+ 'with open("requirements_lock_3_12.txt", "w") as f:\n '
671+ ' f.write(content)\n '
672+ 'EOF\n '
673+ 'python3 /tmp/fix_h5py.py && '
674+ )
675+ current_opts = ec .get ('buildopts' , [])
676+ if isinstance (current_opts , str ):
677+ current_opts = current_opts .split ()
678+
679+ ec ['buildopts' ] = current_opts + [
680+ '--linkopt=-Wl,--disable-new-dtags --host_linkopt=-Wl,--disable-new-dtags --action_env=GCC_HOST_COMPILER_PATH=$EBROOTGCC/bin/gcc --host_action_env=GCC_HOST_COMPILER_PATH=$EBROOTGCC/bin/gcc --linkopt=-Wl,-rpath,$EBROOTCUDA/lib:$EBROOTCUDNN/lib:$EBROOTNCCL/lib --host_linkopt=-Wl,-rpath,$EBROOTCUDA/lib:$EBROOTCUDNN/lib:$EBROOTNCCL/lib ' ,
681+ ]
682+
683+ ec ['pretestopts' ] = (
684+ """interppath=$(find "$EESSI_EPREFIX/lib64" -name 'ld-*' | grep -E 'so\\ .1|so\\ .2' | head -n1) && """
685+ """pybin=$(find "%(builddir)s/%(name)s/bazel-root/" -type f -path "*/external/python_%(arch)s-unknown-linux-gnu/bin/python%(pyshortver)s" | head -n1) && """
686+ """patchelf --set-interpreter "$interppath" "$pybin" && """
687+ """export LD_LIBRARY_PATH="$EBROOTCUDA/lib:$EBROOTCUDNN/lib:$EBROOTNCCL/lib:$LD_LIBRARY_PATH" && """
688+ )
689+ print_msg ("TensorFlow-glibc related changes have been applied" )
690+ else :
691+ raise EasyBuildError ("TensorFlow-glibc specific hook triggered for non-TensorFlow-glibc easyconfig?!" )
692+
693+
653694def parse_hook_ucx_eprefix (ec , eprefix ):
654695 """Make UCX aware of compatibility layer via additional configuration options."""
655696 if ec .name == 'UCX' :
@@ -1856,6 +1897,7 @@ def post_easyblock_hook(self, *args, **kwargs):
18561897 'Mesa' : parse_hook_mesa_use_llvm_minimal ,
18571898 'OpenBLAS' : parse_hook_openblas_relax_lapack_tests_num_errors ,
18581899 'pybind11' : parse_hook_pybind11_replace_catch2 ,
1900+ 'TensorFlow' : parse_hook_tensorflow_h5py_glibc ,
18591901 'Qt5' : parse_hook_qt5_check_qtwebengine_disable ,
18601902 'UCX' : parse_hook_ucx_eprefix ,
18611903}
0 commit comments