From 8b181c58fe3d62056e948362c7c36d98e7ce5b7f Mon Sep 17 00:00:00 2001 From: Caspar van Leeuwen Date: Sun, 22 Nov 2026 12:56:02 +0100 Subject: [PATCH 1/2] Make the -DTARGET_CPU replacement / setting into a function, because aocommon is used in multiple packages. Then, also apply it to AOFlagger to avoid https://github.com/EESSI/software-layer/pull/1930#issuecomment-7078298998 --- eb_hooks.py | 49 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/eb_hooks.py b/eb_hooks.py index ea3c16d8..caa278b7 100644 --- a/eb_hooks.py +++ b/eb_hooks.py @@ -1841,31 +1841,50 @@ def pre_configure_hook_cmake_system(self, *args, **kwargs): raise EasyBuildError("CMake-specific hook triggered for non-CMake easyconfig?!") +# Create reusable function, because multiple packages use aocommon's SetTargetCPU.cmake +def set_aocommon_target_cpu_riscv_generic(self): + """ + add or replace DTARGET_CPU option for aocommon with rv64gc + """ + cpu_target = get_eessi_envvar('EESSI_SOFTWARE_SUBDIR') + if cpu_target == CPU_TARGET_RISCV_GENERIC: + target_cpu_opt = '-DTARGET_CPU=rv64gc' + + if '-DTARGET_CPU' in self.cfg['configopts']: + # replace the existing value + self.cfg['configopts'] = re.sub( + r'-DTARGET_CPU=\S*', + target_cpu_opt, + self.cfg['configopts'], + ) + else: + # -DTARGET_CPU wasn't set before, just append it + self.cfg.update('configopts', target_cpu_opt) + print_msg("Using custom configure options for %s: %s", self.name, self.cfg['configopts']) + + def pre_configure_hook_IDG_riscv_target_cpu(self, *args, **kwargs): """ pre-configure hook for IDG: - set TARGET_CPU for the generic RISC-V target, replacing any existing -DTARGET_CPU """ if self.name == 'IDG': - cpu_target = get_eessi_envvar('EESSI_SOFTWARE_SUBDIR') - if cpu_target == CPU_TARGET_RISCV_GENERIC: - target_cpu_opt = '-DTARGET_CPU=rv64gc' - - if '-DTARGET_CPU' in self.cfg['configopts']: - # replace the existing value - self.cfg['configopts'] = re.sub( - r'-DTARGET_CPU=\S*', - target_cpu_opt, - self.cfg['configopts'], - ) - else: - # -DTARGET_CPU wasn't set before, just append it - self.cfg.update('configopts', target_cpu_opt) - print_msg("Using custom configure options for %s: %s", self.name, self.cfg['configopts']) + set_aocommon_target_cpu_riscv_generic(self) else: raise EasyBuildError("IDG-specific hook triggered for non-IDG easyconfig?!") +def pre_configure_hook_AOFlagger_riscv_target_cpu(self, *args, **kwargs): + """ + pre-configure hook for AOFlagger: + - set TARGET_CPU for the generic RISC-V target, replacing any existing -DTARGET_CPU + """ + if self.name == 'AOFlagger': + set_aocommon_target_cpu_riscv_generic(self) + else: + raise EasyBuildError("AOFlagger-specific hook triggered for non-AOFlagger easyconfig?!") + + def pre_configure_hook_visit(self, *args, **kwargs): """ Pre-configure hook for Visit From 54e18223a0eac0a53b2bd46855ed4ce4aee89b8c Mon Sep 17 00:00:00 2001 From: Caspar van Leeuwen Date: Mon, 23 Nov 2026 09:50:41 +0100 Subject: [PATCH 2/2] Actually register new AOFlagger hook... --- eb_hooks.py | 1 + 1 file changed, 1 insertion(+) diff --git a/eb_hooks.py b/eb_hooks.py index caa278b7..799757c0 100644 --- a/eb_hooks.py +++ b/eb_hooks.py @@ -2839,6 +2839,7 @@ def post_easyblock_hook(self, *args, **kwargs): } PRE_CONFIGURE_HOOKS = { + 'AOFlagger': pre_configure_hook_AOFlagger_riscv_target_cpu, 'BLIS': pre_configure_hook_BLIS, 'CMake': pre_configure_hook_cmake_system, 'CUDA-Samples': pre_configure_hook_CUDA_Samples_test_remove,