forked from EESSI/software-layer-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfish
More file actions
85 lines (74 loc) · 3.35 KB
/
fish
File metadata and controls
85 lines (74 loc) · 3.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/usr/bin/env fish
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (C) 2020-2026 EESSI contributors
#
# EESSI - European Environment for Scientific Software Installations
#
# This file is a template for initialising EESSI via Lmod for the environment indicated by the shebang.
#
# Please refer to the reference bash implementation for full documentation, only minimal comments are included here
# Choose an EESSI CVMFS repository
set internal_cvmfs_repo (set -q EESSI_CVMFS_REPO; and echo "$EESSI_CVMFS_REPO"; or echo "/cvmfs/software.eessi.io")
# Choose an EESSI version
if not set -q __EESSI_VERSION_USED_FOR_INIT
set EESSI_VERSION_DEFAULT "__EESSI_VERSION_DEFAULT__"
else
set EESSI_VERSION_DEFAULT "$__EESSI_VERSION_USED_FOR_INIT"
end
if not set -q __Init_EESSI_Default_Modules
if set -q EESSI_VERSION
# keep existing value
else
set EESSI_VERSION $EESSI_VERSION_DEFAULT
end
else
# If we have already initialised and this is being called again,
# then we must want the specific version
set EESSI_VERSION "__EESSI_VERSION_DEFAULT__"
end
# Record version used for init; -x exports it to the environment
if not set -q __EESSI_VERSION_USED_FOR_INIT
set -x __EESSI_VERSION_USED_FOR_INIT "$EESSI_VERSION"
end
# ability to predefine elsewhere the default list (with options to append or prepend)
set LMOD_SYSTEM_DEFAULT_MODULES "EESSI/$EESSI_VERSION"
if set -q EESSI_DEFAULT_MODULES_PREPEND
set LMOD_SYSTEM_DEFAULT_MODULES "$EESSI_DEFAULT_MODULES_PREPEND:$LMOD_SYSTEM_DEFAULT_MODULES"
end
if set -q EESSI_DEFAULT_MODULES_APPEND
set LMOD_SYSTEM_DEFAULT_MODULES "$LMOD_SYSTEM_DEFAULT_MODULES:$EESSI_DEFAULT_MODULES_APPEND"
end
set -x LMOD_SYSTEM_DEFAULT_MODULES $LMOD_SYSTEM_DEFAULT_MODULES
if test -z "$__Init_EESSI_Default_Modules"
set __Init_EESSI_Default_Modules 1
# Lmod version in 2023.06 has a problem with newer Lmod caches, so let's stick to more recent Lmod
# (has no effect except on Lmod itself, and compatible caches are still created/supported by EESSI)
set LMOD_EESSI_VERSION (string replace 2023.06 2025.06 -- $EESSI_VERSION)
if test -z "$EESSI_NO_MODULE_PURGE_ON_INIT"
if type -q module
module purge >/dev/null 2>&1
and echo "Modules purged before initialising EESSI"
end
end
# If there is a local Lmod, make it forget about the system set MODULEPATH
set -e __LMOD_REF_COUNT_MODULEPATH
# and clear out any memory Lmod might have
set -e _ModuleTable001_
# Path to top-level module tree
set modulepath "$internal_cvmfs_repo/init/modules"
if set -q EESSI_EXTRA_MODULEPATH; and test -n "$EESSI_EXTRA_MODULEPATH"
set modulepath "$modulepath:$EESSI_EXTRA_MODULEPATH"
end
set -x MODULEPATH $modulepath
. "$internal_cvmfs_repo"/versions/"$LMOD_EESSI_VERSION"/compat/linux/(uname -m)/usr/share/Lmod/init/fish
module --initial_load --no_redirect restore
echo "EESSI has selected $EESSI_SOFTWARE_SUBDIR as the compatible CPU target for EESSI/$EESSI_VERSION"
if test -n "$EESSI_ACCEL_SUBDIR"
echo "EESSI has selected $EESSI_ACCEL_SUBDIR as the compatible accelerator target for EESSI/$EESSI_VERSION"
else
echo "EESSI did not identify an accelerator on the system"
end
echo "(for debug information when loading the EESSI module, set the environment variable EESSI_MODULE_DEBUG to 1)"
else
module reset
end