Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/test-eb-hooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,28 @@ jobs:
module load EESSI-extend
diff "$TEMP_FILE" "$EASYBUILD_HOOKS"

- name: Check whether eessi_supported_toolchains.json (used by eb_hooks.py) is up-to-date

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Essentially the same as the check for eb_hooks.py? If so could we use another matrix variable for the files to be checked?

if: ${{ github.event_name == 'pull_request' }}
run: |
FILE="eessi_supported_toolchains.json"
TEMP_FILE="$(mktemp)"

# Fetch base branch
git fetch origin ${{ github.base_ref }}

# Check if the file has changed in the PR
if git diff --name-only origin/${{ github.base_ref }}...HEAD | grep -q "^$FILE$"; then
echo "$FILE changed in PR. Using PR version."
cp "$FILE" "$TEMP_FILE"
else
echo "File not changed in PR. Using default branch version."
git show origin/${{ github.base_ref }}:$FILE > "$TEMP_FILE"
fi

# Compare to what is shipped next to the hooks in the repository
module load EESSI-extend
diff "$TEMP_FILE" "$(dirname $EASYBUILD_HOOKS)/$FILE"

check_eb_hooks_functionality:
runs-on: ubuntu-24.04
strategy:
Expand Down
49 changes: 25 additions & 24 deletions eb_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,31 +67,32 @@

STACK_REPROD_SUBDIR = 'reprod'

EESSI_SUPPORTED_TOP_LEVEL_TOOLCHAINS = {
'2023.06': [
{'name': 'foss', 'version': '2022b'},
{'name': 'foss', 'version': '2023a'},
{'name': 'foss', 'version': '2023b'},
],
'2025.06': [
{'name': 'foss', 'version': '2024a'},
{'name': 'foss', 'version': '2025a'},
{'name': 'foss', 'version': '2025b'},
],
'2026.06': [
{'name': 'foss', 'version': '2026.1'},
{'name': 'lfoss', 'version': '2026.1'},
],
}
if EASYBUILD_VERSION >= '5.2.0':
EESSI_SUPPORTED_TOP_LEVEL_TOOLCHAINS['2025.06'].append(
{'name': 'lfoss', 'version': '2025b'}
)

if EASYBUILD_VERSION >= '5.3.1':
EESSI_SUPPORTED_TOP_LEVEL_TOOLCHAINS['2025.06'].append(
{'name': 'rompi', 'version': '2025a'}
)
def load_supported_top_level_toolchains():
"""
Load the supported top-level toolchains per EESSI version from eessi_supported_toolchains.json,
which is located next to this hooks file (both in the software-layer-scripts repository, and when installed
in <EESSI prefix>/init/easybuild). Toolchains that require a more recent EasyBuild version than the one
being used (as specified via 'min_easybuild_version') are left out.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add

    Returns:
        supported_toolchains (dict)

"""
toolchains_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'eessi_supported_toolchains.json')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about specifying the location via an environment variable? Inferring the location from the location of eb_hooks.py could be a fallback if the environment variable is not set.

try:
with open(toolchains_file) as fh:
toolchains = json.load(fh)
except (OSError, ValueError) as err:
raise EasyBuildError(f"Failed to load supported toolchains from {toolchains_file} "
f"(it is expected to be located next to the EasyBuild hooks file): {err}")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the text in parantheses is a little speculative as you also show this for ValueError?


return {
eessi_version: [
{'name': tc['name'], 'version': tc['version']} for tc in tcs
if EASYBUILD_VERSION >= tc.get('min_easybuild_version', '0')
]
for eessi_version, tcs in toolchains.items()
}


EESSI_SUPPORTED_TOP_LEVEL_TOOLCHAINS = load_supported_top_level_toolchains()

# Supported compute capabilities by CUDA toolkit version
# Obtained by installing all CUDAs from 12.0.0 to 13.3.0, then using:
Expand Down
18 changes: 18 additions & 0 deletions eessi_supported_toolchains.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"2023.06": [
{"name": "foss", "version": "2022b"},
{"name": "foss", "version": "2023a"},
{"name": "foss", "version": "2023b"}
],
"2025.06": [
{"name": "foss", "version": "2024a"},
{"name": "foss", "version": "2025a"},
{"name": "foss", "version": "2025b"},
{"name": "lfoss", "version": "2025b", "min_easybuild_version": "5.2.0"},
{"name": "rompi", "version": "2025a", "min_easybuild_version": "5.3.1"}
],
"2026.06": [
{"name": "foss", "version": "2026.1"},
{"name": "lfoss", "version": "2026.1"}
]
}
1 change: 1 addition & 0 deletions install_scripts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ fi
# Copy over EasyBuild hooks file used for installations
hook_files=(
eb_hooks.py
eessi_supported_toolchains.json

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it belong here?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it could be here, but then the name hook_files is a little off. Maybe easybuild_init_files is fitting.

)
copy_files_by_list ${TOPDIR} ${INSTALL_PREFIX}/init/easybuild "${hook_files[@]}"

Expand Down
Loading