diff --git a/eb_hooks.py b/eb_hooks.py index fd3aed75..3e279b04 100644 --- a/eb_hooks.py +++ b/eb_hooks.py @@ -1720,6 +1720,28 @@ def pre_configure_hook_libfabric_disable_psm3_x86_64_generic(self, *args, **kwar raise EasyBuildError("libfabric-specific hook triggered for non-libfabric easyconfig?!") +def pre_configure_hook_ucx_generic(self, *args, **kwargs): + """ + Pre-configure hook for UCX: drop --enable-optimizations when building for a generic CPU target. + With that option, UCX's configure runs an AVX test program on the build host and, when it passes, + adds -mavx to the compiler flags of the whole package (on aarch64 it may add -mcpu for the build host). + ucs_check_cpu_flags then aborts at load time if the CPU does not support those flags. + See https://github.com/EESSI/software-layer/issues/1778 + """ + if self.name == 'UCX': + cpu_target = get_eessi_envvar('EESSI_SOFTWARE_SUBDIR') + generic = cpu_target in (CPU_TARGET_X86_64_GENERIC, CPU_TARGET_AARCH64_GENERIC) + if generic or build_option('optarch') == OPTARCH_GENERIC: + configopts = self.cfg['configopts'] + opts = configopts.split() + if '--enable-optimizations' in opts: + self.cfg['configopts'] = ' '.join(opt for opt in opts if opt != '--enable-optimizations') + print_msg("Removed --enable-optimizations from configure options for %s, " + "since this is a build for a generic CPU target: %s", self.name, self.cfg['configopts']) + else: + raise EasyBuildError("UCX-specific hook triggered for non-UCX easyconfig?!") + + def pre_configure_hook_metabat_filtered_zlib_dep(self, *args, **kwargs): """ Pre-configure hook for MetaBAT: @@ -2772,6 +2794,7 @@ def post_easyblock_hook(self, *args, **kwargs): 'ROCm-LLVM': pre_configure_hook_llvm, 'Score-P': pre_configure_hook_score_p, 'SymEngine': pre_configure_hook_symengine, + 'UCX': pre_configure_hook_ucx_generic, 'Visit': pre_configure_hook_visit, 'WRF': pre_configure_hook_wrf_aarch64, 'Zoltan': pre_configure_hook_Zoltan,