|
172 | 172 | else |
173 | 173 | cudaDriverDir = eessi_eprefix .. "/lib/nvidia" |
174 | 174 | end |
175 | | - local cudaVersionFile = cudaDriverDir .. "/cuda_version.txt" |
176 | 175 | local cudaDriverFile = cudaDriverDir .. "/libcuda.so" |
177 | 176 | local cudaDriverExists = isFile(cudaDriverFile) |
178 | 177 | local singularityCudaExists = isFile("/.singularity.d/libs/libcuda.so") |
|
189 | 188 | else |
190 | 189 | -- CUDA driver exists, now we check its version to see if an update is needed |
191 | 190 | if cudaDriverExists then |
192 | | - local cudaVersion = read_file(cudaVersionFile) |
193 | | - if not cudaVersion then |
194 | | - LmodError("No CUDA version file\\n" .. cudaVersionFile .. "\\nfound. " .. refer_to_docs) |
| 191 | + LmodMessage("EESSI_CUDA_DRIVER_VERSION initial: " .. os.getenv("EESSI_CUDA_DRIVER_VERSION")) |
| 192 | + local cudaVersion = os.getenv("EESSI_CUDA_DRIVER_VERSION") |
| 193 | + if not cudaVersion or cudaVersion == "" then |
| 194 | + -- Hardcode for local testing |
| 195 | + -- local eessi_prefix = os.getenv("EESSI_PREFIX") |
| 196 | + local eessi_prefix = pathJoin('/home', 'casparl', 'EESSI', 'software-layer-scripts') |
| 197 | + local script = pathJoin(eessi_prefix, 'scripts', 'gpu_support', 'nvidia', 'get_cuda_driver_version.sh') |
| 198 | + LmodMessage("Getting version") |
| 199 | + source_sh("bash", script) |
| 200 | + end |
| 201 | + cudaVersion = os.getenv("EESSI_CUDA_DRIVER_VERSION") |
| 202 | + LmodMessage("CUDA VERSION" .. cudaVersion) |
| 203 | + if not cudaVersion or cudaVersion == "" then |
| 204 | + -- Change to warning? |
| 205 | + LmodError("Environment variable EESSI_CUDA_DRIVER_VERSION not found. " .. refer_to_docs) |
195 | 206 | end |
196 | 207 | local cudaVersion_req = os.getenv("EESSICUDAVERSION") |
197 | 208 | -- driver CUDA versions don't give a patch version for CUDA |
198 | 209 | local major, minor = string.match(cudaVersion, "(%d+)%.(%d+)") |
199 | 210 | local major_req, minor_req, patch_req = string.match(cudaVersion_req, "(%d+)%.(%d+)%.(%d+)") |
200 | 211 | local driver_libs_need_update = false |
201 | | - if major < major_req then |
| 212 | + if tonumber(major) < tonumber(major_req) then |
202 | 213 | driver_libs_need_update = true |
203 | | - elseif major == major_req then |
204 | | - if minor < minor_req then |
| 214 | + elseif tonumber(major) == tonumber(major_req) then |
| 215 | + if tonumber(minor) < tonumber(minor_req) then |
205 | 216 | driver_libs_need_update = true |
206 | 217 | end |
207 | 218 | end |
|
0 commit comments