diff --git a/eb_hooks.py b/eb_hooks.py index f8de44b5..ea3c16d8 100644 --- a/eb_hooks.py +++ b/eb_hooks.py @@ -57,6 +57,9 @@ CPU_TARGET_ZEN4 = 'x86_64/amd/zen4' CPU_TARGET_ZEN5 = 'x86_64/amd/zen5' +# RISCV64 targets +CPU_TARGET_RISCV_GENERIC = 'riscv64/generic' + EESSI_RPATH_OVERRIDE_ATTR = 'orig_rpath_override_dirs' EESSI_MODULE_ONLY_ATTR = 'orig_module_only' EESSI_FORCE_ATTR = 'orig_force' @@ -1838,6 +1841,31 @@ def pre_configure_hook_cmake_system(self, *args, **kwargs): raise EasyBuildError("CMake-specific hook triggered for non-CMake easyconfig?!") +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']) + else: + raise EasyBuildError("IDG-specific hook triggered for non-IDG easyconfig?!") + + def pre_configure_hook_visit(self, *args, **kwargs): """ Pre-configure hook for Visit @@ -2800,6 +2828,7 @@ def post_easyblock_hook(self, *args, **kwargs): 'GObject-Introspection': pre_configure_hook_gobject_introspection, 'Graphviz': pre_configure_hook_graphviz, 'GRASS': pre_configure_hook_grass, + 'IDG': pre_configure_hook_IDG_riscv_target_cpu, 'LAMMPS': pre_configure_hook_LAMMPS_zen4_and_aarch64_cuda, 'libfabric': pre_configure_hook_libfabric_disable_psm3_x86_64_generic, 'LLVM': pre_configure_hook_llvm,