From 9273ea1f1625d3c2cb3b12314826ca49db21469b Mon Sep 17 00:00:00 2001 From: crivella Date: Tue, 27 May 2025 13:38:46 +0200 Subject: [PATCH 1/3] Added hook to restore filtered deps for LLVM builds --- eb_hooks.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/eb_hooks.py b/eb_hooks.py index d92f457e41..b14a5a7e36 100644 --- a/eb_hooks.py +++ b/eb_hooks.py @@ -14,6 +14,7 @@ from easybuild.tools.systemtools import AARCH64, POWER, X86_64, get_cpu_architecture, get_cpu_features from easybuild.tools.toolchain.compiler import OPTARCH_GENERIC from easybuild.tools.version import VERSION as EASYBUILD_VERSION +from easybuild.tools.modules import get_software_root_env_var_name # prefer importing LooseVersion from easybuild.tools, but fall back to distuils in case EasyBuild <= 4.7.0 is used try: @@ -654,6 +655,27 @@ def pre_configure_hook_gromacs(self, *args, **kwargs): raise EasyBuildError("GROMACS-specific hook triggered for non-GROMACS easyconfig?!") +def pre_configure_hook_llvm(self, *args, **kwargs): + """Adjust internal configure options for the LLVM EasyBlock to reinstate filtered out dependencies. + In the LLVM EasyBlock, most checks concerning loaded modules are performed at the configure_step. + The EB uses a global `general_opts` dict to keep track of options that needs to be reused across stages. + The way the EB is structured does allow to inject a CMAKE option through `self._cfgopts` which is a splitted list + of the `configure_opts` passed through the EC, but does not allow to override as the `general_opts` dict will + take precedence over the `self._cfgopts` list. + + We can instead set the environment variable that EasyBuild uses for `get_software_root` to trick the EB into + into pointing to the compat layer. + """ + if self.name == 'LLVM': + eprefix = get_eessi_envvar('EPREFIX') + + for software in ('zlib', 'ncurses'): + var_name = get_software_root_env_var_name(software) + env.setvar(var_name, os.path.join(eprefix, 'usr')) + else: + raise EasyBuildError("LLVM-specific hook triggered for non-LLVM easyconfig?!") + + def pre_configure_hook_openblas_optarch_generic(self, *args, **kwargs): """ Pre-configure hook for OpenBLAS: add DYNAMIC_ARCH=1 to build/test/install options when using --optarch=GENERIC @@ -1227,6 +1249,7 @@ def post_module_hook(self, *args, **kwargs): 'Extrae': pre_configure_hook_extrae, 'GROMACS': pre_configure_hook_gromacs, 'libfabric': pre_configure_hook_libfabric_disable_psm3_x86_64_generic, + 'LLVM': pre_configure_hook_llvm, 'MetaBAT': pre_configure_hook_metabat_filtered_zlib_dep, 'OpenBLAS': pre_configure_hook_openblas_optarch_generic, 'WRF': pre_configure_hook_wrf_aarch64, From 7590993d7e017bb29b92e16b4033d48011b7257e Mon Sep 17 00:00:00 2001 From: Davide Grassano <34096612+Crivella@users.noreply.github.com> Date: Thu, 5 Jun 2025 17:11:09 +0200 Subject: [PATCH 2/3] Update eb_hooks.py Co-authored-by: Kenneth Hoste --- eb_hooks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eb_hooks.py b/eb_hooks.py index b14a5a7e36..0ae30c49f4 100644 --- a/eb_hooks.py +++ b/eb_hooks.py @@ -666,7 +666,7 @@ def pre_configure_hook_llvm(self, *args, **kwargs): We can instead set the environment variable that EasyBuild uses for `get_software_root` to trick the EB into into pointing to the compat layer. """ - if self.name == 'LLVM': + if self.name in ['LLVM', 'ROCm-LLVM']: eprefix = get_eessi_envvar('EPREFIX') for software in ('zlib', 'ncurses'): From e85f5fc885ea5066865a308104ce349002195d2a Mon Sep 17 00:00:00 2001 From: crivella Date: Thu, 5 Jun 2025 17:16:10 +0200 Subject: [PATCH 3/3] Also needed to run `ROCm-LLVM` with the same hook --- eb_hooks.py | 1 + 1 file changed, 1 insertion(+) diff --git a/eb_hooks.py b/eb_hooks.py index 0ae30c49f4..717e04d83f 100644 --- a/eb_hooks.py +++ b/eb_hooks.py @@ -1250,6 +1250,7 @@ def post_module_hook(self, *args, **kwargs): 'GROMACS': pre_configure_hook_gromacs, 'libfabric': pre_configure_hook_libfabric_disable_psm3_x86_64_generic, 'LLVM': pre_configure_hook_llvm, + 'ROCm-LLVM': pre_configure_hook_llvm, 'MetaBAT': pre_configure_hook_metabat_filtered_zlib_dep, 'OpenBLAS': pre_configure_hook_openblas_optarch_generic, 'WRF': pre_configure_hook_wrf_aarch64,