From aabece46ba2d07c33165c23ff71c9f567ebf22d2 Mon Sep 17 00:00:00 2001 From: David Beckingsale Date: Wed, 1 Sep 2021 11:34:20 -0700 Subject: [PATCH] Add variant to allow unsupported compiler & CUDA combinations (#19736) Sometimes users need to be able to override the conflicts in `CudaPacakge`. This introduces a variant to enable/disable them. --- lib/spack/spack/build_systems/cuda.py | 156 +++++++++--------- .../repos/builtin/packages/cuda/package.py | 2 + 2 files changed, 79 insertions(+), 79 deletions(-) diff --git a/lib/spack/spack/build_systems/cuda.py b/lib/spack/spack/build_systems/cuda.py index b2b7783500..79d63fab10 100644 --- a/lib/spack/spack/build_systems/cuda.py +++ b/lib/spack/spack/build_systems/cuda.py @@ -5,6 +5,7 @@ import spack.variant from spack.directives import conflicts, depends_on, variant +from spack.multimethod import when from spack.package import PackageBase @@ -87,90 +88,87 @@ def cuda_flags(arch_list): # Linux x86_64 compiler conflicts from here: # https://gist.github.com/ax3l/9489132 - conflicts('%gcc@5:', when='+cuda ^cuda@:7.5 target=x86_64:') - conflicts('%gcc@6:', when='+cuda ^cuda@:8 target=x86_64:') - conflicts('%gcc@7:', when='+cuda ^cuda@:9.1 target=x86_64:') - conflicts('%gcc@8:', when='+cuda ^cuda@:10.0.130 target=x86_64:') - conflicts('%gcc@9:', when='+cuda ^cuda@:10.2.89 target=x86_64:') - conflicts('%gcc@:4', when='+cuda ^cuda@11.0.2: target=x86_64:') - conflicts('%gcc@10:', when='+cuda ^cuda@:11.0.3 target=x86_64:') - conflicts('%gcc@11:', when='+cuda ^cuda@:11.1.0 target=x86_64:') - conflicts('%pgi@:14.8', when='+cuda ^cuda@:7.0.27 target=x86_64:') - conflicts('%pgi@:15.3,15.5:', when='+cuda ^cuda@7.5 target=x86_64:') - conflicts('%pgi@:16.2,16.0:16.3', when='+cuda ^cuda@8 target=x86_64:') - conflicts('%pgi@:15,18:', when='+cuda ^cuda@9.0:9.1 target=x86_64:') - conflicts('%pgi@:16,19:', when='+cuda ^cuda@9.2.88:10 target=x86_64:') - conflicts('%pgi@:17,20:', - when='+cuda ^cuda@10.1.105:10.2.89 target=x86_64:') - conflicts('%pgi@:17,21:', - when='+cuda ^cuda@11.0.2:11.1.0 target=x86_64:') - conflicts('%clang@:3.4', when='+cuda ^cuda@:7.5 target=x86_64:') - conflicts('%clang@:3.7,4:', - when='+cuda ^cuda@8.0:9.0 target=x86_64:') - conflicts('%clang@:3.7,4.1:', - when='+cuda ^cuda@9.1 target=x86_64:') - conflicts('%clang@:3.7,5.1:', when='+cuda ^cuda@9.2 target=x86_64:') - conflicts('%clang@:3.7,6.1:', when='+cuda ^cuda@10.0.130 target=x86_64:') - conflicts('%clang@:3.7,7.1:', when='+cuda ^cuda@10.1.105 target=x86_64:') - conflicts('%clang@:3.7,8.1:', - when='+cuda ^cuda@10.1.105:10.1.243 target=x86_64:') - conflicts('%clang@:3.2,9:', when='+cuda ^cuda@10.2.89 target=x86_64:') - conflicts('%clang@:5', when='+cuda ^cuda@11.0.2: target=x86_64:') - conflicts('%clang@10:', when='+cuda ^cuda@:11.0.3 target=x86_64:') - conflicts('%clang@11:', when='+cuda ^cuda@:11.1.0 target=x86_64:') + with when('~allow-unsupported-compilers'): + conflicts('%gcc@5:', when='+cuda ^cuda@:7.5 target=x86_64:') + conflicts('%gcc@6:', when='+cuda ^cuda@:8 target=x86_64:') + conflicts('%gcc@7:', when='+cuda ^cuda@:9.1 target=x86_64:') + conflicts('%gcc@8:', when='+cuda ^cuda@:10.0.130 target=x86_64:') + conflicts('%gcc@9:', when='+cuda ^cuda@:10.2.89 target=x86_64:') + conflicts('%gcc@:4', when='+cuda ^cuda@11.0.2: target=x86_64:') + conflicts('%gcc@10:', when='+cuda ^cuda@:11.0.3 target=x86_64:') + conflicts('%gcc@11:', when='+cuda ^cuda@:11.1.0 target=x86_64:') + conflicts('%pgi@:14.8', when='+cuda ^cuda@:7.0.27 target=x86_64:') + conflicts('%pgi@:15.3,15.5:', when='+cuda ^cuda@7.5 target=x86_64:') + conflicts('%pgi@:16.2,16.0:16.3', when='+cuda ^cuda@8 target=x86_64:') + conflicts('%pgi@:15,18:', when='+cuda ^cuda@9.0:9.1 target=x86_64:') + conflicts('%pgi@:16,19:', when='+cuda ^cuda@9.2.88:10 target=x86_64:') + conflicts('%pgi@:17,20:', when='+cuda ^cuda@10.1.105:10.2.89 target=x86_64:') + conflicts('%pgi@:17,21:', when='+cuda ^cuda@11.0.2:11.1.0 target=x86_64:') + conflicts('%clang@:3.4', when='+cuda ^cuda@:7.5 target=x86_64:') + conflicts('%clang@:3.7,4:', when='+cuda ^cuda@8.0:9.0 target=x86_64:') + conflicts('%clang@:3.7,4.1:', when='+cuda ^cuda@9.1 target=x86_64:') + conflicts('%clang@:3.7,5.1:', when='+cuda ^cuda@9.2 target=x86_64:') + conflicts('%clang@:3.7,6.1:', when='+cuda ^cuda@10.0.130 target=x86_64:') + conflicts('%clang@:3.7,7.1:', when='+cuda ^cuda@10.1.105 target=x86_64:') + conflicts('%clang@:3.7,8.1:', + when='+cuda ^cuda@10.1.105:10.1.243 target=x86_64:') + conflicts('%clang@:3.2,9:', when='+cuda ^cuda@10.2.89 target=x86_64:') + conflicts('%clang@:5', when='+cuda ^cuda@11.0.2: target=x86_64:') + conflicts('%clang@10:', when='+cuda ^cuda@:11.0.3 target=x86_64:') + conflicts('%clang@11:', when='+cuda ^cuda@:11.1.0 target=x86_64:') - # x86_64 vs. ppc64le differ according to NVidia docs - # Linux ppc64le compiler conflicts from Table from the docs below: - # https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html - # https://docs.nvidia.com/cuda/archive/9.2/cuda-installation-guide-linux/index.html - # https://docs.nvidia.com/cuda/archive/9.1/cuda-installation-guide-linux/index.html - # https://docs.nvidia.com/cuda/archive/9.0/cuda-installation-guide-linux/index.html - # https://docs.nvidia.com/cuda/archive/8.0/cuda-installation-guide-linux/index.html + # x86_64 vs. ppc64le differ according to NVidia docs + # Linux ppc64le compiler conflicts from Table from the docs below: + # https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html + # https://docs.nvidia.com/cuda/archive/9.2/cuda-installation-guide-linux/index.html + # https://docs.nvidia.com/cuda/archive/9.1/cuda-installation-guide-linux/index.html + # https://docs.nvidia.com/cuda/archive/9.0/cuda-installation-guide-linux/index.html + # https://docs.nvidia.com/cuda/archive/8.0/cuda-installation-guide-linux/index.html - # information prior to CUDA 9 difficult to find - conflicts('%gcc@6:', when='+cuda ^cuda@:9 target=ppc64le:') - conflicts('%gcc@8:', when='+cuda ^cuda@:10.0.130 target=ppc64le:') - conflicts('%gcc@9:', when='+cuda ^cuda@:10.1.243 target=ppc64le:') - # officially, CUDA 11.0.2 only supports the system GCC 8.3 on ppc64le - conflicts('%gcc@:4', when='+cuda ^cuda@11.0.2: target=ppc64le:') - conflicts('%gcc@10:', when='+cuda ^cuda@:11.0.3 target=ppc64le:') - conflicts('%gcc@11:', when='+cuda ^cuda@:11.1.0 target=ppc64le:') - conflicts('%pgi', when='+cuda ^cuda@:8 target=ppc64le:') - conflicts('%pgi@:16', when='+cuda ^cuda@:9.1.185 target=ppc64le:') - conflicts('%pgi@:17', when='+cuda ^cuda@:10 target=ppc64le:') - conflicts('%clang@4:', when='+cuda ^cuda@:9.0.176 target=ppc64le:') - conflicts('%clang@5:', when='+cuda ^cuda@:9.1 target=ppc64le:') - conflicts('%clang@6:', when='+cuda ^cuda@:9.2 target=ppc64le:') - conflicts('%clang@7:', when='+cuda ^cuda@10.0.130 target=ppc64le:') - conflicts('%clang@7.1:', when='+cuda ^cuda@:10.1.105 target=ppc64le:') - conflicts('%clang@8.1:', when='+cuda ^cuda@:10.2.89 target=ppc64le:') - conflicts('%clang@:5', when='+cuda ^cuda@11.0.2: target=ppc64le:') - conflicts('%clang@10:', when='+cuda ^cuda@:11.0.3 target=ppc64le:') - conflicts('%clang@11:', when='+cuda ^cuda@:11.1.0 target=ppc64le:') + # information prior to CUDA 9 difficult to find + conflicts('%gcc@6:', when='+cuda ^cuda@:9 target=ppc64le:') + conflicts('%gcc@8:', when='+cuda ^cuda@:10.0.130 target=ppc64le:') + conflicts('%gcc@9:', when='+cuda ^cuda@:10.1.243 target=ppc64le:') + # officially, CUDA 11.0.2 only supports the system GCC 8.3 on ppc64le + conflicts('%gcc@:4', when='+cuda ^cuda@11.0.2: target=ppc64le:') + conflicts('%gcc@10:', when='+cuda ^cuda@:11.0.2 target=ppc64le:') + conflicts('%gcc@11:', when='+cuda ^cuda@:11.1.0 target=ppc64le:') + conflicts('%pgi', when='+cuda ^cuda@:8 target=ppc64le:') + conflicts('%pgi@:16', when='+cuda ^cuda@:9.1.185 target=ppc64le:') + conflicts('%pgi@:17', when='+cuda ^cuda@:10 target=ppc64le:') + conflicts('%clang@4:', when='+cuda ^cuda@:9.0.176 target=ppc64le:') + conflicts('%clang@5:', when='+cuda ^cuda@:9.1 target=ppc64le:') + conflicts('%clang@6:', when='+cuda ^cuda@:9.2 target=ppc64le:') + conflicts('%clang@7:', when='+cuda ^cuda@10.0.130 target=ppc64le:') + conflicts('%clang@7.1:', when='+cuda ^cuda@:10.1.105 target=ppc64le:') + conflicts('%clang@8.1:', when='+cuda ^cuda@:10.2.89 target=ppc64le:') + conflicts('%clang@:5', when='+cuda ^cuda@11.0.2: target=ppc64le:') + conflicts('%clang@10:', when='+cuda ^cuda@:11.0.2 target=ppc64le:') + conflicts('%clang@11:', when='+cuda ^cuda@:11.1.0 target=ppc64le:') - # Intel is mostly relevant for x86_64 Linux, even though it also - # exists for Mac OS X. No information prior to CUDA 3.2 or Intel 11.1 - conflicts('%intel@:11.0', when='+cuda ^cuda@:3.1') - conflicts('%intel@:12.0', when='+cuda ^cuda@5.5:') - conflicts('%intel@:13.0', when='+cuda ^cuda@6.0:') - conflicts('%intel@:13.2', when='+cuda ^cuda@6.5:') - conflicts('%intel@:14.9', when='+cuda ^cuda@7:') - # Intel 15.x is compatible with CUDA 7 thru current CUDA - conflicts('%intel@16.0:', when='+cuda ^cuda@:8.0.43') - conflicts('%intel@17.0:', when='+cuda ^cuda@:8.0.60') - conflicts('%intel@18.0:', when='+cuda ^cuda@:9.9') - conflicts('%intel@19.0:', when='+cuda ^cuda@:10.0') - conflicts('%intel@19.1:', when='+cuda ^cuda@:10.1') - conflicts('%intel@19.2:', when='+cuda ^cuda@:11.1.0') + # Intel is mostly relevant for x86_64 Linux, even though it also + # exists for Mac OS X. No information prior to CUDA 3.2 or Intel 11.1 + conflicts('%intel@:11.0', when='+cuda ^cuda@:3.1') + conflicts('%intel@:12.0', when='+cuda ^cuda@5.5:') + conflicts('%intel@:13.0', when='+cuda ^cuda@6.0:') + conflicts('%intel@:13.2', when='+cuda ^cuda@6.5:') + conflicts('%intel@:14.9', when='+cuda ^cuda@7:') + # Intel 15.x is compatible with CUDA 7 thru current CUDA + conflicts('%intel@16.0:', when='+cuda ^cuda@:8.0.43') + conflicts('%intel@17.0:', when='+cuda ^cuda@:8.0.60') + conflicts('%intel@18.0:', when='+cuda ^cuda@:9.9') + conflicts('%intel@19.0:', when='+cuda ^cuda@:10.0') + conflicts('%intel@19.1:', when='+cuda ^cuda@:10.1') + conflicts('%intel@19.2:', when='+cuda ^cuda@:11.1.0') - # XL is mostly relevant for ppc64le Linux - conflicts('%xl@:12,14:', when='+cuda ^cuda@:9.1') - conflicts('%xl@:12,14:15,17:', when='+cuda ^cuda@9.2') - conflicts('%xl@:12,17:', when='+cuda ^cuda@:11.1.0') + # XL is mostly relevant for ppc64le Linux + conflicts('%xl@:12,14:', when='+cuda ^cuda@:9.1') + conflicts('%xl@:12,14:15,17:', when='+cuda ^cuda@9.2') + conflicts('%xl@:12,17:', when='+cuda ^cuda@:11.1.0') - # Darwin. - # TODO: add missing conflicts for %apple-clang cuda@:10 - conflicts('platform=darwin', when='+cuda ^cuda@11.0.2:') + # Darwin. + # TODO: add missing conflicts for %apple-clang cuda@:10 + conflicts('platform=darwin', when='+cuda ^cuda@11.0.2: ') # Make sure cuda_arch can not be used without +cuda for value in cuda_arch_values: diff --git a/var/spack/repos/builtin/packages/cuda/package.py b/var/spack/repos/builtin/packages/cuda/package.py index b4d966c484..27271154ad 100644 --- a/var/spack/repos/builtin/packages/cuda/package.py +++ b/var/spack/repos/builtin/packages/cuda/package.py @@ -122,6 +122,8 @@ class Cuda(Package): conflicts('arch=darwin-mojave-x86_64') variant('dev', default=False, description='Enable development dependencies, i.e to use cuda-gdb') + variant('allow-unsupported-compilers', default=False, + description='Allow unsupported host compiler and CUDA version combinations') depends_on('libxml2', when='@10.1.243:') # cuda-gdb needs libncurses.so.5