From 893c5271ac1bf55bd598f0f4d7b1a4258e5dbd55 Mon Sep 17 00:00:00 2001 From: kwryankrattiger <80296582+kwryankrattiger@users.noreply.github.com> Date: Wed, 27 Apr 2022 14:39:18 -0500 Subject: Update ascent and deps for 0.8.x (#29954) * Update package versions for Ascent/SDK * Umpire build static for cuda from dray * Propagate cuda_arch for ascent and dray packages. * Ascent: Update dependency versions for ascent@0.8: * VTK-h: Patch +shared+cuda for VTK-h 0.8.x * Ascent: Patch to allow @0.8: +shared+cuda * Turn off building ascent tests. * Update ascent patch * WIP: Ascent: Update patch to configure MPI build with CUDA * Ascent: Tests require vtk-m+testlib * WIP: Ascent: Constrain 0.7 for vtk-h * Ascent: Directly depend on VTK-m --- .../packages/ascent/ascent-shared-cuda-pr903.patch | 256 +++++++++++++++++++++ var/spack/repos/builtin/packages/ascent/package.py | 35 ++- var/spack/repos/builtin/packages/dray/package.py | 55 +++-- .../builtin/packages/ecp-data-vis-sdk/package.py | 18 +- var/spack/repos/builtin/packages/vtk-h/package.py | 24 +- .../builtin/packages/vtk-h/vtk-h-shared-cuda.patch | 32 +++ var/spack/repos/builtin/packages/vtk-m/package.py | 1 + 7 files changed, 372 insertions(+), 49 deletions(-) create mode 100644 var/spack/repos/builtin/packages/ascent/ascent-shared-cuda-pr903.patch create mode 100644 var/spack/repos/builtin/packages/vtk-h/vtk-h-shared-cuda.patch diff --git a/var/spack/repos/builtin/packages/ascent/ascent-shared-cuda-pr903.patch b/var/spack/repos/builtin/packages/ascent/ascent-shared-cuda-pr903.patch new file mode 100644 index 0000000000..feb114bbb0 --- /dev/null +++ b/var/spack/repos/builtin/packages/ascent/ascent-shared-cuda-pr903.patch @@ -0,0 +1,256 @@ +diff --git a/azure-pipelines.yml b/azure-pipelines.yml +index 730ea3b4..2d3adc93 100644 +--- a/azure-pipelines.yml ++++ b/azure-pipelines.yml +@@ -387,6 +387,13 @@ stages: + # static linking unit tests eats up alot of disk space, + # so skip building tests in CI to keep us away from clif + ENABLE_TESTS: OFF ++ cuda-11.4.0-shared: ++ containerImage: ${{ variables.ubuntu_18_cuda_11_4_0_tag }} ++ BUILD_SHARED_LIBS: ON ++ CMAKE_BUILD_TYPE: Release ++ ENABLE_BABELFLOW: OFF ++ # shared linking unit tests shouldn't eat disk space, ++ ENABLE_TESTS: ON + container: $[ variables['containerImage'] ] + steps: + - checkout: self +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index bd0187e0..ec3553c7 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -50,10 +50,6 @@ else() + cmake_minimum_required(VERSION 3.9) + endif() + +-if(ENABLE_CUDA AND BUILD_SHARED_LIBS) +- message(FATAL_ERROR "Static libraries are required when building with CUDA") +-endif() +- + if(ENABLE_CUDA) + # ask politely a few times for SEPARABLE COMPILATION + set (CMAKE_CUDA_SEPARABLE_COMPILATION ON CACHE BOOL "" ) +diff --git a/src/ascent/CMakeLists.txt b/src/ascent/CMakeLists.txt +index fe9ce937..7f94a82b 100644 +--- a/src/ascent/CMakeLists.txt ++++ b/src/ascent/CMakeLists.txt +@@ -187,6 +187,10 @@ if(ASCENT_JIT_ENABLED) + set_source_files_properties(runtimes/expressions/ascent_array_internals.cpp PROPERTIES LANGUAGE CUDA) + set_source_files_properties(runtimes/expressions/ascent_derived_jit.cpp PROPERTIES LANGUAGE CUDA) + endif() ++ list(APPEND ascent_device_sources ++ runtimes/expressions/ascent_array.cpp ++ runtimes/expressions/ascent_array_internals.cpp ++ runtimes/expressions/ascent_derived_jit.cpp) + endif() + + if(VTKM_FOUND) +@@ -213,6 +217,11 @@ if(VTKM_FOUND) + runtimes/flow_filters/ascent_runtime_conduit_to_vtkm_parsing.cpp + runtimes/ascent_main_runtime.cpp) + ++ set(ascent_vtkm_device_sources ++ ${ascent_vtkh_dep_sources} ++ runtimes/flow_filters/ascent_runtime_blueprint_filters.cpp) ++ list(APPEND ascent_device_sources ${ascent_vtkm_device_sources}) ++ + foreach( _itm ${ascent_vtkh_dep_headers} ) + list(APPEND ascent_headers ${_itm}) + endforeach() +@@ -239,6 +248,7 @@ endif() + if(GENTEN_FOUND) + list(APPEND ascent_headers runtimes/flow_filters/ascent_runtime_genten_filters.hpp) + list(APPEND ascent_sources runtimes/flow_filters/ascent_runtime_genten_filters.cpp) ++ list(APPEND ascent_device_sources runtimes/flow_filters/ascent_runtime_genten_filters.cpp) + endif() + + ############################## +@@ -351,24 +361,7 @@ if (ENABLE_SERIAL) + endif() + + if(VTKM_FOUND) +- set(ascent_device_sources ${ascent_vtkh_dep_sources}) +- list(APPEND ascent_device_sources runtimes/flow_filters/ascent_runtime_blueprint_filters.cpp) +- +- vtkm_add_target_information(ascent DEVICE_SOURCES ${ascent_device_sources}) +- endif() +- +- if(ASCENT_JIT_ENABLED) +- if(CUDA_FOUND) +- list(APPEND ascent_device_sources runtimes/expressions/ascent_array.cpp) +- list(APPEND ascent_device_sources runtimes/expressions/ascent_array_internals.cpp) +- list(APPEND ascent_device_sources runtimes/expressions/ascent_derived_jit.cpp) +- endif() +- endif() +- +- if(GENTEN_FOUND) +- if(CUDA_FOUND) +- list(APPEND ascent_device_sources runtimes/flow_filters/ascent_runtime_genten_filters.cpp) +- endif() ++ vtkm_add_target_information(ascent DEVICE_SOURCES ${ascent_vtkm_device_sources}) + endif() + + # install target for serial ascent lib +@@ -380,35 +373,43 @@ if (ENABLE_SERIAL) + ) + + +- if(VTKM_FOUND AND CUDA_FOUND) ++ # Static linking CUDA ++ if(VTKM_FOUND AND CUDA_FOUND AND NOT BUILD_SHARED_LIBS) + set(locations_on_disk "") + + set(binary_dir "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/ascent.dir") + + set(targets_to_link rover +- vtkh_rendering +- vtkh_compositing +- vtkh_filters +- vtkh_core +- vtkh_lodepng +- vtkh_utils +- vtkm_io +- vtkm_rendering +- vtkm_filter_common +- vtkm_filter_contour +- vtkm_filter_gradient +- vtkm_filter_extra +- vtkm_worklet +- vtkm_source +- vtkm_cont +- vtkm_cont_testing +- vtkm_lodepng +- vtkmdiympi_nompi +- ) ++ vtkh_rendering ++ vtkh_compositing ++ vtkh_filters ++ vtkh_core ++ vtkh_lodepng ++ vtkh_utils ++ vtkmdiympi_nompi ++ vtkm_io ++ vtkm_rendering ++ vtkm_filter_common ++ vtkm_filter_contour ++ vtkm_filter_gradient ++ vtkm_filter_extra ++ vtkm_worklet ++ vtkm_source ++ vtkm_cont ++ vtkm_lodepng ++ ) ++ ++ if(ENABLE_TESTS) ++ if (NOT TARGET vtkm_cont_testing) ++ message(FATAL_ERROR "ENABLE_TESTS requires a VTKm that provides vtkm_cont_testing") ++ endif () ++ list(APPEND targets_to_link ++ vtkm_cont_testing) ++ endif() + + source_objects(${binary_dir} + "${ascent_device_sources}" +- "${CMAKE_BINARY_DIR}/lib/librover.a" ++ "$" + "${targets_to_link}" + locations_on_disk) + +@@ -502,7 +503,7 @@ if(MPI_FOUND) + endif() + + if(VTKM_FOUND) +- vtkm_add_target_information(ascent_mpi DEVICE_SOURCES ${ascent_device_sources}) ++ vtkm_add_target_information(ascent_mpi DEVICE_SOURCES ${ascent_vtkm_device_sources}) + endif() + blt_add_target_compile_flags(TO ascent_mpi FLAGS "-DASCENT_MPI_ENABLED") + +@@ -514,35 +515,48 @@ if(MPI_FOUND) + RUNTIME DESTINATION lib + ) + +- if(VTKM_FOUND AND CUDA_FOUND) ++ # Static linking CUDA ++ if(VTKM_FOUND AND CUDA_FOUND AND NOT BUILD_SHARED_LIBS) + set(locations_on_disk "") +- + set(binary_dir "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/ascent_mpi.dir") + +- set(targets_to_link rover +- vtkh_rendering_mpi +- vtkh_compositing_mpi +- vtkh_filters_mpi +- vtkh_core_mpi +- vtkh_lodepng +- vtkh_utils_mpi +- vtkm_io +- vtkm_rendering +- vtkm_filter_common +- vtkm_filter_contour +- vtkm_filter_gradient +- vtkm_filter_extra +- vtkm_worklet +- vtkm_source +- vtkm_cont +- vtkm_cont_testing +- vtkm_lodepng +- vtkmdiympi_nompi +- ) ++ set(targets_to_link ++ rover ++ vtkh_rendering_mpi ++ vtkh_compositing_mpi ++ vtkh_filters_mpi ++ vtkh_core_mpi ++ vtkh_utils_mpi ++ vtkm_io ++ vtkm_rendering ++ vtkm_filter_common ++ vtkm_filter_contour ++ vtkm_filter_gradient ++ vtkm_filter_extra ++ vtkm_worklet ++ vtkm_source ++ vtkm_cont ++ vtkm_lodepng ++ ) ++ ++ if(TARGET vtkmdiympi_nompi) ++ list(APPEND targets_to_link vtkmdiympi_nompi) ++ endif() ++ if(TARGET vtkmdiympi) ++ list(APPEND targets_to_link vtkmdiympi) ++ endif() ++ ++ if(ENABLE_TESTS) ++ if (NOT TARGET vtkm_cont_testing) ++ message(FATAL_ERROR "ENABLE_TESTS requires a VTKm that provides vtkm_cont_testing") ++ endif () ++ list(APPEND targets_to_link ++ vtkm_cont_testing) ++ endif() + + source_objects(${binary_dir} + "${ascent_device_sources}" +- "${CMAKE_BINARY_DIR}/lib/librover_mpi.a" ++ "$" + "${targets_to_link}" + locations_on_disk) + +diff --git a/src/cmake/thirdparty/SetupVTKm.cmake b/src/cmake/thirdparty/SetupVTKm.cmake +index 5dbd9aa3..b0dbde2c 100644 +--- a/src/cmake/thirdparty/SetupVTKm.cmake ++++ b/src/cmake/thirdparty/SetupVTKm.cmake +@@ -26,6 +26,11 @@ if(ENABLE_CUDA AND NOT VTKm_ENABLE_CUDA) + message(FATAL_ERROR "Ascent CUDA support requires VTK-m with CUDA support (ENABLE_CUDA == TRUE, however VTKm_ENABLE_CUDA == FALSE") + endif() + ++if(ENABLE_CUDA AND BUILD_SHARED_LIBS) ++ if(VTKm_VERSION VERSION_LESS "1.7.0") ++ message(FATAL_ERROR "Cannot build shared libs with CUDA when VTKm is < v1.7.0") ++ endif() ++endif() + + set(VTKM_FOUND TRUE) + diff --git a/var/spack/repos/builtin/packages/ascent/package.py b/var/spack/repos/builtin/packages/ascent/package.py index 38d09da8b0..78f70baf2e 100644 --- a/var/spack/repos/builtin/packages/ascent/package.py +++ b/var/spack/repos/builtin/packages/ascent/package.py @@ -44,11 +44,15 @@ class Ascent(CMakePackage, CudaPackage): branch='develop', submodules=True) - version('0.7.1', - tag='v0.7.1', + version('0.8.0', + tag='v0.8.0', submodules=True, preferred=True) + version('0.7.1', + tag='v0.7.1', + submodules=True) + version('0.7.0', tag='v0.7.0', submodules=True) @@ -95,13 +99,30 @@ class Ascent(CMakePackage, CudaPackage): # so folks can build 0.7.1 with those compilers patch("ascent-gcc-11-pr753.patch", when="@0.7.1") + # patch for allowing +shared+cuda + # https://github.com/Alpine-DAV/ascent/pull/903 + patch('ascent-shared-cuda-pr903.patch', when='@0.8.0') + ########################################################################## # package dependencies ########################################################################### + def propagate_cuda_arch(package, spec=None): + if not spec: + spec = '' + for cuda_arch in CudaPackage.cuda_arch_values: + depends_on('{0} +cuda cuda_arch={1}' + .format(package, cuda_arch), + when='{0} +cuda cuda_arch={1}' + .format(spec, cuda_arch)) # Certain CMake versions have been found to break for our use cases depends_on("cmake@3.14.1:3.14,3.18.2:", type='build') + + ####################### + # Conduit + ####################### depends_on("conduit@:0.7.2", when="@:0.7.1") + depends_on("conduit@0.8.2:", when="@0.8:") depends_on("conduit+python", when="+python") depends_on("conduit~python", when="~python") depends_on("conduit+mpi", when="+mpi") @@ -135,13 +156,19 @@ class Ascent(CMakePackage, CudaPackage): ############################# depends_on("vtk-h", when="+vtkh") + depends_on("vtk-h@:0.7", when="@:0.7 +vtkh") + depends_on("vtk-h@0.8.1:", when="@0.8: +vtkh") # propagate relevent variants to vtk-h depends_on("vtk-h+openmp", when="+vtkh+openmp") depends_on("vtk-h~openmp", when="+vtkh~openmp") depends_on("vtk-h+cuda", when="+vtkh+cuda") depends_on("vtk-h~cuda", when="+vtkh~cuda") + propagate_cuda_arch('vtk-h', '+vtkh') depends_on("vtk-h+shared", when="+vtkh+shared") depends_on("vtk-h~shared", when="+vtkh~shared") + # When using VTK-h ascent also needs VTK-m + depends_on("vtk-m", when="+vtkh") + depends_on("vtk-m+testlib", when="+vtkh+test^vtk-m") # mfem depends_on("mfem~threadsafe~openmp+conduit", when="+mfem") @@ -157,9 +184,11 @@ class Ascent(CMakePackage, CudaPackage): # devil ray variants with mpi # we have to specify both because mfem makes us depends_on('dray~test~utils', when='+dray') + depends_on('dray@0.1.8:', when='@0.8: +dray') # propagate relevent variants to dray depends_on('dray+cuda', when='+dray+cuda') depends_on('dray~cuda', when='+dray~cuda') + propagate_cuda_arch('dray', '+dray') depends_on('dray+mpi', when='+dray+mpi') depends_on('dray~mpi', when='+dray~mpi') depends_on('dray+shared', when='+dray+shared') @@ -184,7 +213,7 @@ class Ascent(CMakePackage, CudaPackage): ########### # Conflicts ########### - conflicts("+shared", when="+cuda", + conflicts("+shared", when="@:0.7 +cuda", msg="Ascent needs to be built with ~shared for CUDA builds.") def setup_build_environment(self, env): diff --git a/var/spack/repos/builtin/packages/dray/package.py b/var/spack/repos/builtin/packages/dray/package.py index 158b9fd90d..16b3b04323 100644 --- a/var/spack/repos/builtin/packages/dray/package.py +++ b/var/spack/repos/builtin/packages/dray/package.py @@ -44,7 +44,6 @@ class Dray(Package, CudaPackage): version('0.1.1', sha256='e5daa49ee3367c087f5028dc5a08655298beb318014c6f3f65ef4a08fcbe346c') version('0.1.0', sha256='8b341138e1069361351e0a94478608c5af479cca76e2f97d556229aed45c0169') - variant('cuda', default=False, description='Build with CUDA backend') variant('openmp', default=True, description='Build OpenMP backend') variant("shared", default=True, description="Build as shared libs") variant("test", default=True, description='Build unit tests') @@ -55,7 +54,15 @@ class Dray(Package, CudaPackage): # set to false for systems that implicitly link mpi variant('blt_find_mpi', default=True, description='Use BLT CMake Find MPI logic') - depends_on('cuda', when='+cuda') + def propagate_cuda_arch(package, spec=None): + if not spec: + spec = '' + for cuda_arch in CudaPackage.cuda_arch_values: + depends_on('{0} +cuda cuda_arch={1}' + .format(package, cuda_arch), + when='{0} +cuda cuda_arch={1}' + .format(spec, cuda_arch)) + depends_on('mpi', when='+mpi') depends_on('cmake@3.9:', type='build') @@ -64,34 +71,34 @@ class Dray(Package, CudaPackage): depends_on("conduit~shared", when="~shared") depends_on("conduit+shared", when="+shared") - depends_on("apcomp~shared+openmp+mpi", when="~shared+openmp+mpi") - depends_on("apcomp+shared+openmp+mpi", when="+shared+openmp+mpi") - depends_on("apcomp~shared~openmp+mpi", when="~shared~openmp+mpi") - depends_on("apcomp+shared~openmp+mpi", when="+shared~openmp+mpi") - depends_on("apcomp~shared+openmp~mpi", when="~shared+openmp~mpi") - depends_on("apcomp+shared+openmp~mpi", when="+shared+openmp~mpi") - depends_on("apcomp~shared~openmp~mpi", when="~shared~openmp~mpi") - depends_on("apcomp+shared~openmp~mpi", when="+shared~openmp~mpi") + depends_on("apcomp~mpi", when="~mpi") + depends_on("apcomp+mpi", when="+mpi") + depends_on("apcomp~openmp", when="~openmp") + depends_on("apcomp+openmp", when="+openmp") + depends_on("apcomp~shared", when="~shared") + depends_on("apcomp+shared", when="+shared") depends_on("raja@:0.13", when="@:0.1.6") - depends_on("raja+cuda~openmp+shared", when="+cuda~openmp+shared") - depends_on("raja+cuda+openmp+shared", when="+cuda+openmp+shared") - depends_on("raja+cuda~openmp~shared", when="+cuda~openmp~shared") - depends_on("raja+cuda+openmp~shared", when="+cuda+openmp~shared") - - depends_on("raja~cuda~openmp+shared", when="~cuda~openmp+shared") - depends_on("raja~cuda+openmp+shared", when="~cuda+openmp+shared") - depends_on("raja~cuda~openmp~shared", when="~cuda~openmp~shared") - depends_on("raja~cuda+openmp~shared", when="~cuda+openmp~shared") + depends_on("raja~cuda", when="~cuda") + depends_on("raja+cuda", when="+cuda") + propagate_cuda_arch('raja') + depends_on("raja~shared", when="~shared") + depends_on("raja+shared", when="+shared") + depends_on("raja~openmp", when="~openmp") + depends_on("raja+openmp", when="+openmp") depends_on("umpire@:4.9", when="@:0.1.6") - depends_on("umpire+cuda+shared", when="+cuda+shared") - depends_on("umpire+cuda~shared", when="+cuda~shared") + # Only use umpire cuda if not shared. + depends_on("umpire+cuda", when="+cuda") + depends_on("umpire~cuda", when="~cuda") + depends_on("umpire+cuda~shared", when="+cuda+shared") depends_on("umpire~cuda+shared", when="~cuda+shared") - depends_on("umpire~cuda~shared", when="~cuda~shared") + propagate_cuda_arch('umpire') + depends_on("umpire~shared", when="~shared") - depends_on("mfem+shared+conduit~threadsafe", when="+shared") - depends_on("mfem~shared+conduit~threadsafe", when="~shared") + depends_on("mfem+conduit~threadsafe") + depends_on("mfem+shared", when="+shared") + depends_on("mfem~shared", when="~shared") def setup_build_environment(self, env): env.set('CTEST_OUTPUT_ON_FAILURE', '1') diff --git a/var/spack/repos/builtin/packages/ecp-data-vis-sdk/package.py b/var/spack/repos/builtin/packages/ecp-data-vis-sdk/package.py index a211b3e855..bf34748f45 100644 --- a/var/spack/repos/builtin/packages/ecp-data-vis-sdk/package.py +++ b/var/spack/repos/builtin/packages/ecp-data-vis-sdk/package.py @@ -125,14 +125,12 @@ class EcpDataVisSdk(BundlePackage, CudaPackage, ROCmPackage): dav_sdk_depends_on('sensei@develop +vtkio +python ~miniapps', when='+sensei', propagate=dict(propagate_to_sensei)) - dav_sdk_depends_on('ascent+mpi+fortran+openmp+python+shared+vtkh+dray', + dav_sdk_depends_on('ascent+mpi+fortran+openmp+python+shared+vtkh+dray~test', when='+ascent', - propagate=['adios2'] + cuda_arch_variants) + propagate=['adios2', 'cuda'] + cuda_arch_variants) # Need to explicitly turn off conduit hdf5_compat in order to build # hdf5@1.12 which is required for SDK depends_on('ascent ^conduit ~hdf5_compat', when='+ascent +hdf5') - depends_on('ascent~cuda', when='+ascent~cuda') - depends_on('ascent+cuda', when='+ascent+cuda ^vtk-m@1.7:') # Disable configuring with @develop. This should be removed after ascent # releases 0.8 and ascent can build with conduit@0.8: and vtk-m@1.7: conflicts('ascent@develop') @@ -153,15 +151,11 @@ class EcpDataVisSdk(BundlePackage, CudaPackage, ROCmPackage): dav_sdk_depends_on('visit', when='+visit') - dav_sdk_depends_on('vtk-m+shared+mpi+openmp+rendering', + dav_sdk_depends_on('vtk-m@1.7:+shared+mpi+openmp+rendering', when='+vtkm', - propagate=['cuda'] + cuda_arch_variants) - depends_on('vtk-m +rocm', when='+vtkm +rocm ^vtk-m@1.7:') - for amdgpu_target in amdgpu_target_variants: - depends_on('vtk-m {0}'.format(amdgpu_target), - when='+vtkm {0} ^vtk-m@1.7:'.format(amdgpu_target)) - - # depends_on('vtk-m ~rocm', when='+vtkm +rocm ^vtk-m@:1.6') + propagate=['cuda', 'rocm'] + + cuda_arch_variants + + amdgpu_target_variants) # +python is currently broken in sz # dav_sdk_depends_on('sz+shared+fortran+python+random_access', diff --git a/var/spack/repos/builtin/packages/vtk-h/package.py b/var/spack/repos/builtin/packages/vtk-h/package.py index 4b2d076932..93dfb965d6 100644 --- a/var/spack/repos/builtin/packages/vtk-h/package.py +++ b/var/spack/repos/builtin/packages/vtk-h/package.py @@ -39,6 +39,8 @@ class VtkH(Package, CudaPackage): maintainers = ['cyrush'] version('develop', branch='develop', submodules=True) + version('0.8.1', sha256="0cb1c84087e2b9385477fba3e7e197d6eabe1d366bd3bc87d7824e50dcdbe057") + version('0.8.0', sha256="8366ebfe094c258555f343ba1f9bbad1d8e4804f844768b639f6ff13a6390f29") version('0.7.1', sha256="f28f7e6fb0f854a2293265b67cbdfb350b42c13ac08ffffe9cd246f3fe9fb77a") version('0.7.0', sha256="1b3c15c1340c5f66edcc2962ffe2f0d86e155f45a4932cf9c407261c203fbc19") version('0.6.9', sha256="8111f59c3528f02cb3c5083c17a1737dff9472266b156732794612471f3393c7") @@ -61,7 +63,6 @@ class VtkH(Package, CudaPackage): variant("shared", default=True, description="Build vtk-h as shared libs") variant("mpi", default=True, description="build mpi support") variant("serial", default=True, description="build serial (non-mpi) libraries") - variant("cuda", default=False, description="build cuda support") variant("openmp", default=(sys.platform != 'darwin'), description="build openmp support") variant("logging", default=False, description="Build vtk-h with logging enabled") @@ -71,20 +72,23 @@ class VtkH(Package, CudaPackage): depends_on("cmake@3.14.1:3.14,3.18.2:", type='build') depends_on("mpi", when="+mpi") - depends_on("cuda", when="+cuda") - depends_on("vtk-m@:1.6~tbb+openmp", when="+openmp") - depends_on("vtk-m@:1.6~tbb~openmp", when="~openmp") + depends_on("vtk-m~tbb") + depends_on("vtk-m@:1.6", when="@:0.7") + depends_on("vtk-m@1.7:", when="@0.8:") + depends_on("vtk-m+openmp", when="+openmp") + depends_on("vtk-m~openmp", when="~openmp") + + depends_on("vtk-m~cuda", when="~cuda") + depends_on("vtk-m+cuda", when="+cuda") for _arch in CudaPackage.cuda_arch_values: - depends_on("vtk-m@:1.6+cuda~tbb+openmp cuda_arch={0}".format(_arch), when="+cuda+openmp cuda_arch={0}".format(_arch)) - depends_on("vtk-m@:1.6+cuda~tbb~openmp cuda_arch={0}".format(_arch), when="+cuda~openmp cuda_arch={0}".format(_arch)) + depends_on("vtk-m cuda_arch={0}".format(_arch), when="+cuda cuda_arch={0}".format(_arch)) - depends_on("vtk-m@:1.6~tbb+openmp~shared", when="+openmp~shared") - depends_on("vtk-m@:1.6~tbb~openmp~shared", when="~openmp~shared") + depends_on("vtk-m+shared", when="+shared") + depends_on("vtk-m~shared", when="~shared") - depends_on("vtk-m@:1.6+cuda~tbb+openmp~shared", when="+cuda+openmp~shared") - depends_on("vtk-m@:1.6+cuda~tbb~openmp~shared", when="+cuda~openmp~shared") + patch('vtk-h-shared-cuda.patch', when='@0.8.0,0.8.1 +cuda') def install(self, spec, prefix): with working_dir('spack-build', create=True): diff --git a/var/spack/repos/builtin/packages/vtk-h/vtk-h-shared-cuda.patch b/var/spack/repos/builtin/packages/vtk-h/vtk-h-shared-cuda.patch new file mode 100644 index 0000000000..5ecb5cb459 --- /dev/null +++ b/var/spack/repos/builtin/packages/vtk-h/vtk-h-shared-cuda.patch @@ -0,0 +1,32 @@ +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 1379294..6de15c3 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -61,11 +61,6 @@ if(NOT ENABLE_SERIAL AND NOT ENABLE_MPI) + "Please set ENABLE_SERIAL, ENABLE_MPI or both to ON") + endif() + +- +-if(ENABLE_CUDA AND BUILD_SHARED_LIBS) +- message(FATAL_ERROR "Static libraries are required when building with CUDA") +-endif() +- + if(ENABLE_CUDA) + # ask politely a few times for SEPARABLE COMPILATION + set (CMAKE_CUDA_SEPARABLE_COMPILATION ON CACHE BOOL "" ) +diff --git a/src/cmake/thirdparty/SetupVTKm.cmake b/src/cmake/thirdparty/SetupVTKm.cmake +index 1bc5b56..e242738 100644 +--- a/src/cmake/thirdparty/SetupVTKm.cmake ++++ b/src/cmake/thirdparty/SetupVTKm.cmake +@@ -64,6 +64,11 @@ if(ENABLE_CUDA AND NOT VTKm_ENABLE_CUDA) + message(FATAL_ERROR "VTK-h CUDA support requires VTK-m with CUDA support (ENABLE_CUDA == TRUE, however VTKm_ENABLE_CUDA == FALSE") + endif() + ++if(ENABLE_CUDA AND BUILD_SHARED_LIBS) ++ if(VTKm_VERSION VERSION_LESS "1.7.0") ++ message(FATAL_ERROR "Cannot build shared libs with CUDA when VTKm is < v1.7.0") ++ endif() ++endif() + + set(VTKM_FOUND TRUE) + diff --git a/var/spack/repos/builtin/packages/vtk-m/package.py b/var/spack/repos/builtin/packages/vtk-m/package.py index d171aa0e3d..ae898a8945 100644 --- a/var/spack/repos/builtin/packages/vtk-m/package.py +++ b/var/spack/repos/builtin/packages/vtk-m/package.py @@ -105,6 +105,7 @@ class VtkM(CMakePackage, CudaPackage, ROCmPackage): # Can build +shared+cuda after @1.7: conflicts("+shared", when="@:1.6 +cuda_native") conflicts("+cuda~cuda_native~kokkos", msg="Cannot have +cuda without a cuda device") + conflicts("+cuda~cuda_native", when="@:1.5", msg="Cannot have +cuda without a cuda device") conflicts("+cuda", when="cuda_arch=none", msg="vtk-m +cuda requires that cuda_arch be set") -- cgit v1.2.3-70-g09d2