4040}
4141
4242
43+ # This is a list of paraview variants that require the viskores library.
44+ viskores_dependency_variants = ["+cuda" , "+fides" , "+rocm" ]
45+
46+
4347class Paraview (CMakePackage , CudaPackage , ROCmPackage ):
4448 """ParaView is an open-source, multi-platform data analysis and
4549 visualization application. This package includes the Catalyst
@@ -166,6 +170,7 @@ class Paraview(CMakePackage, CudaPackage, ROCmPackage):
166170 variant (
167171 "use_vtkm" ,
168172 default = "default" ,
173+ when = "@5.3.0:5.13" ,
169174 multi = False ,
170175 values = ("default" , "on" , "off" ),
171176 description = "Build VTK-m(Viskores) with ParaView."
@@ -193,8 +198,9 @@ class Paraview(CMakePackage, CudaPackage, ROCmPackage):
193198 conflicts ("build_edition=catalyst" , when = "@:5.7" )
194199 conflicts ("build_edition=rendering" , when = "@:5.7" )
195200 conflicts ("build_edition=core" , when = "@:5.7" )
196- # before 5.3.0, ParaView didn't have VTK-m
197- conflicts ("use_vtkm=on" , when = "@:5.3" )
201+ # before 5.3.0, ParaView didn't have VTK-m/Viskores
202+ conflicts ("+cuda" , when = "@:5.3" )
203+ conflicts ("+rocm" , when = "@:5.3" )
198204 # [email protected] is recommended when using the xl compiler 199205 # See https://gitlab.kitware.com/paraview/paraview/-/merge_requests/4433
200206 conflicts (
@@ -203,29 +209,6 @@ class Paraview(CMakePackage, CudaPackage, ROCmPackage):
203209 msg = "Use [email protected] with %xl_r. Earlier versions are not able to build with xl." ,
204210 )
205211
206- # CUDA ARCH
207-
208- # VTK-m and transitively ParaView does not support Tesla Arch
209- for _arch in ("10" , "11" , "12" , "13" ):
210- conflicts (f"cuda_arch={ _arch } " , when = "+cuda" , msg = "ParaView requires cuda_arch >= 20" )
211-
212- # Starting from [email protected] , CUDA architecture managament can be delegated to CMake. 213- # Hence, it is possible to rely on it instead of relying on custom logic updates from VTK-m for
214- # newer architectures (wrt mapping).
215- pattern = re .compile (r"\d+" )
216- for _arch in CudaPackage .cuda_arch_values :
217- _number = re .match (pattern , _arch ).group ()
218- if int (_number ) > 86 :
219- conflicts ("cmake@:3.17" , when = f"cuda_arch={ _arch } " )
220-
221- # We only support one single Architecture
222- for _arch , _other_arch in itertools .permutations (CudaPackage .cuda_arch_values , 2 ):
223- conflicts (
224- "cuda_arch={0}" .format (_arch ),
225- when = "cuda_arch={0}" .format (_other_arch ),
226- msg = "Paraview only accepts one architecture value" ,
227- )
228-
229212 depends_on ("c" , type = "build" ) # generated
230213 depends_on ("cxx" , type = "build" ) # generated
231214 depends_on ("fortran" , type = "build" ) # generated
@@ -290,6 +273,40 @@ class Paraview(CMakePackage, CudaPackage, ROCmPackage):
290273 depends_on (
"[email protected] :" ,
when = "~opengl2" )
291274 depends_on ("glew" )
292275
276+ # CUDA ARCH
277+
278+ # VTK-m and transitively ParaView does not support Tesla Arch
279+ for _arch in ("10" , "11" , "12" , "13" ):
280+ conflicts (f"cuda_arch={ _arch } " , when = "+cuda" , msg = "ParaView requires cuda_arch >= 20" )
281+
282+ # Starting from [email protected] , CUDA architecture managament can be delegated to CMake. 283+ # Hence, it is possible to rely on it instead of relying on custom logic updates from VTK-m for
284+ # newer architectures (wrt mapping).
285+ pattern = re .compile (r"\d+" )
286+ for _arch in CudaPackage .cuda_arch_values :
287+ _number = re .match (pattern , _arch ).group ()
288+ if int (_number ) > 86 :
289+ conflicts ("cmake@:3.17" , when = f"cuda_arch={ _arch } " )
290+
291+ # We only support one single Architecture
292+ for _arch , _other_arch in itertools .permutations (CudaPackage .cuda_arch_values , 2 ):
293+ conflicts (
294+ "cuda_arch={0}" .format (_arch ),
295+ when = "cuda_arch={0}" .format (_other_arch ),
296+ msg = "Paraview only accepts one architecture value" ,
297+ )
298+
299+ # Dependencies for vendored VTK-m
300+ depends_on (
"[email protected] :" ,
when = "+rocm" )
301+ # CUDA thrust is already include in the CUDA pkg
302+ depends_on (
"rocthrust" ,
when = "@5.13: +rocm ^[email protected] :" )
303+ for target in ROCmPackage .amdgpu_targets :
304+ depends_on (
305+ "kokkos@:3.7 +rocm amdgpu_target={0}" .format (target ),
306+ when = "+rocm amdgpu_target={0}" .format (target ),
307+ )
308+
309+
293310 with when ("@6:" ):
294311 # ParaView 6 and later will not support Spack builds with Qt5.
295312 with when ("+qt" ):
@@ -307,8 +324,21 @@ class Paraview(CMakePackage, CudaPackage, ROCmPackage):
307324 # * OSMesa (guarenteed to exist and work on all systems)
308325 depends_on ("osmesa" , type = ("run" ), when = "~qt" )
309326
310- # ParaView 6 (with VTK) supports external Viskores
311- depends_on ("viskores" , when = "use_vtkm=on" )
327+ # Depend on Viskores when it is needed
328+ for vk_variant in viskores_dependency_variants :
329+ depends_on ("viskores +vtktypes +64bitids +doubleprecision" , when = f"{ vk_variant } " )
330+ depends_on ("viskores +fpic" , when = f"+shared { vk_variant } " )
331+
332+ with when ("+cuda" ):
333+ # Kokkos vs Viskores Native CUDA is intentionally left configurable
334+ depends_on ("viskores +cuda" )
335+ for _arch in CudaPackage .cuda_arch_values :
336+ depends_on (f"viskores cuda_arch={ _arch } " , when = f"cuda_arch={ _arch } " )
337+
338+ with when ("+rocm" ):
339+ depends_on ("viskores +rocm" )
340+ for target in ROCmPackage .amdgpu_targets :
341+ depends_on (f"viskores amdgpu_target={ target } " , when = f"amdgpu_target={ target } " )
312342
313343 depends_on (
"[email protected] :2" ,
when = "+raytracing" )
314344 depends_on ("openimagedenoise" , when = "+raytracing" )
@@ -361,14 +391,6 @@ class Paraview(CMakePackage, CudaPackage, ROCmPackage):
361391 depends_on ("xz" )
362392 depends_on ("zlib-api" )
363393 depends_on ("libcatalyst@2:" , when = "+libcatalyst" )
364- depends_on (
"[email protected] :" ,
when = "+rocm" )
365- # CUDA thrust is already include in the CUDA pkg
366- depends_on (
"rocthrust" ,
when = "@5.13: +rocm ^[email protected] :" )
367- for target in ROCmPackage .amdgpu_targets :
368- depends_on (
369- "kokkos@:3.7 +rocm amdgpu_target={0}" .format (target ),
370- when = "+rocm amdgpu_target={0}" .format (target ),
371- )
372394
373395 # Older builds of pugi export their symbols differently,
374396 # and pre-5.9 is unable to handle that.
@@ -719,7 +741,7 @@ def use_x11():
719741 cmake_args .append ("-DPARAVIEW_BUILD_SHARED_LIBS:BOOL=%s" % variant_bool ("+shared" ))
720742
721743 # VTK-m added to ParaView in 5.3.0 and up
722- if spec .satisfies ("@5.3.0:" ) and spec .variants ["use_vtkm" ].value != "default" :
744+ if spec .satisfies ("@5.3.0:5 " ) and spec .variants ["use_vtkm" ].value != "default" :
723745 if spec .satisfies ("@6:" ):
724746 cmake_args .append (
725747 "-DPARAVIEW_USE_VISKORES:BOOL=%s" % spec .variants ["use_vtkm" ].value .upper ()
@@ -729,6 +751,17 @@ def use_x11():
729751 "-DPARAVIEW_USE_VTKM:BOOL=%s" % spec .variants ["use_vtkm" ].value .upper ()
730752 )
731753
754+ # Viskores added to ParaView in 6.0.0 and up
755+ use_viskores = False
756+ if spec .satisfies ("@6:" ):
757+ for variant in viskores_dependency_variants :
758+ use_viskores |= spec .satisfies (variant )
759+ if use_viskores :
760+ cmake_args .append ("-DPARAVIEW_USE_VISKORES:BOOL=ON" )
761+ cmake_args .append ("-DVTK_MODULE_USE_EXTERNAL_VTK_vtkviskores:BOOL=ON" )
762+ else :
763+ cmake_args .append ("-DPARAVIEW_USE_VISKORES:BOOL=OFF" )
764+
732765 if spec .satisfies ("@5.8:" ):
733766 cmake_args .append ("-DPARAVIEW_USE_CUDA:BOOL=%s" % variant_bool ("+cuda" ))
734767 elif spec .satisfies ("@5.7:" ):
@@ -805,14 +838,22 @@ def use_x11():
805838 if "+advanced_debug" in spec :
806839 cmake_args .append ("-DVTK_DEBUG_LEAKS:BOOL=ON" )
807840
808- if spec .satisfies ("@5.11:" ):
841+ # Configure ROCM/Kokkos
842+ if spec .satisfies ("@5.11:5" ):
809843 cmake_args .append ("-DPARAVIEW_USE_HIP:BOOL=%s" % variant_bool ("+rocm" ))
810- if "+rocm" in spec :
811- archs = spec .variants ["amdgpu_target" ].value
812- if archs != "none" :
813- arch_str = "," .join (archs )
814- cmake_args .append ("-DCMAKE_HIP_ARCHITECTURES=%s" % arch_str )
815- cmake_args .append ("-DKokkos_CXX_COMPILER=%s" % spec ["hip" ].hipcc )
844+ elif spec .satsifies ("@6:" ):
845+ cmake_args .append ("-DPARAVIEW_USE_KOKKOS:BOOL=%s" % variant_bool ("+rocm" ))
846+
847+ if "+rocm" in spec :
848+ if spec .satisfies ("@6:" ):
849+ cmake_args .append ("-DPARAVIEW_KOKKOS_BACKEND:STRING=HIP" )
850+
851+ archs = spec .variants ["amdgpu_target" ].value
852+
853+ if archs != "none" :
854+ arch_str = "," .join (archs )
855+ cmake_args .append ("-DCMAKE_HIP_ARCHITECTURES=%s" % arch_str )
856+ cmake_args .append ("-DKokkos_CXX_COMPILER=%s" % spec ["hip" ].hipcc )
816857
817858 if "+catalyst" in spec :
818859 cmake_args .append ("-DVTK_MODULE_ENABLE_ParaView_Catalyst=YES" )
0 commit comments