Adding externals support for CUDA. (#18011)

Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
This commit is contained in:
Robert Blake 2020-08-12 10:30:57 -07:00 committed by GitHub
parent 193c3535e1
commit b4ff584bc0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,6 +7,7 @@
from glob import glob from glob import glob
from llnl.util.filesystem import LibraryList from llnl.util.filesystem import LibraryList
import os import os
import re
import platform import platform
import llnl.util.tty as tty import llnl.util.tty as tty
@ -60,6 +61,8 @@ class Cuda(Package):
homepage = "https://developer.nvidia.com/cuda-zone" homepage = "https://developer.nvidia.com/cuda-zone"
executables = ['^nvcc$']
for ver, packages in _versions.items(): for ver, packages in _versions.items():
key = "{0}-{1}".format(platform.system(), platform.machine()) key = "{0}-{1}".format(platform.system(), platform.machine())
pkg = packages.get(key) pkg = packages.get(key)
@ -79,6 +82,13 @@ class Cuda(Package):
depends_on('libxml2', when='@10.1.243:') depends_on('libxml2', when='@10.1.243:')
@classmethod
def determine_version(cls, exe):
output = Executable(exe)('--version', output=str, error=str)
match = re.search(r'Cuda compilation tools, release .*?, V(\S+)',
output)
return match.group(1) if match else None
def setup_build_environment(self, env): def setup_build_environment(self, env):
if self.spec.satisfies('@10.1.243:'): if self.spec.satisfies('@10.1.243:'):
libxml2_home = self.spec['libxml2'].prefix libxml2_home = self.spec['libxml2'].prefix