diff --git a/Accelerators/Vtkm/Core/CMakeLists.txt b/Accelerators/Vtkm/Core/CMakeLists.txt index 1b41748f2ff4ba7aae23ca1b7d0f9b327c5a54ef..51f7ccfdc6b3a458589221837cb0dc93157ac46c 100644 --- a/Accelerators/Vtkm/Core/CMakeLists.txt +++ b/Accelerators/Vtkm/Core/CMakeLists.txt @@ -53,11 +53,12 @@ if (TARGET vtkm::cuda) vtk_module_set_properties(VTK::AcceleratorsVTKmCore CUDA_SEPARABLE_COMPILATION ON) elseif (TARGET vtkm::kokkos_cuda) - string(APPEND CMAKE_CUDA_FLAGS " -Xnvlink -w") + add_compile_definitions(VTK_USE_KOKKOS) set_source_files_properties(${device_sources} PROPERTIES LANGUAGE CUDA) kokkos_compilation(SOURCE ${device_sources}) elseif (TARGET vtkm::kokkos_hip) + add_compile_definitions(VTK_USE_KOKKOS) set_source_files_properties(${device_sources} PROPERTIES LANGUAGE HIP) kokkos_compilation(SOURCE ${device_sources}) endif () diff --git a/Accelerators/Vtkm/Core/vtkmlib/vtkmInitializer.cxx b/Accelerators/Vtkm/Core/vtkmlib/vtkmInitializer.cxx index eb185d3112d13496ba5c407d02f6dcb447097794..7af361d32218816d3a6e3963e9a816e0f1c4b933 100644 --- a/Accelerators/Vtkm/Core/vtkmlib/vtkmInitializer.cxx +++ b/Accelerators/Vtkm/Core/vtkmlib/vtkmInitializer.cxx @@ -9,8 +9,8 @@ VTK_ABI_NAMESPACE_BEGIN void InitializeVTKm() { -// Only Kokkos HIP backend needs to be initialized -#ifdef VTKM_HIP +// Kokkos enabled devices needs to be initialized +#ifdef VTK_USE_KOKKOS static bool isInitialized{ false }; if (!isInitialized) { diff --git a/Accelerators/Vtkm/DataModel/CMakeLists.txt b/Accelerators/Vtkm/DataModel/CMakeLists.txt index 0267d6af24b5f89eea6192250377425b51a4e967..9b6f144f96c925562cc8adfcb71989f759d7d7fe 100644 --- a/Accelerators/Vtkm/DataModel/CMakeLists.txt +++ b/Accelerators/Vtkm/DataModel/CMakeLists.txt @@ -48,7 +48,7 @@ vtkm_add_target_information(${vtkm_accel_target} MODIFY_CUDA_FLAGS DEVICE_SOURCES ${sources}) -if (TARGET vtkm::cuda OR TARGET vtkm::kokkos_cuda) +if (TARGET vtkm::cuda) # Temporarily suppress "has address taken but no possible call to it" warnings, # until we figure out its implications. # We are disabling all warnings as nvlink has no known way to suppress @@ -59,14 +59,18 @@ if (TARGET vtkm::cuda OR TARGET vtkm::kokkos_cuda) set(cuda_impl ${nowrap_sources} vtkmDataSet.cxx) set_source_files_properties(${cuda_impl} PROPERTIES LANGUAGE CUDA) - if (TARGET vtkm::cuda) - vtk_module_set_properties(VTK::AcceleratorsVTKmDataModel - CUDA_SEPARABLE_COMPILATION ON) - endif() + vtk_module_set_properties(VTK::AcceleratorsVTKmDataModel CUDA_SEPARABLE_COMPILATION ON) vtk_module_compile_options(VTK::AcceleratorsVTKmDataModel PUBLIC $<$<COMPILE_LANGUAGE:CUDA>:-Xcudafe --diag_suppress=extra_semicolon>) -endif () + +elseif (TARGET vtkm::kokkos_cuda) + list(TRANSFORM nowrap_classes APPEND ".cxx" OUTPUT_VARIABLE nowrap_sources) + set(cuda_impl ${nowrap_sources} vtkmDataSet.cxx) + set_source_files_properties(${cuda_impl} PROPERTIES LANGUAGE CUDA) + kokkos_compilation(SOURCE ${cuda_impl}) + +endif() if (MSVC) set(msvc_warning_flags diff --git a/Accelerators/Vtkm/Filters/CMakeLists.txt b/Accelerators/Vtkm/Filters/CMakeLists.txt index 5f45cdfa7c84eb884380e35de7eea71e2de59374..c8fcdce4eae0b5d06fc1943c877b5328caa16155 100644 --- a/Accelerators/Vtkm/Filters/CMakeLists.txt +++ b/Accelerators/Vtkm/Filters/CMakeLists.txt @@ -106,7 +106,7 @@ vtkm_add_target_information(${vtkm_accel_target} MODIFY_CUDA_FLAGS DEVICE_SOURCES ${sources}) -if (TARGET vtkm::cuda OR TARGET vtkm::kokkos_cuda) +if (TARGET vtkm::cuda) # Temporarily suppress "has address taken but no possible call to it" warnings, # until we figure out its implications. # We are disabling all warnings as nvlink has no known way to suppress @@ -115,15 +115,17 @@ if (TARGET vtkm::cuda OR TARGET vtkm::kokkos_cuda) list(TRANSFORM classes APPEND ".cxx" OUTPUT_VARIABLE cuda_impl) set_source_files_properties(${cuda_impl} PROPERTIES LANGUAGE CUDA) - - if (TARGET vtkm::cuda) - vtk_module_set_properties(VTK::AcceleratorsVTKmFilters - CUDA_SEPARABLE_COMPILATION ON) - endif() + vtk_module_set_properties(VTK::AcceleratorsVTKmFilters CUDA_SEPARABLE_COMPILATION ON) vtk_module_compile_options(VTK::AcceleratorsVTKmFilters PUBLIC $<$<COMPILE_LANGUAGE:CUDA>:-Xcudafe --diag_suppress=extra_semicolon>) -endif () +elseif (TARGET vtkm::kokkos_cuda) + + list(TRANSFORM classes APPEND ".cxx" OUTPUT_VARIABLE cuda_impl) + set_source_files_properties(${cuda_impl} PROPERTIES LANGUAGE CUDA) + kokkos_compilation(SOURCE ${cuda_impl}) + +endif() if (MSVC) set(msvc_warning_flags