Skip to content

Commit d510e7e

Browse files
author
Richard Top
committed
eb_hooks modifications for {2025.06}[2024a] TensorFlow v2.18.1
1 parent 54a2498 commit d510e7e

2 files changed

Lines changed: 59 additions & 0 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
easyconfigs:
2+
- MLflow-2.22.4-gfbf-2024a.eb:
3+
options:
4+
# see https://github.com/easybuilders/easybuild-easyconfigs/pull/24951
5+
from-commit: 0f50e961c55d6406b0e64eebd59335b32dce0e92
6+
- Flux-0.80.0-GCC-13.3.0.eb
7+
- WRF-4.6.1-foss-2024a-dmpar.eb
8+
- buildenv-default-foss-2024a.eb
9+
- GDRCopy-2.4.1-GCCcore-13.3.0.eb
10+
- lit-18.1.7-GCCcore-13.3.0.eb
11+
- pydot-3.0.3-GCCcore-13.3.0.eb
12+
- pyzstd-0.16.2-GCCcore-13.3.0.eb:
13+
options:
14+
# see https://github.com/easybuilders/easybuild-easyconfigs/pull/23923
15+
from-commit: 0eef0cf4f6e03172451c41a5af1c0e26b7a777f8
16+
- GDB-16.3-GCCcore-13.3.0.eb
17+
- TensorFlow-2.18.1-foss-2024a.eb

eb_hooks.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
653694
def 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

Comments
 (0)