diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2019-02-24 23:48:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-24 23:48:28 +0200 |
commit | 41fb5c2960b678ec7722d5f9b3c555757ba8a6bd (patch) | |
tree | 7643436b63bdf4773a3e0b3a9d012802ec01aaac /mesonbuild/modules | |
parent | 5b53335724c11e4443ac62bfbaea90881323d2b1 (diff) | |
parent | 104397a4293f78d3cbdd84f380cefb84ca54ec99 (diff) | |
download | meson-41fb5c2960b678ec7722d5f9b3c555757ba8a6bd.zip meson-41fb5c2960b678ec7722d5f9b3c555757ba8a6bd.tar.gz meson-41fb5c2960b678ec7722d5f9b3c555757ba8a6bd.tar.bz2 |
Merge pull request #4972 from obilaniu/cudafixes
CUDA fixes
Diffstat (limited to 'mesonbuild/modules')
-rw-r--r-- | mesonbuild/modules/unstable_cuda.py | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/mesonbuild/modules/unstable_cuda.py b/mesonbuild/modules/unstable_cuda.py index 941b15a..1a74973 100644 --- a/mesonbuild/modules/unstable_cuda.py +++ b/mesonbuild/modules/unstable_cuda.py @@ -77,11 +77,19 @@ class CudaModule(ExtensionModule): @staticmethod def _break_arch_string(s): - s = re.sub('[ \t,;]+', ';', s) + s = re.sub('[ \t\r\n,;]+', ';', s) s = s.strip(';').split(';') return s @staticmethod + def _detected_cc_from_compiler(c): + if isinstance(c, CompilerHolder): + c = c.compiler + if isinstance(c, CudaCompiler): + return c.detected_cc + return '' + + @staticmethod def _version_from_compiler(c): if isinstance(c, CompilerHolder): c = c.compiler @@ -97,7 +105,8 @@ class CudaModule(ExtensionModule): if len(args) < 1: raise argerror else: - cuda_version = self._version_from_compiler(args[0]) + compiler = args[0] + cuda_version = self._version_from_compiler(compiler) if cuda_version == 'unknown': raise argerror @@ -108,7 +117,8 @@ class CudaModule(ExtensionModule): raise InvalidArguments('''The special architectures 'All', 'Common' and 'Auto' must appear alone, as a positional argument!''') arch_list = arch_list[0] if len(arch_list) == 1 else arch_list - detected = flatten([kwargs.get('detected', [])]) + detected = kwargs.get('detected', self._detected_cc_from_compiler(compiler)) + detected = flatten([detected]) detected = [self._break_arch_string(a) for a in detected] detected = flatten(detected) if not set(detected).isdisjoint({'All', 'Common', 'Auto'}): @@ -148,7 +158,7 @@ class CudaModule(ExtensionModule): cuda_limit_gpu_architecture = '7.0' # noqa: E221 if version_compare(cuda_version, '>=9.0'): - cuda_known_gpu_architectures += ['Volta', 'Volta+Tegra'] # noqa: E221 + cuda_known_gpu_architectures += ['Volta', 'Xavier'] # noqa: E221 cuda_common_gpu_architectures += ['7.0', '7.0+PTX'] # noqa: E221 cuda_all_gpu_architectures += ['7.0', '7.0+PTX', '7.2', '7.2+PTX'] # noqa: E221 @@ -215,7 +225,7 @@ class CudaModule(ExtensionModule): 'Pascal': (['6.0', '6.1'], ['6.1']), 'Pascal+Tegra': (['6.2'], []), 'Volta': (['7.0'], ['7.0']), - 'Volta+Tegra': (['7.2'], []), + 'Xavier': (['7.2'], []), 'Turing': (['7.5'], ['7.5']), }.get(arch_name, (None, None)) |