summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberto Invernizzi <9337627+albestro@users.noreply.github.com>2024-05-31 06:33:38 +0200
committerGitHub <noreply@github.com>2024-05-30 23:33:38 -0500
commit77fd5d841438d9aec0257552f8292dc108d8eb64 (patch)
tree4454a08a615806a5f1bf6b5b7e3aeb13bd68f6b7
parent82050ed3714b66d6c870da3606214d4c3fe952e6 (diff)
downloadspack-77fd5d841438d9aec0257552f8292dc108d8eb64.tar.gz
spack-77fd5d841438d9aec0257552f8292dc108d8eb64.tar.bz2
spack-77fd5d841438d9aec0257552f8292dc108d8eb64.tar.xz
spack-77fd5d841438d9aec0257552f8292dc108d8eb64.zip
paraview: update cuda_arch management (#44243)
* refactor logic to switch to cmake for cuda management
-rw-r--r--var/spack/repos/builtin/packages/paraview/package.py88
1 files changed, 53 insertions, 35 deletions
diff --git a/var/spack/repos/builtin/packages/paraview/package.py b/var/spack/repos/builtin/packages/paraview/package.py
index c219d24ada..d67a99d63f 100644
--- a/var/spack/repos/builtin/packages/paraview/package.py
+++ b/var/spack/repos/builtin/packages/paraview/package.py
@@ -144,6 +144,40 @@ class Paraview(CMakePackage, CudaPackage, ROCmPackage):
msg="Use paraview@5.9.0 with %xl_r. Earlier versions are not able to build with xl.",
)
+ # CUDA ARCH
+
+ # This is (more or less) the mapping hard-coded in VTK-m logic
+ # see https://gitlab.kitware.com/vtk/vtk-m/-/blob/v2.1.0/CMake/VTKmDeviceAdapters.cmake?ref_type=tags#L221-247
+ supported_cuda_archs = {
+ "20": "fermi",
+ "21": "fermi",
+ "30": "kepler",
+ "32": "kepler",
+ "35": "kepler",
+ "37": "kepler",
+ "50": "maxwel",
+ "52": "maxwel",
+ "53": "maxwel",
+ "60": "pascal",
+ "61": "pascal",
+ "62": "pascal",
+ "70": "volta",
+ "72": "volta",
+ "75": "turing",
+ "80": "ampere",
+ "86": "ampere",
+ }
+
+ # VTK-m and transitively ParaView does not support Tesla Arch
+ for _arch in range(10, 14):
+ conflicts(f"cuda_arch={_arch}", when="+cuda", msg="ParaView requires cuda_arch >= 20")
+
+ # Starting from cmake@3.18, CUDA architecture managament can be delegated to CMake.
+ # Hence, it is possible to rely on it instead of relying on custom logic updates from VTK-m for
+ # newer architectures (wrt mapping).
+ for _arch in [arch for arch in CudaPackage.cuda_arch_values if int(arch) > 86]:
+ conflicts("cmake@:3.17", when=f"cuda_arch={_arch}")
+
# We only support one single Architecture
for _arch, _other_arch in itertools.permutations(CudaPackage.cuda_arch_values, 2):
conflicts(
@@ -152,9 +186,6 @@ class Paraview(CMakePackage, CudaPackage, ROCmPackage):
msg="Paraview only accepts one architecture value",
)
- for _arch in range(10, 14):
- conflicts("cuda_arch=%d" % _arch, when="+cuda", msg="ParaView requires cuda_arch >= 20")
-
depends_on("cmake@3.3:", type="build")
depends_on("cmake@3.21:", type="build", when="+rocm")
@@ -577,38 +608,25 @@ class Paraview(CMakePackage, CudaPackage, ROCmPackage):
# VTK-m expects cuda_arch to be the arch name vs. the arch version.
if spec.satisfies("+cuda"):
- supported_cuda_archs = {
- # VTK-m and transitively ParaView does not support Tesla Arch
- "20": "fermi",
- "21": "fermi",
- "30": "kepler",
- "32": "kepler",
- "35": "kepler",
- "37": "kepler",
- "50": "maxwel",
- "52": "maxwel",
- "53": "maxwel",
- "60": "pascal",
- "61": "pascal",
- "62": "pascal",
- "70": "volta",
- "72": "volta",
- "75": "turing",
- "80": "ampere",
- "86": "ampere",
- }
-
- cuda_arch_value = "native"
- requested_arch = spec.variants["cuda_arch"].value
-
- # ParaView/VTK-m only accepts one arch, default to first element
- if requested_arch[0] != "none":
- try:
- cuda_arch_value = supported_cuda_archs[requested_arch[0]]
- except KeyError:
- raise InstallError("Incompatible cuda_arch=" + requested_arch[0])
-
- cmake_args.append(self.define("VTKm_CUDA_Architecture", cuda_arch_value))
+ if spec["cmake"].satisfies("@3.18:"):
+ cmake_args.append(
+ self.define(
+ "CMAKE_CUDA_ARCHITECTURES", ";".join(spec.variants["cuda_arch"].value)
+ )
+ )
+ else:
+ # ParaView/VTK-m only accepts one arch, default to first element
+ requested_arch = spec.variants["cuda_arch"].value[0]
+
+ if requested_arch == "none":
+ cuda_arch_value = "native"
+ else:
+ try:
+ cuda_arch_value = supported_cuda_archs[requested_arch]
+ except KeyError:
+ raise InstallError("Incompatible cuda_arch=" + requested_arch)
+
+ cmake_args.append(self.define("VTKm_CUDA_Architecture", cuda_arch_value))
if "darwin" in spec.architecture:
cmake_args.extend(