From cac7d8ce4448e9f56ec398a12c881cf528cc8036 Mon Sep 17 00:00:00 2001 From: Alan O'Cais Date: Fri, 10 Nov 2023 15:58:33 +0100 Subject: [PATCH 01/11] Add support for installing CUDA and CUDA-Samples --- EESSI-pilot-install-software.sh | 2 +- create_lmodrc.py | 108 ++++++++++++++++++++++++++++++ eb_hooks.py | 82 +++++++++++++++++++++++ eessi-2023.06-eb-4.8.1-system.yml | 1 + eessi-2023.06-eb-4.8.2-2023a.yml | 2 + 5 files changed, 194 insertions(+), 1 deletion(-) create mode 100644 eessi-2023.06-eb-4.8.2-2023a.yml diff --git a/EESSI-pilot-install-software.sh b/EESSI-pilot-install-software.sh index 9586abde1d..9baa987b01 100755 --- a/EESSI-pilot-install-software.sh +++ b/EESSI-pilot-install-software.sh @@ -229,7 +229,7 @@ done echo ">> Creating/updating Lmod cache..." export LMOD_RC="${EASYBUILD_INSTALLPATH}/.lmod/lmodrc.lua" -if [ ! -f $LMOD_RC ]; then +if [ ! -f $LMOD_RC ] || 'create_lmodrc.py' == $(cat ${pr_diff} | grep '^+++' | cut -f2 -d' ' | sed 's@^[a-z]/@@g' | grep '^create_lmodrc.py$' | egrep -v 'known-issues|missing'); then python3 $TOPDIR/create_lmodrc.py ${EASYBUILD_INSTALLPATH} check_exit_code $? "$LMOD_RC created" "Failed to create $LMOD_RC" fi diff --git a/create_lmodrc.py b/create_lmodrc.py index ae65153a20..47195e5c1f 100755 --- a/create_lmodrc.py +++ b/create_lmodrc.py @@ -17,6 +17,113 @@ } """ +GPU_LMOD_RC ="""require("strict") +local hook = require("Hook") +local open = io.open + +local function read_file(path) + local file = open(path, "rb") -- r read mode and b binary mode + if not file then return nil end + local content = file:read "*a" -- *a or *all reads the whole file + file:close() + return content +end + +-- from https://stackoverflow.com/a/40195356 +--- Check if a file or directory exists in this path +function exists(file) + local ok, err, code = os.rename(file, file) + if not ok then + if code == 13 then + -- Permission denied, but it exists + return true + end + end + return ok, err +end + +local function visible_hook(modT) + local frameStk = require("FrameStk"):singleton() + local mt = frameStk:mt() + local cudaDir = string.gsub(os.getenv('EESSI_SOFTWARE_PATH') or "", 'versions', 'host_injections') + local cudaDirExists = exists(cudaDir) + if not cudaDirExists then + local haveGpu = mt:haveProperty(modT.sn,"arch","gpu") + if haveGpu then + modT.isVisible = false + end + end +end + +local function cuda_enabled_load_hook(t) + local frameStk = require("FrameStk"):singleton() + local mt = frameStk:mt() + local simpleName = string.match(t.modFullName, "(.-)/") + local eprefix = os.getenv('EESSI_PREFIX') .. "/init/gpu_support" + -- if we try to load CUDA itself, check if the software exists in host_injections + -- otherwise, refuse to load CUDA and print error message + if simpleName == 'CUDA' then + -- get the full host_injections path + local hostInjections = string.gsub(os.getenv('EESSI_SOFTWARE_PATH') or "", 'versions', 'host_injections') + -- build final path where the CUDA software should be installed + local cudaEasyBuildDir = hostInjections .. "/software/" .. t.modFullName .. "/easybuild" + local cudaDirExists = exists(cudaEasyBuildDir) + if not cudaDirExists then + io.stderr:write("You requested to load ",simpleName,"\\n") + io.stderr:write("While the module file exists, the actual software is not shipped with EESSI.\\n") + io.stderr:write("In order to be able to use the CUDA module, please follow the instructions in the\\n") + io.stderr:write("gpu_support folder. Adding the CUDA software can be as easy as:\\n") + io.stderr:write("export INSTALL_CUDA=true && ./add_nvidia_gpu_support.sh\\n") + frameStk:__clear() + end + end + -- when loading CUDA enabled modules check if the necessary matching compatibility libraries are installed + -- otherwise, refuse to load the requested module and print error message + local haveGpu = mt:haveProperty(simpleName,"arch","gpu") + if haveGpu then + local arch = os.getenv("EESSI_CPU_FAMILY") or "" + local cudaVersionFile = "/cvmfs/pilot.eessi-hpc.org/host_injections/nvidia/" .. arch .. "/latest/version.txt" + local cudaDriverExists = exists(cudaVersionFile) + local singularityCudaExists = exists("/.singularity.d/libs/libcuda.so") + if not (cudaDriverExists or singularityCudaExists) then + io.stderr:write("You requested to load ",simpleName,"\\n") + io.stderr:write("which relies on the CUDA runtime environment and its compatibility libraries.\\n") + io.stderr:write("In order to be able to use the module, please follow the instructions in the\\n") + io.stderr:write("gpu_support folder. Installing the needed compatibility libraries can be as easy as:\\n") + io.stderr:write("./add_nvidia_gpu_support.sh\\n") + frameStk:__clear() + else + if cudaDriverExists then + local cudaVersion = read_file(cudaVersionFile) + local cudaVersion_req = os.getenv("EESSICUDAVERSION") + local major, minor, patch = string.match(cudaVersion, "(%d+)%.(%d+)%.(%d+)") + local major_req, minor_req, patch_req = string.match(cudaVersion_req, "(%d+)%.(%d+)%.(%d+)") + local compat_libs_need_update = false + if major < major_req then + compat_libs_need_update = true + elseif major == major_req then + if minor < minor_req then + compat_libs_need_update = true + elseif minor == minor_req then + if patch < patch_req then + compat_libs_need_update = true + end + end + end + if compat_libs_need_update == true then + io.stderr:write("You requested to load CUDA version ",cudaVersion) + io.stderr:write("but the module you want to load requires CUDA version ",cudaVersion_req,".\\n") + io.stderr:write("Please update your CUDA compatibility libraries in order to use ",simpleName,".\\n") + frameStk:__clear() + end + end + end + end +end + +hook.register("load", cuda_enabled_load_hook) +hook.register("isVisibleHook", visible_hook) +""" def error(msg): sys.stderr.write("ERROR: %s\n" % msg) @@ -36,6 +143,7 @@ def error(msg): 'dot_lmod': DOT_LMOD, 'prefix': prefix, } +lmodrc_txt += '\n' + GPU_LMOD_RC try: os.makedirs(os.path.dirname(lmodrc_path), exist_ok=True) with open(lmodrc_path, 'w') as fp: diff --git a/eb_hooks.py b/eb_hooks.py index 31f2b9588d..c99ff2b436 100644 --- a/eb_hooks.py +++ b/eb_hooks.py @@ -64,6 +64,8 @@ def parse_hook(ec, *args, **kwargs): if ec.name in PARSE_HOOKS: PARSE_HOOKS[ec.name](ec, eprefix) + # inject the GPU property (if required) + ec = inject_gpu_property(ec) def pre_prepare_hook(self, *args, **kwargs): """Main pre-prepare hook: trigger custom functions.""" @@ -209,6 +211,12 @@ def pre_configure_hook(self, *args, **kwargs): PRE_CONFIGURE_HOOKS[self.name](self, *args, **kwargs) +def post_sanitycheck_hook(self, *args, **kwargs): + """Main post-sanity-check hook: trigger custom functions based on software name.""" + if self.name in POST_SANITYCHECK_HOOKS: + POST_SANITYCHECK_HOOKS[self.name](self, *args, **kwargs) + + def pre_configure_hook_openblas_optarch_generic(self, *args, **kwargs): """ Pre-configure hook for OpenBLAS: add DYNAMIC_ARCH=1 to build/test/install options when using --optarch=GENERIC @@ -328,6 +336,76 @@ def pre_single_extension_isoband(ext, *args, **kwargs): # cfr. https://github.com/r-lib/isoband/commit/6984e6ce8d977f06e0b5ff73f5d88e5c9a44c027 ext.cfg['preinstallopts'] = "sed -i 's/SIGSTKSZ/32768/g' src/testthat/vendor/catch.h && " +def post_sanitycheck_cuda(self, *args, **kwargs): + """Delete CUDA files we are not allowed to ship and replace them with a symlink to a possible installation under host_injections.""" + print_msg("Replacing CUDA stuff we cannot ship with symlinks...") + # read CUDA EULA + eula_path = os.path.join(self.installdir, "EULA.txt") + tmp_buffer = [] + with open(eula_path) as infile: + copy = False + for line in infile: + if line.strip() == "2.6. Attachment A": + copy = True + continue + elif line.strip() == "2.7. Attachment B": + copy = False + continue + elif copy: + tmp_buffer.append(line) + # create whitelist without file extensions, they're not really needed and they only complicate things + whitelist = ['EULA', 'README'] + file_extensions = [".so", ".a", ".h", ".bc"] + for tmp in tmp_buffer: + for word in tmp.split(): + if any(ext in word for ext in file_extensions): + whitelist.append(word.split(".")[0]) + whitelist = list(set(whitelist)) + # Do some quick checks for things we should or shouldn't have in the list + if "nvcc" in whitelist: + raise EasyBuildError("Found 'nvcc' in whitelist: %s" % whitelist) + if "libcudart" not in whitelist: + raise EasyBuildError("Did not find 'libcudart' in whitelist: %s" % whitelist) + # iterate over all files in the CUDA path + for root, dirs, files in os.walk(self.installdir): + for filename in files: + # we only really care about real files, i.e. not symlinks + if not os.path.islink(os.path.join(root, filename)): + # check if the current file is part of the whitelist + basename = filename.split(".")[0] + if basename not in whitelist: + # if it is not in the whitelist, delete the file and create a symlink to host_injections + source = os.path.join(root, filename) + target = source.replace("versions", "host_injections") + os.remove(source) + # Using os.symlink requires the existence of the target directory, so we use os.system + system_command="ln -s '%s' '%s'" % (target, source) + if os.system(system_command) != 0: + raise EasyBuildError("Failed to create symbolic link: %s" % system_command) + + +def inject_gpu_property(ec): + ec_dict = ec.asdict() + # Check if CUDA is in the dependencies, if so add the GPU Lmod tag + if ("CUDA" in [dep[0] for dep in iter(ec_dict["dependencies"])]): + ec.log.info("[parse hook] Injecting gpu as Lmod arch property and envvar with CUDA version") + key = "modluafooter" + value = 'add_property("arch","gpu")' + cuda_version = 0 + for dep in iter(ec_dict["dependencies"]): + # Make CUDA a build dependency only (rpathing saves us from link errors) + if "CUDA" in dep[0]: + cuda_version = dep[1] + ec_dict["dependencies"].remove(dep) + ec_dict["builddependencies"].append(dep) if dep not in ec_dict["builddependencies"] else ec_dict["builddependencies"] + value = "\n".join([value, 'setenv("EESSICUDAVERSION","%s")' % cuda_version]) + if key in ec_dict: + if not value in ec_dict[key]: + ec[key] = "\n".join([ec_dict[key], value]) + else: + ec[key] = value + return ec + PARSE_HOOKS = { 'CGAL': parse_hook_cgal_toolchainopts_precise, @@ -358,3 +436,7 @@ def pre_single_extension_isoband(ext, *args, **kwargs): 'isoband': pre_single_extension_isoband, 'testthat': pre_single_extension_testthat, } + +POST_SANITYCHECK_HOOKS = { + 'CUDA': post_sanitycheck_cuda, +} diff --git a/eessi-2023.06-eb-4.8.1-system.yml b/eessi-2023.06-eb-4.8.1-system.yml index b0731d2534..64ed1abc5f 100644 --- a/eessi-2023.06-eb-4.8.1-system.yml +++ b/eessi-2023.06-eb-4.8.1-system.yml @@ -7,3 +7,4 @@ easyconfigs: - EasyBuild-4.8.2.eb: options: from-pr: 19105 + - CUDA-12.1.1.eb diff --git a/eessi-2023.06-eb-4.8.2-2023a.yml b/eessi-2023.06-eb-4.8.2-2023a.yml new file mode 100644 index 0000000000..01a47bbc99 --- /dev/null +++ b/eessi-2023.06-eb-4.8.2-2023a.yml @@ -0,0 +1,2 @@ +easyconfigs: + - CUDA-Samples-12.1-GCC-12.3.0-CUDA-12.1.1.eb From 9d275fef738c9f5d5f488d31d4bbda6f1d39ae32 Mon Sep 17 00:00:00 2001 From: Alan O'Cais Date: Fri, 10 Nov 2023 16:39:19 +0100 Subject: [PATCH 02/11] Use tweaked version of CUDA-Samples --- eessi-2023.06-eb-4.8.2-2023a.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eessi-2023.06-eb-4.8.2-2023a.yml b/eessi-2023.06-eb-4.8.2-2023a.yml index 01a47bbc99..04ac0084ae 100644 --- a/eessi-2023.06-eb-4.8.2-2023a.yml +++ b/eessi-2023.06-eb-4.8.2-2023a.yml @@ -1,2 +1,4 @@ easyconfigs: - CUDA-Samples-12.1-GCC-12.3.0-CUDA-12.1.1.eb + options: + from-pr: 19189 From 704824a63ffa9a7bf74901e8cd82b85779f7d0c5 Mon Sep 17 00:00:00 2001 From: Caspar van Leeuwen <33718780+casparvl@users.noreply.github.com> Date: Tue, 21 Nov 2023 18:15:31 +0100 Subject: [PATCH 03/11] Update eessi-2023.06-eb-4.8.2-2023a.yml Co-authored-by: Kenneth Hoste --- eessi-2023.06-eb-4.8.2-2023a.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/eessi-2023.06-eb-4.8.2-2023a.yml b/eessi-2023.06-eb-4.8.2-2023a.yml index 01a47bbc99..cbcc3caca0 100644 --- a/eessi-2023.06-eb-4.8.2-2023a.yml +++ b/eessi-2023.06-eb-4.8.2-2023a.yml @@ -1,2 +1,7 @@ easyconfigs: - - CUDA-Samples-12.1-GCC-12.3.0-CUDA-12.1.1.eb + - CUDA-Samples-12.1-GCC-12.3.0-CUDA-12.1.1.eb: + # use easyconfig that only install subset of CUDA samples, + # to circumvent problem with nvcc linking to glibc of host OS; + # see https://github.com/easybuilders/easybuild-easyconfigs/pull/19189 + options: + from-pr: 19189 From b42b2d76464112f54f734ccd7055a8fa883e54f4 Mon Sep 17 00:00:00 2001 From: ocaisa Date: Tue, 21 Nov 2023 22:37:35 +0100 Subject: [PATCH 04/11] Update EESSI-pilot-install-software.sh Co-authored-by: Kenneth Hoste --- EESSI-pilot-install-software.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/EESSI-pilot-install-software.sh b/EESSI-pilot-install-software.sh index 9baa987b01..de921b8855 100755 --- a/EESSI-pilot-install-software.sh +++ b/EESSI-pilot-install-software.sh @@ -229,7 +229,8 @@ done echo ">> Creating/updating Lmod cache..." export LMOD_RC="${EASYBUILD_INSTALLPATH}/.lmod/lmodrc.lua" -if [ ! -f $LMOD_RC ] || 'create_lmodrc.py' == $(cat ${pr_diff} | grep '^+++' | cut -f2 -d' ' | sed 's@^[a-z]/@@g' | grep '^create_lmodrc.py$' | egrep -v 'known-issues|missing'); then +lmodrc_changed=$(cat ${pr_diff} | grep '^+++' | cut -f2 -d' ' | sed 's@^[a-z]/@@g' | grep '^create_lmodrc.py$' > /dev/null; echo $?) +if [ ! -f $LMOD_RC ] || [ ${lmodrc_changed} == '0' ]; then python3 $TOPDIR/create_lmodrc.py ${EASYBUILD_INSTALLPATH} check_exit_code $? "$LMOD_RC created" "Failed to create $LMOD_RC" fi From ddb20df873436f0cddd6452169e031fbc13f3191 Mon Sep 17 00:00:00 2001 From: Alan O'Cais Date: Thu, 30 Nov 2023 16:51:30 +0100 Subject: [PATCH 05/11] Try to simplify the Lmod rc plugin, address review comments, make sure we have EULA acceptance for CUDA --- create_lmodrc.py | 88 ++++++++++--------------------- eb_hooks.py | 4 ++ eessi-2023.06-eb-4.8.1-system.yml | 5 +- 3 files changed, 36 insertions(+), 61 deletions(-) diff --git a/create_lmodrc.py b/create_lmodrc.py index 47195e5c1f..4be91f3aaa 100755 --- a/create_lmodrc.py +++ b/create_lmodrc.py @@ -29,92 +29,61 @@ return content end --- from https://stackoverflow.com/a/40195356 ---- Check if a file or directory exists in this path -function exists(file) - local ok, err, code = os.rename(file, file) - if not ok then - if code == 13 then - -- Permission denied, but it exists - return true - end - end - return ok, err -end - -local function visible_hook(modT) - local frameStk = require("FrameStk"):singleton() - local mt = frameStk:mt() - local cudaDir = string.gsub(os.getenv('EESSI_SOFTWARE_PATH') or "", 'versions', 'host_injections') - local cudaDirExists = exists(cudaDir) - if not cudaDirExists then - local haveGpu = mt:haveProperty(modT.sn,"arch","gpu") - if haveGpu then - modT.isVisible = false - end - end -end - local function cuda_enabled_load_hook(t) local frameStk = require("FrameStk"):singleton() local mt = frameStk:mt() local simpleName = string.match(t.modFullName, "(.-)/") - local eprefix = os.getenv('EESSI_PREFIX') .. "/init/gpu_support" - -- if we try to load CUDA itself, check if the software exists in host_injections - -- otherwise, refuse to load CUDA and print error message + -- If we try to load CUDA itself, check if the full CUDA SDK was installed on the host in host_injections. + -- This is required for end users to build additional CUDA software. If the full SDK isn't present, refuse + -- to load the CUDA module and print an informative message on how to set up GPU support for EESSI if simpleName == 'CUDA' then -- get the full host_injections path local hostInjections = string.gsub(os.getenv('EESSI_SOFTWARE_PATH') or "", 'versions', 'host_injections') -- build final path where the CUDA software should be installed local cudaEasyBuildDir = hostInjections .. "/software/" .. t.modFullName .. "/easybuild" - local cudaDirExists = exists(cudaEasyBuildDir) + local cudaDirExists = isDir(cudaEasyBuildDir) if not cudaDirExists then - io.stderr:write("You requested to load ",simpleName,"\\n") - io.stderr:write("While the module file exists, the actual software is not shipped with EESSI.\\n") - io.stderr:write("In order to be able to use the CUDA module, please follow the instructions in the\\n") - io.stderr:write("gpu_support folder. Adding the CUDA software can be as easy as:\\n") - io.stderr:write("export INSTALL_CUDA=true && ./add_nvidia_gpu_support.sh\\n") - frameStk:__clear() + local advice = "While the module file exists, the actual software is not shipped with EESSI.\\n" + advice = advice .. "In order to be able to use the CUDA module, please follow the instructions \\n" + advice = advice .. "available under https://www.eessi.io/docs/gpu/\\n" + LmodError("You requested to load ", simpleName, "\\n", advice) end end - -- when loading CUDA enabled modules check if the necessary matching compatibility libraries are installed + -- when loading CUDA enabled modules check if the necessary driver libraries are accessible to the EESSI linker, -- otherwise, refuse to load the requested module and print error message local haveGpu = mt:haveProperty(simpleName,"arch","gpu") if haveGpu then local arch = os.getenv("EESSI_CPU_FAMILY") or "" - local cudaVersionFile = "/cvmfs/pilot.eessi-hpc.org/host_injections/nvidia/" .. arch .. "/latest/version.txt" - local cudaDriverExists = exists(cudaVersionFile) - local singularityCudaExists = exists("/.singularity.d/libs/libcuda.so") + local cudaVersionFile = "/cvmfs/pilot.eessi-hpc.org/host_injections/nvidia/" .. arch .. "/latest/cuda_version.txt" + local cudaDriverFile = "/cvmfs/pilot.eessi-hpc.org/host_injections/nvidia/" .. arch .. "/latest/libcuda.so" + local cudaDriverExists = isFile(cudaDriverFile) + local singularityCudaExists = isFile("/.singularity.d/libs/libcuda.so") if not (cudaDriverExists or singularityCudaExists) then - io.stderr:write("You requested to load ",simpleName,"\\n") - io.stderr:write("which relies on the CUDA runtime environment and its compatibility libraries.\\n") - io.stderr:write("In order to be able to use the module, please follow the instructions in the\\n") - io.stderr:write("gpu_support folder. Installing the needed compatibility libraries can be as easy as:\\n") - io.stderr:write("./add_nvidia_gpu_support.sh\\n") - frameStk:__clear() + local advice = "which relies on the CUDA runtime environment and driver libraries.\\n" + advice = advice .. "In order to be able to use the module, please follow the instructions\\n" + advice = advice .. "available under https://www.eessi.io/docs/gpu/\\n" + LmodError("You requested to load ", simpleName, "\\n", advice) else + -- CUDA driver exists, now we check its version to see if an update is needed if cudaDriverExists then local cudaVersion = read_file(cudaVersionFile) local cudaVersion_req = os.getenv("EESSICUDAVERSION") - local major, minor, patch = string.match(cudaVersion, "(%d+)%.(%d+)%.(%d+)") + -- driver CUDA versions don't give a patch version for CUDA + local major, minor = string.match(cudaVersion, "(%d+)%.(%d+)%") local major_req, minor_req, patch_req = string.match(cudaVersion_req, "(%d+)%.(%d+)%.(%d+)") - local compat_libs_need_update = false + local driver_libs_need_update = false if major < major_req then - compat_libs_need_update = true + driver_libs_need_update = true elseif major == major_req then if minor < minor_req then - compat_libs_need_update = true - elseif minor == minor_req then - if patch < patch_req then - compat_libs_need_update = true - end + driver_libs_need_update = true end end - if compat_libs_need_update == true then - io.stderr:write("You requested to load CUDA version ",cudaVersion) - io.stderr:write("but the module you want to load requires CUDA version ",cudaVersion_req,".\\n") - io.stderr:write("Please update your CUDA compatibility libraries in order to use ",simpleName,".\\n") - frameStk:__clear() + if driver_libs_need_update == true then + local advice = "but the module you want to load requires CUDA " .. cudaVersion_req .. ".\\n" + advice = "Please update your CUDA driver libraries and then follow the instructions \\n" + advice = "under https://www.eessi.io/docs/gpu/ to let EESSI know about the update.\\n" + LmodError("Your driver CUDA version is ", cudaVersion, "\\n", advice) end end end @@ -122,7 +91,6 @@ end hook.register("load", cuda_enabled_load_hook) -hook.register("isVisibleHook", visible_hook) """ def error(msg): diff --git a/eb_hooks.py b/eb_hooks.py index c99ff2b436..a1702ab832 100644 --- a/eb_hooks.py +++ b/eb_hooks.py @@ -377,6 +377,10 @@ def post_sanitycheck_cuda(self, *args, **kwargs): # if it is not in the whitelist, delete the file and create a symlink to host_injections source = os.path.join(root, filename) target = source.replace("versions", "host_injections") + # Make sure source and target are not the same + if source == target: + raise EasyBuildError("Source (%s) and target (%s) are the same location, are you sure you are" + "using this hook for an EESSI installation?") os.remove(source) # Using os.symlink requires the existence of the target directory, so we use os.system system_command="ln -s '%s' '%s'" % (target, source) diff --git a/eessi-2023.06-eb-4.8.1-system.yml b/eessi-2023.06-eb-4.8.1-system.yml index 64ed1abc5f..59199dc597 100644 --- a/eessi-2023.06-eb-4.8.1-system.yml +++ b/eessi-2023.06-eb-4.8.1-system.yml @@ -7,4 +7,7 @@ easyconfigs: - EasyBuild-4.8.2.eb: options: from-pr: 19105 - - CUDA-12.1.1.eb + - CUDA-12.1.1.eb: + options: + include-easyblocks-from-pr: 3045 + accept-eula-for: CUDA From 7fac7e5bfcc0278df366e97cc6affd24b6278ede Mon Sep 17 00:00:00 2001 From: Alan O'Cais Date: Thu, 30 Nov 2023 17:21:07 +0100 Subject: [PATCH 06/11] Typo --- create_lmodrc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/create_lmodrc.py b/create_lmodrc.py index 4be91f3aaa..c0e8591930 100755 --- a/create_lmodrc.py +++ b/create_lmodrc.py @@ -69,7 +69,7 @@ local cudaVersion = read_file(cudaVersionFile) local cudaVersion_req = os.getenv("EESSICUDAVERSION") -- driver CUDA versions don't give a patch version for CUDA - local major, minor = string.match(cudaVersion, "(%d+)%.(%d+)%") + local major, minor = string.match(cudaVersion, "(%d+)%.(%d+)") local major_req, minor_req, patch_req = string.match(cudaVersion_req, "(%d+)%.(%d+)%.(%d+)") local driver_libs_need_update = false if major < major_req then From e4bdfc9c02aa2bccb57bffc17d59a45a5252d6d5 Mon Sep 17 00:00:00 2001 From: Alan O'Cais Date: Thu, 30 Nov 2023 17:23:18 +0100 Subject: [PATCH 07/11] Typo --- create_lmodrc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/create_lmodrc.py b/create_lmodrc.py index c0e8591930..fd8c9890d9 100755 --- a/create_lmodrc.py +++ b/create_lmodrc.py @@ -81,8 +81,8 @@ end if driver_libs_need_update == true then local advice = "but the module you want to load requires CUDA " .. cudaVersion_req .. ".\\n" - advice = "Please update your CUDA driver libraries and then follow the instructions \\n" - advice = "under https://www.eessi.io/docs/gpu/ to let EESSI know about the update.\\n" + advice = advice .. "Please update your CUDA driver libraries and then follow the instructions \\n" + advice = advice .. "under https://www.eessi.io/docs/gpu/ to let EESSI know about the update.\\n" LmodError("Your driver CUDA version is ", cudaVersion, "\\n", advice) end end From b5e409076789384f8ed322b953c04cc1d1236121 Mon Sep 17 00:00:00 2001 From: Alan O'Cais Date: Thu, 30 Nov 2023 17:27:30 +0100 Subject: [PATCH 08/11] Tidy up --- create_lmodrc.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/create_lmodrc.py b/create_lmodrc.py index fd8c9890d9..a00c5e3241 100755 --- a/create_lmodrc.py +++ b/create_lmodrc.py @@ -46,7 +46,7 @@ local advice = "While the module file exists, the actual software is not shipped with EESSI.\\n" advice = advice .. "In order to be able to use the CUDA module, please follow the instructions \\n" advice = advice .. "available under https://www.eessi.io/docs/gpu/\\n" - LmodError("You requested to load ", simpleName, "\\n", advice) + LmodError("\\nYou requested to load ", simpleName, "\\n", advice) end end -- when loading CUDA enabled modules check if the necessary driver libraries are accessible to the EESSI linker, @@ -62,7 +62,7 @@ local advice = "which relies on the CUDA runtime environment and driver libraries.\\n" advice = advice .. "In order to be able to use the module, please follow the instructions\\n" advice = advice .. "available under https://www.eessi.io/docs/gpu/\\n" - LmodError("You requested to load ", simpleName, "\\n", advice) + LmodError("\\nYou requested to load ", simpleName, "\\n", advice) else -- CUDA driver exists, now we check its version to see if an update is needed if cudaDriverExists then @@ -83,7 +83,7 @@ local advice = "but the module you want to load requires CUDA " .. cudaVersion_req .. ".\\n" advice = advice .. "Please update your CUDA driver libraries and then follow the instructions \\n" advice = advice .. "under https://www.eessi.io/docs/gpu/ to let EESSI know about the update.\\n" - LmodError("Your driver CUDA version is ", cudaVersion, "\\n", advice) + LmodError("\\nYour driver CUDA version is ", cudaVersion, "\\n", advice) end end end From 213baa6dcd141cc2c93cdf9ffcdbe280a3f289b3 Mon Sep 17 00:00:00 2001 From: Alan O'Cais Date: Thu, 30 Nov 2023 17:31:08 +0100 Subject: [PATCH 09/11] Let Lmod handle most of the CRs --- create_lmodrc.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/create_lmodrc.py b/create_lmodrc.py index a00c5e3241..6d1e07996e 100755 --- a/create_lmodrc.py +++ b/create_lmodrc.py @@ -43,10 +43,10 @@ local cudaEasyBuildDir = hostInjections .. "/software/" .. t.modFullName .. "/easybuild" local cudaDirExists = isDir(cudaEasyBuildDir) if not cudaDirExists then - local advice = "While the module file exists, the actual software is not shipped with EESSI.\\n" - advice = advice .. "In order to be able to use the CUDA module, please follow the instructions \\n" - advice = advice .. "available under https://www.eessi.io/docs/gpu/\\n" - LmodError("\\nYou requested to load ", simpleName, "\\n", advice) + local advice = "While the module file exists, the actual software is not shipped with EESSI. " + advice = advice .. "In order to be able to use the CUDA module, please follow the instructions " + advice = advice .. "available under https://www.eessi.io/docs/gpu/" + LmodError("\\nYou requested to load ", simpleName, " ", advice) end end -- when loading CUDA enabled modules check if the necessary driver libraries are accessible to the EESSI linker, @@ -59,10 +59,10 @@ local cudaDriverExists = isFile(cudaDriverFile) local singularityCudaExists = isFile("/.singularity.d/libs/libcuda.so") if not (cudaDriverExists or singularityCudaExists) then - local advice = "which relies on the CUDA runtime environment and driver libraries.\\n" - advice = advice .. "In order to be able to use the module, please follow the instructions\\n" - advice = advice .. "available under https://www.eessi.io/docs/gpu/\\n" - LmodError("\\nYou requested to load ", simpleName, "\\n", advice) + local advice = "which relies on the CUDA runtime environment and driver libraries. " + advice = advice .. "In order to be able to use the module, please follow the instructions " + advice = advice .. "available under https://www.eessi.io/docs/gpu/" + LmodError("\\nYou requested to load ", simpleName, " ", advice) else -- CUDA driver exists, now we check its version to see if an update is needed if cudaDriverExists then @@ -80,10 +80,10 @@ end end if driver_libs_need_update == true then - local advice = "but the module you want to load requires CUDA " .. cudaVersion_req .. ".\\n" - advice = advice .. "Please update your CUDA driver libraries and then follow the instructions \\n" - advice = advice .. "under https://www.eessi.io/docs/gpu/ to let EESSI know about the update.\\n" - LmodError("\\nYour driver CUDA version is ", cudaVersion, "\\n", advice) + local advice = "but the module you want to load requires CUDA " .. cudaVersion_req .. ". " + advice = advice .. "Please update your CUDA driver libraries and then follow the instructions " + advice = advice .. "under https://www.eessi.io/docs/gpu/ to let EESSI know about the update." + LmodError("\\nYour driver CUDA version is ", cudaVersion, " ", advice) end end end From 95f4f86f584378ab464f4db2ced465a7bb277297 Mon Sep 17 00:00:00 2001 From: Alan O'Cais Date: Thu, 30 Nov 2023 17:33:37 +0100 Subject: [PATCH 10/11] Let Lmod handle most of the CRs --- create_lmodrc.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/create_lmodrc.py b/create_lmodrc.py index 6d1e07996e..98ade6b0ae 100755 --- a/create_lmodrc.py +++ b/create_lmodrc.py @@ -45,7 +45,7 @@ if not cudaDirExists then local advice = "While the module file exists, the actual software is not shipped with EESSI. " advice = advice .. "In order to be able to use the CUDA module, please follow the instructions " - advice = advice .. "available under https://www.eessi.io/docs/gpu/" + advice = advice .. "available under https://www.eessi.io/docs/gpu/ \\n" LmodError("\\nYou requested to load ", simpleName, " ", advice) end end @@ -61,7 +61,7 @@ if not (cudaDriverExists or singularityCudaExists) then local advice = "which relies on the CUDA runtime environment and driver libraries. " advice = advice .. "In order to be able to use the module, please follow the instructions " - advice = advice .. "available under https://www.eessi.io/docs/gpu/" + advice = advice .. "available under https://www.eessi.io/docs/gpu/ \\n" LmodError("\\nYou requested to load ", simpleName, " ", advice) else -- CUDA driver exists, now we check its version to see if an update is needed @@ -82,7 +82,7 @@ if driver_libs_need_update == true then local advice = "but the module you want to load requires CUDA " .. cudaVersion_req .. ". " advice = advice .. "Please update your CUDA driver libraries and then follow the instructions " - advice = advice .. "under https://www.eessi.io/docs/gpu/ to let EESSI know about the update." + advice = advice .. "under https://www.eessi.io/docs/gpu/ to let EESSI know about the update.\\n" LmodError("\\nYour driver CUDA version is ", cudaVersion, " ", advice) end end From 2a919a40ffd08de96e88f3d80d677acafb9180af Mon Sep 17 00:00:00 2001 From: Alan O'Cais Date: Thu, 30 Nov 2023 17:39:07 +0100 Subject: [PATCH 11/11] Tidy up some more --- create_lmodrc.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/create_lmodrc.py b/create_lmodrc.py index 98ade6b0ae..adf221ecba 100755 --- a/create_lmodrc.py +++ b/create_lmodrc.py @@ -43,9 +43,9 @@ local cudaEasyBuildDir = hostInjections .. "/software/" .. t.modFullName .. "/easybuild" local cudaDirExists = isDir(cudaEasyBuildDir) if not cudaDirExists then - local advice = "While the module file exists, the actual software is not shipped with EESSI. " - advice = advice .. "In order to be able to use the CUDA module, please follow the instructions " - advice = advice .. "available under https://www.eessi.io/docs/gpu/ \\n" + local advice = "but while the module file exists, the actual software is not entirely shipped with EESSI " + advice = advice .. "due to licencing. In order to be able to use the CUDA module, please follow the " + advice = advice .. "instructions available under https://www.eessi.io/docs/gpu/ \\n" LmodError("\\nYou requested to load ", simpleName, " ", advice) end end