|
110 | 110 | end
|
111 | 111 |
|
112 | 112 |
|
113 |
| -local function eessi_cuda_enabled_load_hook(t) |
| 113 | +local function eessi_cuda_and_libraries_enabled_load_hook(t) |
114 | 114 | local frameStk = require("FrameStk"):singleton()
|
115 | 115 | local mt = frameStk:mt()
|
116 | 116 | local simpleName = string.match(t.modFullName, "(.-)/")
|
117 |
| - -- If we try to load CUDA itself, check if the full CUDA SDK was installed on the host in host_injections. |
118 |
| - -- This is required for end users to build additional CUDA software. If the full SDK isn't present, refuse |
119 |
| - -- to load the CUDA module and print an informative message on how to set up GPU support for EESSI |
| 117 | + local packagesList = { ["CUDA"] = true, ["cuDNN"] = true } |
| 118 | + -- If we try to load any of the modules in packagesList, we check if the |
| 119 | + -- full package was installed on the host in host_injections. |
| 120 | + -- This is required for end users to build additional software that depends |
| 121 | + -- on the package. If the full SDK isn't present, refuse |
| 122 | + -- to load the module and print an informative message on how to set up GPU support for EESSI |
120 | 123 | local refer_to_docs = "For more information on how to do this, see https://www.eessi.io/docs/site_specific_config/gpu/.\\n"
|
121 |
| - if simpleName == 'CUDA' then |
| 124 | + if packagesList[simpleName] then |
| 125 | + -- simpleName is a module in packagesList |
122 | 126 | -- get the full host_injections path
|
123 | 127 | local hostInjections = string.gsub(os.getenv('EESSI_SOFTWARE_PATH') or "", 'versions', 'host_injections')
|
124 |
| - -- build final path where the CUDA software should be installed |
125 |
| - local cudaEasyBuildDir = hostInjections .. "/software/" .. t.modFullName .. "/easybuild" |
126 |
| - local cudaDirExists = isDir(cudaEasyBuildDir) |
127 |
| - if not cudaDirExists then |
| 128 | +
|
| 129 | + -- build final path where the software should be installed |
| 130 | + local packageEasyBuildDir = hostInjections .. "/software/" .. t.modFullName .. "/easybuild" |
| 131 | + local packageDirExists = isDir(packageEasyBuildDir) |
| 132 | + if not packageDirExists then |
128 | 133 | local advice = "but while the module file exists, the actual software is not entirely shipped with EESSI "
|
129 |
| - advice = advice .. "due to licencing. You will need to install a full copy of the CUDA SDK where EESSI " |
| 134 | + advice = advice .. "due to licencing. You will need to install a full copy of the " .. simpleName .. " package where EESSI " |
130 | 135 | advice = advice .. "can find it.\\n"
|
131 | 136 | advice = advice .. refer_to_docs
|
132 | 137 | LmodError("\\nYou requested to load ", simpleName, " ", advice)
|
133 | 138 | end
|
134 | 139 | end
|
135 |
| - -- when loading CUDA enabled modules check if the necessary driver libraries are accessible to the EESSI linker, |
| 140 | + -- when loading CUDA (and cu*) enabled modules check if the necessary driver libraries are accessible to the EESSI linker, |
136 | 141 | -- otherwise, refuse to load the requested module and print error message
|
137 | 142 | local checkGpu = mt:haveProperty(simpleName,"arch","gpu")
|
138 | 143 | local overrideGpuCheck = os.getenv("EESSI_OVERRIDE_GPU_CHECK")
|
139 | 144 | if checkGpu and (overrideGpuCheck == nil) then
|
140 | 145 | local arch = os.getenv("EESSI_CPU_FAMILY") or ""
|
141 |
| - local cudaVersionFile = "/cvmfs/software.eessi.io/host_injections/nvidia/" .. arch .. "/latest/cuda_version.txt" |
142 |
| - local cudaDriverFile = "/cvmfs/software.eessi.io/host_injections/nvidia/" .. arch .. "/latest/libcuda.so" |
| 146 | + local cvmfs_repo = os.getenv("EESSI_CVMFS_REPO") or "" |
| 147 | + local cudaVersionFile = cvmfs_repo .. "/host_injections/nvidia/" .. arch .. "/latest/cuda_version.txt" |
| 148 | + local cudaDriverFile = cvmfs_repo .. "/host_injections/nvidia/" .. arch .. "/latest/libcuda.so" |
143 | 149 | local cudaDriverExists = isFile(cudaDriverFile)
|
144 | 150 | local singularityCudaExists = isFile("/.singularity.d/libs/libcuda.so")
|
145 | 151 | if not (cudaDriverExists or singularityCudaExists) then
|
|
197 | 203 | -- Also: make it non-local, so it can be imported and extended by other lmodrc files if needed
|
198 | 204 | function eessi_load_hook(t)
|
199 | 205 | eessi_espresso_deprecated_message(t)
|
200 |
| - -- Only apply CUDA hooks if the loaded module is in the EESSI prefix |
201 |
| - -- This avoids getting an Lmod Error when trying to load a CUDA module from a local software stack |
| 206 | + -- Only apply CUDA and cu*-library hooks if the loaded module is in the EESSI prefix |
| 207 | + -- This avoids getting an Lmod Error when trying to load a CUDA or cu* module from a local software stack |
202 | 208 | if from_eessi_prefix(t) then
|
203 |
| - eessi_cuda_enabled_load_hook(t) |
| 209 | + eessi_cuda_and_libraries_enabled_load_hook(t) |
204 | 210 | end
|
205 | 211 | end
|
206 | 212 |
|
|
0 commit comments