From 546e5cfe45e38caae3607d732763608fd3b2f3f2 Mon Sep 17 00:00:00 2001 From: Rohit Goswami Date: Sun, 11 Oct 2026 10:45:42 -0500 Subject: [PATCH] Drop UCX --enable-optimizations for generic CPU targets UCX's configure runs an AVX test program on the machine doing the build when optimizations are enabled, and adds -mavx to the flags for the whole package if it passes. The x86_64/generic UCX installs in 2023.06, 2025.06 and 2026.06 all came out with AVX in nearly every library. Strip the option in a pre-configure hook when the target is one of the generic ones or optarch is GENERIC, and check the configure line in the hooks workflow. See EESSI/software-layer#1778. --- .github/workflows/test-eb-hooks.yml | 49 +++++++++++++++++++++++++++++ eb_hooks.py | 23 ++++++++++++++ 2 files changed, 72 insertions(+) diff --git a/.github/workflows/test-eb-hooks.yml b/.github/workflows/test-eb-hooks.yml index dfcc576c..a9cf6f21 100644 --- a/.github/workflows/test-eb-hooks.yml +++ b/.github/workflows/test-eb-hooks.yml @@ -168,3 +168,52 @@ jobs: # echo "$OUT" | grep -qiF 'add_property("arch","gpu")' # echo "$OUT" | grep -qiF 'setenv("EESSIROCMVERSION","6.4.1")' # echo "rompi toolchain handled" + + check_ucx_generic_optimizations: + runs-on: ubuntu-24.04 + strategy: + matrix: + include: + - EESSI_VERSION: '2023.06' + EASYCONFIG: 'UCX-1.15.0-GCCcore-13.2.0.eb' + - EESSI_VERSION: '2025.06' + EASYCONFIG: 'UCX-1.19.0-GCCcore-14.3.0.eb' + + steps: + - name: Check out software-layer repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Mount EESSI CernVM-FS repository + uses: eessi/github-action-eessi@v3 + with: + eessi_stack_version: ${{matrix.EESSI_VERSION}} + use_eessi_module: true + + - name: Test that UCX is configured without --enable-optimizations for generic targets + if: ${{ github.event_name == 'pull_request' }} + run: | + module load EESSI-extend/${{matrix.EESSI_VERSION}}-easybuild + + # print the ./configure command line of an extended dry run (eb wraps it at 80 columns) + configure_line() { + eb --hooks=$PWD/eb_hooks.py --extended-dry-run "$@" ${{matrix.EASYCONFIG}} 2>&1 \ + | grep -A6 'running shell command "./configure' | tr -d '\n' + } + + # the runner's own CPU target keeps the option + line=$(configure_line) + grep -q -- '--enable-cma' <<< "$line" + grep -q -- '--enable-optimizations' <<< "$line" + echo "Native target keeps --enable-optimizations" + + for target in x86_64/generic aarch64/generic; do + line=$(EESSI_SOFTWARE_SUBDIR=$target configure_line) + grep -q -- '--enable-cma' <<< "$line" + grep -q -- '--enable-optimizations' <<< "$line" && exit 1 + echo "$target drops --enable-optimizations" + done + + line=$(configure_line --optarch=GENERIC) + grep -q -- '--enable-cma' <<< "$line" + grep -q -- '--enable-optimizations' <<< "$line" && exit 1 + echo "--optarch=GENERIC drops --enable-optimizations" diff --git a/eb_hooks.py b/eb_hooks.py index fc26f88b..96330d2f 100644 --- a/eb_hooks.py +++ b/eb_hooks.py @@ -1674,6 +1674,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 adds -mavx to the + compiler flags of the whole package when it passes (on aarch64 it may add -mcpu for the build host); + UCX does not check the CPU at run time, so the result needs AVX. + 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: %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: @@ -2571,6 +2593,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,