paraview: update cuda_arch management (#44243)
* refactor logic to switch to cmake for cuda management
This commit is contained in:
parent
82050ed371
commit
77fd5d8414
@ -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.",
|
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
|
# We only support one single Architecture
|
||||||
for _arch, _other_arch in itertools.permutations(CudaPackage.cuda_arch_values, 2):
|
for _arch, _other_arch in itertools.permutations(CudaPackage.cuda_arch_values, 2):
|
||||||
conflicts(
|
conflicts(
|
||||||
@ -152,9 +186,6 @@ class Paraview(CMakePackage, CudaPackage, ROCmPackage):
|
|||||||
msg="Paraview only accepts one architecture value",
|
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.3:", type="build")
|
||||||
depends_on("cmake@3.21:", type="build", when="+rocm")
|
depends_on("cmake@3.21:", type="build", when="+rocm")
|
||||||
|
|
||||||
@ -577,36 +608,23 @@ def use_x11():
|
|||||||
|
|
||||||
# VTK-m expects cuda_arch to be the arch name vs. the arch version.
|
# VTK-m expects cuda_arch to be the arch name vs. the arch version.
|
||||||
if spec.satisfies("+cuda"):
|
if spec.satisfies("+cuda"):
|
||||||
supported_cuda_archs = {
|
if spec["cmake"].satisfies("@3.18:"):
|
||||||
# VTK-m and transitively ParaView does not support Tesla Arch
|
cmake_args.append(
|
||||||
"20": "fermi",
|
self.define(
|
||||||
"21": "fermi",
|
"CMAKE_CUDA_ARCHITECTURES", ";".join(spec.variants["cuda_arch"].value)
|
||||||
"30": "kepler",
|
)
|
||||||
"32": "kepler",
|
)
|
||||||
"35": "kepler",
|
else:
|
||||||
"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
|
# ParaView/VTK-m only accepts one arch, default to first element
|
||||||
if requested_arch[0] != "none":
|
requested_arch = spec.variants["cuda_arch"].value[0]
|
||||||
|
|
||||||
|
if requested_arch == "none":
|
||||||
|
cuda_arch_value = "native"
|
||||||
|
else:
|
||||||
try:
|
try:
|
||||||
cuda_arch_value = supported_cuda_archs[requested_arch[0]]
|
cuda_arch_value = supported_cuda_archs[requested_arch]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
raise InstallError("Incompatible cuda_arch=" + requested_arch[0])
|
raise InstallError("Incompatible cuda_arch=" + requested_arch)
|
||||||
|
|
||||||
cmake_args.append(self.define("VTKm_CUDA_Architecture", cuda_arch_value))
|
cmake_args.append(self.define("VTKm_CUDA_Architecture", cuda_arch_value))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user