Skip to content

Commit

Permalink
Remove util-linux again, this was just to prove the PR worked
Browse files Browse the repository at this point in the history
  • Loading branch information
Caspar van Leeuwen committed Oct 22, 2024
2 parents ce5f2c8 + e963240 commit f38b24f
Show file tree
Hide file tree
Showing 6 changed files with 289 additions and 38 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/modules/fake_module.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
setenv("INSIDE_GITHUB_ACTIONS", "true")
-- Interfere with PATH so Lmod keeps a record
prepend_path("PATH", "/snap/bin")
147 changes: 134 additions & 13 deletions .github/workflows/tests_eessi_module.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ on:
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
build:
basic_checks:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
EESSI_VERSION:
- 2023.06
- 2023.06
steps:
- name: Check out software-layer repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
Expand Down Expand Up @@ -45,10 +45,11 @@ jobs:
- name: Test for archdetect_cpu functionality with invalid path
run: |
. /cvmfs/software.eessi.io/versions/${{matrix.EESSI_VERSION}}/compat/linux/$(uname -m)/usr/share/Lmod/init/bash # Initialise Lmod
# Initialise Lmod
. /cvmfs/software.eessi.io/versions/${{matrix.EESSI_VERSION}}/compat/linux/$(uname -m)/usr/share/Lmod/init/bash
export MODULEPATH=init/modules
set +e # Do not exit immediately if a command exits with a non-zero status
export EESSI_ARCHDETECT_OPTIONS="dummy/cpu"
export EESSI_ARCHDETECT_OPTIONS_OVERRIDE="dummy/cpu"
outfile="outfile.txt"
module load EESSI/${{matrix.EESSI_VERSION}} > "${outfile}" 2>&1
cat "${outfile}"
Expand All @@ -58,29 +59,149 @@ jobs:
echo "Test for picking up invalid path on \${archdetect_cpu} FAILED" >&2
exit 1
fi
unset EESSI_ARCHDETECT_OPTIONS
unset EESSI_ARCHDETECT_OPTIONS_OVERRIDE
set -e # Re-enable exit on non-zero status
lmod_and_init_script_comparison:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
EESSI_VERSION:
- 2023.06
EESSI_SOFTWARE_SUBDIR_OVERRIDE:
- x86_64/amd/zen3
- x86_64/amd/zen4
EESSI_ACCELERATOR_TARGET_OVERRIDE:
- accel/nvidia/cc80
steps:
- name: Check out software-layer repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Mount EESSI CernVM-FS pilot repository
uses: cvmfs-contrib/github-action-cvmfs@55899ca74cf78ab874bdf47f5a804e47c198743c # v4.0
with:
cvmfs_config_package: https://github.com/EESSI/filesystem-layer/releases/download/latest/cvmfs-config-eessi_latest_all.deb
cvmfs_http_proxy: DIRECT
cvmfs_repositories: software.eessi.io

- name: Test for expected variables while adding dummy cpu archs and loading EESSI module
- name: Test for expected variables match between Lmod init script and original bash script
run: |
. /cvmfs/software.eessi.io/versions/${{matrix.EESSI_VERSION}}/compat/linux/$(uname -m)/usr/share/Lmod/init/bash # Initialise Lmod
export MODULEPATH=init/modules
CPU_ARCH=$(./init/eessi_archdetect.sh -a cpupath)
export EESSI_ARCHDETECT_OPTIONS="dummy/cpu:${CPU_ARCH}:dummy1/cpu1"
# Initialise Lmod
. /cvmfs/software.eessi.io/versions/${{matrix.EESSI_VERSION}}/compat/linux/$(uname -m)/usr/share/Lmod/init/bash
# Set our path overrides according to our matrix
export EESSI_SOFTWARE_SUBDIR_OVERRIDE=${{matrix.EESSI_SOFTWARE_SUBDIR_OVERRIDE}}
export EESSI_ACCELERATOR_TARGET_OVERRIDE=${{matrix.EESSI_ACCELERATOR_TARGET_OVERRIDE}}
moduleoutfile="moduleout.txt"
sourceoutfile="sourceout.txt"
# First do (and undo) the Lmod initialisation
export MODULEPATH=init/modules
# Turn on debug output in case we want to take a look
export EESSI_DEBUG_INIT=true
CPU_ARCH=$(./init/eessi_archdetect.sh -a cpupath)
export EESSI_ARCHDETECT_OPTIONS_OVERRIDE="dummy/cpu:${CPU_ARCH}:dummy1/cpu1"
module load EESSI/${{matrix.EESSI_VERSION}}
env | grep -E '^(EESSI_S|EESSI_C)' | sort > "${moduleoutfile}"
# EESSI_ARCHDETECT_OPTIONS_OVERRIDE/EESSI_DEBUG_INIT only relevant for Lmod init
unset EESSI_ARCHDETECT_OPTIONS_OVERRIDE
unset EESSI_DEBUG_INIT
# Store all relevant environment variables
env | grep -E '(^EESSI_|^LMOD_RC|^LMOD_PACKAGE_PATH)' | sort > "${moduleoutfile}"
module unload EESSI/${{matrix.EESSI_VERSION}}
# Now do the init script initialisation
source ./init/bash
env | grep -E '^(EESSI_S|EESSI_C)' | sort > "${sourceoutfile}"
# source script version sets environment variables to force archdetect, ignore these
unset EESSI_USE_ARCHSPEC
unset EESSI_USE_ARCHDETECT
env | grep -E '(^EESSI_|^LMOD_RC|^LMOD_PACKAGE_PATH)' | sort > "${sourceoutfile}"
# Now compare the two results
echo ""
echo "Lmod initialisation:"
cat "${moduleoutfile}"
echo ""
echo "Source script initialisation:"
cat "${sourceoutfile}"
echo ""
echo ""
if (diff "${moduleoutfile}" "${sourceoutfile}" > /dev/null); then
echo "Test for checking env variables PASSED"
else
echo "Test for checking env variables FAILED" >&2
diff "${moduleoutfile}" "${sourceoutfile}"
diff --unified=0 "${moduleoutfile}" "${sourceoutfile}"
exit 1
fi
make_sure_load_and_unload_work:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
EESSI_VERSION:
- 2023.06
EESSI_SOFTWARE_SUBDIR_OVERRIDE:
- none
- x86_64/amd/zen2
- x86_64/amd/zen4
EESSI_ACCELERATOR_TARGET_OVERRIDE:
- none
- accel/nvidia/cc80
steps:
- name: Check out software-layer repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Mount EESSI CernVM-FS pilot repository
uses: cvmfs-contrib/github-action-cvmfs@55899ca74cf78ab874bdf47f5a804e47c198743c # v4.0
with:
cvmfs_config_package: https://github.com/EESSI/filesystem-layer/releases/download/latest/cvmfs-config-eessi_latest_all.deb
cvmfs_http_proxy: DIRECT
cvmfs_repositories: software.eessi.io

- name: Test for identical environment after loading and unloading the EESSI module
run: |
# Initialise Lmod
. /cvmfs/software.eessi.io/versions/${{matrix.EESSI_VERSION}}/compat/linux/$(uname -m)/usr/share/Lmod/init/bash
# Set our cpu path overrides according to our matrix
if [[ "${{matrix.EESSI_SOFTWARE_SUBDIR_OVERRIDE}}" != "none" ]]; then
export EESSI_SOFTWARE_SUBDIR_OVERRIDE=${{matrix.EESSI_SOFTWARE_SUBDIR_OVERRIDE}}
fi
# Set our accelerator path overrides according to our matrix
if [[ "${{matrix.EESSI_ACCELERATOR_TARGET_OVERRIDE}}" != "none" ]]; then
export EESSI_ACCELERATOR_TARGET_OVERRIDE=${{matrix.EESSI_ACCELERATOR_TARGET_OVERRIDE}}
fi
# Turn on debug output in case we want to take a look
export EESSI_DEBUG_INIT=true
initial_env_file="initial_env.txt"
module_cycled_file="load_unload_cycle.txt"
# prepare Lmod, resetting it in a roundabout given we don't want defaults set
export MODULEPATH=init/modules:.github/workflows/modules
module load fake_module
module purge
module unuse .github/workflows/modules
module avail
# Store the initial environment (ignoring Lmod tables)
env | grep -v _ModuleTable | sort > "${initial_env_file}"
# Do (and undo) loading the EESSI module
CPU_ARCH=$(./init/eessi_archdetect.sh -a cpupath)
module load EESSI/${{matrix.EESSI_VERSION}}
module unload EESSI/${{matrix.EESSI_VERSION}}
env | grep -v _ModuleTable | sort > "${module_cycled_file}"
# Now compare the two results (do not expose the files, as they contain the full environment!)
if (diff "${initial_env_file}" "${module_cycled_file}" > /dev/null); then
echo "Test for checking env variables PASSED"
else
echo "Test for checking env variables FAILED" >&2
diff --unified=0 "${initial_env_file}" "${module_cycled_file}"
exit 1
fi
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,11 @@ easyconfigs:
options:
# see https://github.com/easybuilders/easybuild-easyconfigs/pull/21600
from-commit: 9b12318bcff1749781d9eb71c23e21bc3a79ed01
- mpl-ascii-0.10.0-gfbf-2023a.eb:
options:
# see https://github.com/easybuilders/easybuild-easyconfigs/pull/21679
from-commit: 7106f63160b1418d605882dd02ba151d099300bd
- jedi-0.19.0-GCCcore-12.3.0.eb:
options:
# see https://github.com/easybuilders/easybuild-easyconfigs/pull/21650
from-commit: 109998f6adcda7efb4174b1e5f73b41ee82d1f13
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 2024.10.17
# TARGET=ARMV8 must be used when building OpenBLAS for aarch64/generic,
# since otherwise "Illegal instruction" errors may happen in the driver part of OpenBLAS
# on systems that only support a minimal instruction set like Arm v8 (like Raspberry Pi SBCs);
# see also https://github.com/OpenMathLib/OpenBLAS/issues/4945
easyconfigs:
- OpenBLAS-0.3.21-GCC-12.2.0.eb:
options:
# see https://github.com/easybuilders/easybuild-easyblocks/pull/3492
include-easyblocks-from-commit: d06d9617d9bfb63d338b6879eab9da81c8a312d8
- OpenBLAS-0.3.23-GCC-12.3.0.eb:
options:
# see https://github.com/easybuilders/easybuild-easyblocks/pull/3492
include-easyblocks-from-commit: d06d9617d9bfb63d338b6879eab9da81c8a312d8
- OpenBLAS-0.3.24-GCC-13.2.0.eb:
options:
# see https://github.com/easybuilders/easybuild-easyblocks/pull/3492
include-easyblocks-from-commit: d06d9617d9bfb63d338b6879eab9da81c8a312d8
28 changes: 22 additions & 6 deletions eb_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,17 +486,33 @@ 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
"""
# note: OpenBLAS easyblock was updated in https://github.com/easybuilders/easybuild-easyblocks/pull/3492
# to take care of this already, so at some point this hook can be removed...
if self.name == 'OpenBLAS':
if build_option('optarch') == OPTARCH_GENERIC:
dynamic_arch = 'DYNAMIC_ARCH=1'
for step in ('build', 'test', 'install'):
self.cfg.update(f'{step}opts', "DYNAMIC_ARCH=1")
if dynamic_arch not in self.cfg[f'{step}opts']:
self.cfg.update(f'{step}opts', dynamic_arch)

# use -mtune=generic rather than -mcpu=generic in $CFLAGS on aarch64,
# because -mcpu=generic implies a particular -march=armv* which clashes with those used by OpenBLAS
# when building with DYNAMIC_ARCH=1
if get_cpu_architecture() == AARCH64:
cflags = os.getenv('CFLAGS').replace('-mcpu=generic', '-mtune=generic')
env.setvar('CFLAGS', cflags)
# when building for aarch64/generic, we also need to set TARGET=ARMV8 to make sure
# that the driver parts of OpenBLAS are compiled generically;
# see also https://github.com/OpenMathLib/OpenBLAS/issues/4945
target_armv8 = 'TARGET=ARMV8'
for step in ('build', 'test', 'install'):
if target_armv8 not in self.cfg[f'{step}opts']:
self.cfg.update(f'{step}opts', target_armv8)

# use -mtune=generic rather than -mcpu=generic in $CFLAGS for aarch64/generic,
# because -mcpu=generic implies a particular -march=armv* which clashes with those used by OpenBLAS
# when building with DYNAMIC_ARCH=1
mcpu_generic = '-mcpu=generic'
cflags = os.getenv('CFLAGS')
if mcpu_generic in cflags:
cflags = cflags.replace(mcpu_generic, '-mtune=generic')
self.log.info("Replaced -mcpu=generic with -mtune=generic in $CFLAGS")
env.setvar('CFLAGS', cflags)
else:
raise EasyBuildError("OpenBLAS-specific hook triggered for non-OpenBLAS easyconfig?!")

Expand Down
Loading

0 comments on commit f38b24f

Please sign in to comment.