Skip to content

Commit f53567b

Browse files
authored
Merge pull request #45 from ocaisa/easybuild_config_updates
Add settings for EasyBuild 5+ to EESSI-extend
2 parents 599e031 + fd7ed92 commit f53567b

File tree

2 files changed

+63
-20
lines changed

2 files changed

+63
-20
lines changed

.github/workflows/tests_eessi_extend_module.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,19 @@ jobs:
8686
# check some specific ones
8787
check_env_var "EASYBUILD_INSTALLPATH" "$EESSI_SOFTWARE_PATH"
8888
check_env_var "EASYBUILD_UMASK" "022"
89+
# Check some things that are EasyBuild 5+ (available in all EESSI versions so should exist)
90+
check_env_var "EASYBUILD_STRICT_RPATH_SANITY_CHECK" "1"
91+
check_env_var "EASYBUILD_CUDA_SANITY_CHECK_ERROR_ON_FAILED_CHECKS" "1"
92+
check_env_var "EASYBUILD_FAIL_ON_MOD_FILES_GCCCORE" "1"
93+
check_env_var "EASYBUILD_LOCAL_VAR_NAMING_CHECK" "error"
94+
# Check some EESSI version specific settings
95+
if [[ "${{ matrix.EESSI_VERSION }}" != "2023.06" ]]; then
96+
check_env_var "EASYBUILD_PREFER_PYTHON_SEARCH_PATH" "EBPYTHONPREFIXES"
97+
check_env_var "EASYBUILD_MODULE_SEARCH_PATH_HEADERS" "include_paths"
98+
check_env_var "EASYBUILD_SEARCH_PATH_CPP_HEADERS" "include_paths"
99+
fi
100+
# verify the configuration is actually valid
101+
eb --show-config
89102
# unload and check the environment is clean again
90103
module unload EESSI-extend
91104
check_disallowed_env_prefix EASYBUILD_
@@ -97,6 +110,8 @@ jobs:
97110
# check some specific envvars
98111
check_env_var "EASYBUILD_INSTALLPATH" "$EESSI_SITE_SOFTWARE_PATH"
99112
check_env_var "EASYBUILD_UMASK" "022"
113+
# verify the configuration is actually valid
114+
eb --show-config
100115
# unload and check the environment is clean again
101116
module unload EESSI-extend
102117
check_disallowed_env_prefix EASYBUILD_
@@ -110,6 +125,8 @@ jobs:
110125
check_env_var "EASYBUILD_INSTALLPATH" "$EXPECTED_INSTALLATION_PATH"
111126
check_env_var "EASYBUILD_UMASK" "002"
112127
check_env_var "EASYBUILD_GROUP_WRITABLE_INSTALLDIR" "1"
128+
# verify the configuration is actually valid
129+
eb --show-config
113130
# unload and check the environment is clean again
114131
module unload EESSI-extend
115132
check_disallowed_env_prefix EASYBUILD_
@@ -123,6 +140,8 @@ jobs:
123140
export EXPECTED_INSTALLATION_PATH="$MY_INSTALLATION_PATH/$USER/versions/$EESSI_VERSION/software/linux/$EESSI_SOFTWARE_SUBDIR"
124141
check_env_var "EASYBUILD_INSTALLPATH" "$EXPECTED_INSTALLATION_PATH"
125142
check_env_var "EASYBUILD_UMASK" "077"
143+
# verify the configuration is actually valid
144+
eb --show-config
126145
# unload and check the environment is clean again
127146
module unload EESSI-extend
128147
check_disallowed_env_prefix EASYBUILD_

EESSI-extend-easybuild.eb

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -98,21 +98,26 @@ if (eessi_accelerator_target ~= nil) then
9898
end
9999
end
100100
101+
-- Some environment variables affect behaviour, let's gather them once
102+
local eessi_cvmfs_install = os.getenv("EESSI_CVMFS_INSTALL") ~= nil
103+
local eessi_site_install = os.getenv("EESSI_SITE_INSTALL") ~= nil
104+
local eessi_project_install = os.getenv("EESSI_PROJECT_INSTALL") ~= nil
105+
local eessi_user_install = os.getenv("EESSI_USER_INSTALL") ~= nil
106+
101107
-- Use an installation prefix that we _should_ have write access to
102-
if (os.getenv("EESSI_CVMFS_INSTALL") ~= nil) then
108+
if eessi_cvmfs_install then
103109
-- Make sure no other EESSI install environment variables are set
104-
if ((os.getenv("EESSI_SITE_INSTALL") ~= nil) or (os.getenv("EESSI_PROJECT_INSTALL") ~= nil) or (os.getenv("EESSI_USER_INSTALL") ~= nil)) then
110+
if (eessi_site_install or eessi_project_install or eessi_user_install) then
105111
LmodError("You cannot use EESSI_CVMFS_INSTALL in combination with any other EESSI_*_INSTALL environment variables")
106112
end
107-
eessi_cvmfs_install = true
108113
easybuild_installpath = os.getenv("EESSI_SOFTWARE_PATH")
109114
-- enforce accelerator subdirectory usage for CVMFS installs (only if an accelerator install is requested)
110115
if (eessi_accelerator_target ~= nil) and (cuda_compute_capability ~= nil) and (os.getenv("EESSI_ACCELERATOR_INSTALL") ~= nil) then
111116
easybuild_installpath = pathJoin(easybuild_installpath, eessi_accelerator_target)
112117
end
113-
elseif (os.getenv("EESSI_SITE_INSTALL") ~= nil) then
118+
elseif eessi_site_install then
114119
-- Make sure no other EESSI install environment variables are set
115-
if ((os.getenv("EESSI_PROJECT_INSTALL") ~= nil) or (os.getenv("EESSI_USER_INSTALL") ~= nil)) then
120+
if (eessi_project_install or eessi_user_install) then
116121
LmodError("You cannot use EESSI_SITE_INSTALL in combination with any other EESSI_*_INSTALL environment variables")
117122
end
118123
easybuild_installpath = os.getenv("EESSI_SITE_SOFTWARE_PATH")
@@ -122,35 +127,35 @@ elseif (os.getenv("EESSI_SITE_INSTALL") ~= nil) then
122127
end
123128
else
124129
-- Deal with user and project installs
125-
project_install = os.getenv("EESSI_PROJECT_INSTALL")
130+
project_install_dir = os.getenv("EESSI_PROJECT_INSTALL")
126131
project_modulepath = nil
127-
if (project_install ~= nil) then
132+
if eessi_project_install then
128133
-- Check the folder exists
129-
if not isDir(project_install) then
130-
LmodError("The location of EESSI_PROJECT_INSTALL (" .. project_install .. ") does not exist or is not a folder")
134+
if not isDir(project_install_dir) then
135+
LmodError("The location of EESSI_PROJECT_INSTALL (" .. project_install_dir .. ") does not exist or is not a folder")
131136
end
132137
if (mode() == "load") then
133-
LmodMessage("Configuring for use of EESSI_PROJECT_INSTALL under " .. project_install)
138+
LmodMessage("Configuring for use of EESSI_PROJECT_INSTALL under " .. project_install_dir)
134139
end
135-
easybuild_installpath = string.gsub(os.getenv("EESSI_SOFTWARE_PATH"), os.getenv("EESSI_CVMFS_REPO"), project_install)
140+
easybuild_installpath = string.gsub(os.getenv("EESSI_SOFTWARE_PATH"), os.getenv("EESSI_CVMFS_REPO"), project_install_dir)
136141
project_modulepath = pathJoin(easybuild_installpath, 'modules', 'all')
137142
end
138-
user_install = os.getenv("EESSI_USER_INSTALL")
143+
user_install_dir = os.getenv("EESSI_USER_INSTALL")
139144
user_modulepath = nil
140-
if (user_install ~= nil) then
145+
if eessi_user_install then
141146
-- Check the folder exists
142-
if not isDir(user_install) then
143-
LmodError("The location of EESSI_USER_INSTALL (" .. user_install .. ") does not exist or is not a folder")
147+
if not isDir(user_install_dir) then
148+
LmodError("The location of EESSI_USER_INSTALL (" .. user_install_dir .. ") does not exist or is not a folder")
144149
end
145-
elseif (user_install == nil) and (project_install == nil) then
150+
elseif (user_install_dir == nil) and (project_install_dir == nil) then
146151
-- No need to check for existence when we use a HOME subdir
147-
user_install = pathJoin(os.getenv("HOME"), "eessi")
152+
user_install_dir = pathJoin(os.getenv("HOME"), "eessi")
148153
end
149-
if (user_install ~= nil) then
154+
if (user_install_dir ~= nil) then
150155
if (mode() == "load") then
151-
LmodMessage("Configuring for use of EESSI_USER_INSTALL under " .. user_install)
156+
LmodMessage("Configuring for use of EESSI_USER_INSTALL under " .. user_install_dir)
152157
end
153-
easybuild_installpath = string.gsub(os.getenv("EESSI_SOFTWARE_PATH"), os.getenv("EESSI_CVMFS_REPO"), user_install)
158+
easybuild_installpath = string.gsub(os.getenv("EESSI_SOFTWARE_PATH"), os.getenv("EESSI_CVMFS_REPO"), user_install_dir)
154159
user_modulepath = pathJoin(easybuild_installpath, 'modules', 'all')
155160
end
156161
end
@@ -196,10 +201,29 @@ elseif (project_modulepath ~= nil) then
196201
-- configure MODULEPATH
197202
prepend_path("MODULEPATH", project_modulepath)
198203
end
204+
199205
-- Make sure EasyBuild itself is loaded
206+
-- need to also handle the unload behaviour where the version is defined only before we unload
207+
easybuild_version = os.getenv("EBVERSIONEASYBUILD")
200208
if not ( isloaded("EasyBuild") ) then
201209
load(latest("EasyBuild"))
202210
end
211+
easybuild_version = os.getenv("EBVERSIONEASYBUILD") or easybuild_version
212+
eessi_version = os.getenv("EESSI_VERSION") or "2023.06"
213+
214+
-- Set environment variables that are EasyBuild version specific
215+
if convertToCanonical(easybuild_version) > convertToCanonical("4") then
216+
setenv ("EASYBUILD_STRICT_RPATH_SANITY_CHECK", "1")
217+
setenv ("EASYBUILD_CUDA_SANITY_CHECK_ERROR_ON_FAILED_CHECKS", "1")
218+
setenv ("EASYBUILD_FAIL_ON_MOD_FILES_GCCCORE", "1")
219+
setenv ("EASYBUILD_LOCAL_VAR_NAMING_CHECK", "error")
220+
-- Set environment variables that are EESSI version specific
221+
if convertToCanonical(eessi_version) > convertToCanonical("2023.06") then
222+
setenv ("EASYBUILD_PREFER_PYTHON_SEARCH_PATH", "EBPYTHONPREFIXES")
223+
setenv ("EASYBUILD_MODULE_SEARCH_PATH_HEADERS", "include_paths")
224+
setenv ("EASYBUILD_SEARCH_PATH_CPP_HEADERS", "include_paths")
225+
end
226+
end
203227
"""
204228

205229
moduleclass = 'devel'

0 commit comments

Comments
 (0)