|
194 | 194 | -- local eessi_prefix = os.getenv("EESSI_PREFIX") |
195 | 195 | local eessi_prefix = pathJoin('/home', 'casparl', 'EESSI', 'software-layer-scripts') |
196 | 196 | local script = pathJoin(eessi_prefix, 'scripts', 'gpu_support', 'nvidia', 'get_cuda_driver_version.sh') |
197 | | - LmodMessage("Getting version") |
198 | | - source_sh("bash", script) |
| 197 | + -- Check return code first. We don't want source_sh to raise an LmodError, we just print |
| 198 | + -- an LmodWarning stating we couldn't do a proper version compatibility check |
| 199 | + local rc = os.execute("bash -c 'source " .. script .. "'") |
| 200 | + if rc == 0 then |
| 201 | + source_sh("bash", script) |
| 202 | + end |
199 | 203 | end |
200 | 204 | cudaVersion = os.getenv("EESSI_CUDA_DRIVER_VERSION") |
201 | | - LmodMessage("CUDA VERSION" .. cudaVersion) |
202 | | - if not cudaVersion or cudaVersion == "" then |
203 | | - -- Change to warning? |
204 | | - LmodError("Environment variable EESSI_CUDA_DRIVER_VERSION not found. " .. refer_to_docs) |
205 | | - end |
206 | 205 | local cudaVersion_req = os.getenv("EESSICUDAVERSION") |
207 | | - -- driver CUDA versions don't give a patch version for CUDA |
208 | | - local major, minor = string.match(cudaVersion, "(%d+)%.(%d+)") |
209 | | - local major_req, minor_req, patch_req = string.match(cudaVersion_req, "(%d+)%.(%d+)%.(%d+)") |
210 | | - local driver_libs_need_update = false |
211 | | - if tonumber(major) < tonumber(major_req) then |
212 | | - driver_libs_need_update = true |
213 | | - elseif tonumber(major) == tonumber(major_req) then |
214 | | - if tonumber(minor) < tonumber(minor_req) then |
| 206 | + if not cudaVersion or cudaVersion == "" then |
| 207 | + local suppress_var = "EESSI_CUDA_DRIVER_VERSION_SUPPRESS_WARNING" |
| 208 | + local warn = "Environment variable EESSI_CUDA_DRIVER_VERSION not found. " |
| 209 | + warn = warn .. "Cannot ensure that driver version is new enough for CUDA toolkit version: '" |
| 210 | + warn = warn .. cudaVersion_req .. "'. This module will still be loaded, but may not function " |
| 211 | + warn = warn .. "as expected. Export " .. suppress_var .. "=1" |
| 212 | + local suppress_warn = os.getenv(suppress_var) |
| 213 | + if not suppress_warn or suppress_warn == 1 then |
| 214 | + LmodWarning(warn) |
| 215 | + end |
| 216 | + else |
| 217 | + -- driver CUDA versions don't give a patch version for CUDA |
| 218 | + local major, minor = string.match(cudaVersion, "(%d+)%.(%d+)") |
| 219 | + local major_req, minor_req, patch_req = string.match(cudaVersion_req, "(%d+)%.(%d+)%.(%d+)") |
| 220 | + local driver_libs_need_update = false |
| 221 | + if tonumber(major) < tonumber(major_req) then |
215 | 222 | driver_libs_need_update = true |
| 223 | + elseif tonumber(major) == tonumber(major_req) then |
| 224 | + if tonumber(minor) < tonumber(minor_req) then |
| 225 | + driver_libs_need_update = true |
| 226 | + end |
| 227 | + end |
| 228 | + if driver_libs_need_update == true then |
| 229 | + local advice = "but the module you want to load requires CUDA " .. cudaVersion_req .. ". " |
| 230 | + advice = advice .. "Please update your CUDA driver libraries and then " |
| 231 | + advice = advice .. "let EESSI know about the update.\\n" |
| 232 | + advice = advice .. refer_to_docs |
| 233 | + LmodError("\\nYour driver CUDA version is ", cudaVersion, " ", advice) |
216 | 234 | end |
217 | | - end |
218 | | - if driver_libs_need_update == true then |
219 | | - local advice = "but the module you want to load requires CUDA " .. cudaVersion_req .. ". " |
220 | | - advice = advice .. "Please update your CUDA driver libraries and then " |
221 | | - advice = advice .. "let EESSI know about the update.\\n" |
222 | | - advice = advice .. refer_to_docs |
223 | | - LmodError("\\nYour driver CUDA version is ", cudaVersion, " ", advice) |
224 | 235 | end |
225 | 236 | end |
226 | 237 | end |
|
0 commit comments