summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/cuda/package.py
diff options
context:
space:
mode:
authorMaciej Wójcik <w8jcik@gmail.com>2021-07-01 21:04:04 +0200
committerGitHub <noreply@github.com>2021-07-01 12:04:04 -0700
commitc5a27980df7ca8be7ba9d133c55d4c4de81e1284 (patch)
tree89980e3e936eacd9c62cd2aec1eeae1944f3ee39 /var/spack/repos/builtin/packages/cuda/package.py
parent406117148d3e416e518eb911b0768716b00245d6 (diff)
downloadspack-c5a27980df7ca8be7ba9d133c55d4c4de81e1284.tar.gz
spack-c5a27980df7ca8be7ba9d133c55d4c4de81e1284.tar.bz2
spack-c5a27980df7ca8be7ba9d133c55d4c4de81e1284.tar.xz
spack-c5a27980df7ca8be7ba9d133c55d4c4de81e1284.zip
Added Perl workaround for CUDA <= 8 (#24291)
* Added Perl workaround for CUDA <= 8 * Re-wrapped comment * Proofreading corrections * Added a reference * Do not override Perl include path * Retrieve shell once Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
Diffstat (limited to 'var/spack/repos/builtin/packages/cuda/package.py')
-rw-r--r--var/spack/repos/builtin/packages/cuda/package.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/var/spack/repos/builtin/packages/cuda/package.py b/var/spack/repos/builtin/packages/cuda/package.py
index 72afffaa9a..8e378ad5f7 100644
--- a/var/spack/repos/builtin/packages/cuda/package.py
+++ b/var/spack/repos/builtin/packages/cuda/package.py
@@ -133,6 +133,11 @@ class Cuda(Package):
return match.group(1) if match else None
def setup_build_environment(self, env):
+ if self.spec.satisfies('@:8.0.61'):
+ # Perl 5.26 removed current directory from module search path,
+ # CUDA 9 has a fix for this, but CUDA 8 and lower don't.
+ env.append_path('PERL5LIB', self.stage.source_path)
+
if self.spec.satisfies('@10.1.243:'):
libxml2_home = self.spec['libxml2'].prefix
env.set('LIBXML2HOME', libxml2_home)
@@ -171,6 +176,18 @@ class Cuda(Package):
os.makedirs(os.path.join(prefix, "src"))
os.symlink(includedir, os.path.join(prefix, "include"))
+ install_shell = which('sh')
+
+ if self.spec.satisfies('@:8.0.61'):
+ # Perl 5.26 removed current directory from module search path.
+ # We are addressing this by exporting `PERL5LIB` earlier, but for some
+ # reason, it is not enough. One more file needs to be extracted before
+ # running the actual installer. This solution is one of the commonly
+ # found on the Internet, when people try to install CUDA <= 8 manually.
+ # For example: https://askubuntu.com/a/1087842
+ arguments = [runfile, '--tar', 'mxvf', './InstallUtils.pm']
+ install_shell(*arguments)
+
# CUDA 10.1+ has different cmdline options for the installer
arguments = [
runfile, # the install script
@@ -178,13 +195,15 @@ class Cuda(Package):
'--override', # override compiler version checks
'--toolkit', # install CUDA Toolkit
]
+
if spec.satisfies('@10.1:'):
arguments.append('--installpath=%s' % prefix) # Where to install
else:
arguments.append('--verbose') # Verbose log file
arguments.append('--toolkitpath=%s' % prefix) # Where to install
- install_shell = which('sh')
+
install_shell(*arguments)
+
try:
os.remove('/tmp/cuda-installer.log')
except OSError: