@@ -98,21 +98,26 @@ if (eessi_accelerator_target ~= nil) then
98
98
end
99
99
end
100
100
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
+
101
107
-- 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
103
109
-- 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
105
111
LmodError("You cannot use EESSI_CVMFS_INSTALL in combination with any other EESSI_*_INSTALL environment variables")
106
112
end
107
- eessi_cvmfs_install = true
108
113
easybuild_installpath = os.getenv("EESSI_SOFTWARE_PATH")
109
114
-- enforce accelerator subdirectory usage for CVMFS installs (only if an accelerator install is requested)
110
115
if (eessi_accelerator_target ~= nil) and (cuda_compute_capability ~= nil) and (os.getenv("EESSI_ACCELERATOR_INSTALL") ~= nil) then
111
116
easybuild_installpath = pathJoin(easybuild_installpath, eessi_accelerator_target)
112
117
end
113
- elseif (os.getenv("EESSI_SITE_INSTALL") ~= nil) then
118
+ elseif eessi_site_install then
114
119
-- 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
116
121
LmodError("You cannot use EESSI_SITE_INSTALL in combination with any other EESSI_*_INSTALL environment variables")
117
122
end
118
123
easybuild_installpath = os.getenv("EESSI_SITE_SOFTWARE_PATH")
@@ -122,35 +127,35 @@ elseif (os.getenv("EESSI_SITE_INSTALL") ~= nil) then
122
127
end
123
128
else
124
129
-- Deal with user and project installs
125
- project_install = os.getenv("EESSI_PROJECT_INSTALL")
130
+ project_install_dir = os.getenv("EESSI_PROJECT_INSTALL")
126
131
project_modulepath = nil
127
- if (project_install ~= nil) then
132
+ if eessi_project_install then
128
133
-- 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")
131
136
end
132
137
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 )
134
139
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 )
136
141
project_modulepath = pathJoin(easybuild_installpath, 'modules', 'all')
137
142
end
138
- user_install = os.getenv("EESSI_USER_INSTALL")
143
+ user_install_dir = os.getenv("EESSI_USER_INSTALL")
139
144
user_modulepath = nil
140
- if (user_install ~= nil) then
145
+ if eessi_user_install then
141
146
-- 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")
144
149
end
145
- elseif (user_install == nil) and (project_install == nil) then
150
+ elseif (user_install_dir == nil) and (project_install_dir == nil) then
146
151
-- 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")
148
153
end
149
- if (user_install ~= nil) then
154
+ if (user_install_dir ~= nil) then
150
155
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 )
152
157
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 )
154
159
user_modulepath = pathJoin(easybuild_installpath, 'modules', 'all')
155
160
end
156
161
end
@@ -196,10 +201,29 @@ elseif (project_modulepath ~= nil) then
196
201
-- configure MODULEPATH
197
202
prepend_path("MODULEPATH", project_modulepath)
198
203
end
204
+
199
205
-- 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")
200
208
if not ( isloaded("EasyBuild") ) then
201
209
load(latest("EasyBuild"))
202
210
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
203
227
"""
204
228
205
229
moduleclass = 'devel'
0 commit comments