From ff30684c8e0a466f81baf2b884a41ce190e51d0c Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Tue, 9 Apr 2019 09:52:53 -0400 Subject: [PATCH] Removes the default device macros from VTK-m Fixes #116 --- examples/CMakeLists.txt | 2 +- examples/clipping/CMakeLists.txt | 20 +- examples/clipping/Clipping.cxx | 7 +- examples/contour_tree/CMakeLists.txt | 40 +- examples/contour_tree/ContourTreeMesh2D.cxx | 11 +- examples/contour_tree/ContourTreeMesh3D.cxx | 11 +- .../contour_tree_augmented/CMakeLists.txt | 52 +-- .../contour_tree_augmented/ContourTreeApp.cxx | 9 +- examples/cosmotools/CMakeLists.txt | 17 +- examples/cosmotools/CosmoCenterFinder.cxx | 5 +- examples/cosmotools/CosmoHaloFinder.cxx | 5 +- examples/demo/Demo.cxx | 7 +- examples/game_of_life/CMakeLists.txt | 9 +- examples/game_of_life/GameOfLife.cu | 20 - examples/game_of_life/GameOfLife.cxx | 4 +- examples/hello_world/CMakeLists.txt | 5 +- examples/hello_world/HelloWorld.cu | 23 - examples/hello_world/HelloWorld.cxx | 4 +- examples/histogram/CMakeLists.txt | 20 +- examples/histogram/Histogram.cxx | 6 + examples/isosurface/CMakeLists.txt | 14 +- examples/isosurface/IsosurfaceUniformGrid.cu | 23 - examples/isosurface/IsosurfaceUniformGrid.cxx | 12 +- .../isosurface/IsosurfaceUniformGridTBB.cxx | 23 - examples/lagrangian/CMakeLists.txt | 11 +- examples/lagrangian/lagrangian.cxx | 10 +- examples/multi_backend/CMakeLists.txt | 3 +- examples/multi_backend/MultiBackend.cxx | 7 +- .../multi_backend/MultiDeviceGradient.hxx | 42 +- examples/oscillator/CMakeLists.txt | 21 +- examples/oscillator/Oscillator.cxx | 56 +-- examples/particle_advection/CMakeLists.txt | 10 +- .../particle_advection/ParticleAdvection.cu | 23 - .../particle_advection/ParticleAdvection.cxx | 28 +- .../ParticleAdvectionTBB.cxx | 25 -- examples/redistribute_points/CMakeLists.txt | 20 +- .../RedistributePoints.cxx | 9 +- examples/rendering/CMakeLists.txt | 11 +- examples/rendering/Rendering.cxx | 10 +- examples/streamline/CMakeLists.txt | 14 +- examples/streamline/StreamLineUniformGrid.cu | 23 - examples/streamline/StreamLineUniformGrid.cxx | 21 +- .../streamline/StreamLineUniformGridTBB.cxx | 23 - examples/tau_timing/CMakeLists.txt | 12 +- examples/tau_timing/TauTiming.cu | 23 - examples/tau_timing/TauTiming.cxx | 29 +- examples/tau_timing/TauTimingTBB.cxx | 23 - examples/temporal_advection/CMakeLists.txt | 12 +- .../temporal_advection/TemporalAdvection.cu | 23 - .../temporal_advection/TemporalAdvection.cxx | 9 + .../TemporalAdvectionTBB.cxx | 23 - examples/tetrahedra/CMakeLists.txt | 40 +- .../tetrahedra/TetrahedralizeExplicitGrid.cu | 23 - .../tetrahedra/TetrahedralizeExplicitGrid.cxx | 12 +- .../TetrahedralizeExplicitGridTBB.cxx | 23 - .../tetrahedra/TetrahedralizeUniformGrid.cu | 23 - .../tetrahedra/TetrahedralizeUniformGrid.cxx | 17 +- .../TetrahedralizeUniformGridTBB.cxx | 23 - .../tetrahedra/TriangulateExplicitGrid.cu | 23 - .../tetrahedra/TriangulateExplicitGrid.cxx | 13 +- .../tetrahedra/TriangulateExplicitGridTBB.cxx | 23 - examples/tetrahedra/TriangulateUniformGrid.cu | 23 - .../tetrahedra/TriangulateUniformGrid.cxx | 16 +- .../tetrahedra/TriangulateUniformGridTBB.cxx | 23 - examples/unified_memory/UnifiedMemory.cu | 5 +- vtkm/cont/DeviceAdapter.h | 23 +- vtkm/cont/DeviceAdapterTag.h | 13 + vtkm/cont/ExecutionObjectBase.h | 13 +- vtkm/cont/VariantArrayHandle.cxx | 2 + .../testing/UnitTestTransportArrayInOut.cxx | 3 +- .../testing/UnitTestTransportWholeArray.cxx | 2 +- .../cuda/testing/UnitTestCudaArrayHandle.cu | 5 - .../testing/UnitTestCudaArrayHandleFancy.cu | 5 - ...itTestCudaArrayHandleVirtualCoordinates.cu | 5 - .../cont/cuda/testing/UnitTestCudaBitField.cu | 6 - .../UnitTestCudaCellLocatorRectilinearGrid.cu | 5 - .../UnitTestCudaCellLocatorUniformBins.cu | 5 - .../UnitTestCudaCellLocatorUniformGrid.cu | 5 - .../cuda/testing/UnitTestCudaColorTable.cu | 5 - .../cuda/testing/UnitTestCudaComputeRange.cu | 5 - .../testing/UnitTestCudaDataSetExplicit.cu | 5 - .../testing/UnitTestCudaDataSetSingleType.cu | 5 - .../cuda/testing/UnitTestCudaDeviceAdapter.cu | 5 - .../cont/cuda/testing/UnitTestCudaGeometry.cu | 5 - .../testing/UnitTestCudaImplicitFunction.cu | 5 - vtkm/cont/cuda/testing/UnitTestCudaMath.cu | 5 - .../UnitTestCudaPointLocatorUniformGrid.cu | 5 - ...tTestCudaShareUserProvidedManagedMemory.cu | 5 - .../UnitTestCudaVirtualObjectHandle.cu | 5 - vtkm/cont/internal/CMakeLists.txt | 1 - .../internal/DeviceAdapterDefaultSelection.h | 100 ----- .../testing/UnitTestOpenMPArrayHandle.cxx | 3 - .../UnitTestOpenMPArrayHandleFancy.cxx | 3 - ...estOpenMPArrayHandleVirtualCoordinates.cxx | 3 - .../openmp/testing/UnitTestOpenMPBitField.cxx | 3 - ...itTestOpenMPCellLocatorRectilinearGrid.cxx | 5 - .../UnitTestOpenMPCellLocatorUniformBins.cxx | 3 - .../UnitTestOpenMPCellLocatorUniformGrid.cxx | 5 - .../testing/UnitTestOpenMPColorTable.cxx | 3 - .../testing/UnitTestOpenMPComputeRange.cxx | 3 - .../testing/UnitTestOpenMPDataSetExplicit.cxx | 3 - .../UnitTestOpenMPDataSetSingleType.cxx | 3 - .../testing/UnitTestOpenMPDeviceAdapter.cxx | 3 - .../UnitTestOpenMPImplicitFunction.cxx | 3 - .../UnitTestOpenMPPointLocatorUniformGrid.cxx | 3 - .../UnitTestOpenMPVirtualObjectHandle.cxx | 3 - .../testing/UnitTestSerialArrayHandle.cxx | 5 - .../UnitTestSerialArrayHandleFancy.cxx | 6 - ...estSerialArrayHandleVirtualCoordinates.cxx | 5 - .../serial/testing/UnitTestSerialBitField.cxx | 6 - ...itTestSerialCellLocatorRectilinearGrid.cxx | 5 - .../UnitTestSerialCellLocatorUniformBins.cxx | 5 - .../UnitTestSerialCellLocatorUniformGrid.cxx | 5 - .../testing/UnitTestSerialColorTable.cxx | 5 - .../testing/UnitTestSerialComputeRange.cxx | 5 - .../testing/UnitTestSerialDataSetExplicit.cxx | 5 - .../UnitTestSerialDataSetSingleType.cxx | 5 - .../testing/UnitTestSerialDeviceAdapter.cxx | 5 - .../serial/testing/UnitTestSerialGeometry.cxx | 5 - .../UnitTestSerialImplicitFunction.cxx | 5 - .../UnitTestSerialPointLocatorUniformGrid.cxx | 5 - .../UnitTestSerialVirtualObjectHandle.cxx | 5 - .../tbb/testing/UnitTestTBBArrayHandle.cxx | 5 - .../testing/UnitTestTBBArrayHandleFancy.cxx | 5 - ...itTestTBBArrayHandleVirtualCoordinates.cxx | 5 - vtkm/cont/tbb/testing/UnitTestTBBBitField.cxx | 6 - .../UnitTestTBBCellLocatorRectilinearGrid.cxx | 5 - .../UnitTestTBBCellLocatorUniformBins.cxx | 5 - .../UnitTestTBBCellLocatorUniformGrid.cxx | 5 - .../tbb/testing/UnitTestTBBColorTable.cxx | 5 - .../tbb/testing/UnitTestTBBComputeRange.cxx | 5 - .../testing/UnitTestTBBDataSetExplicit.cxx | 5 - .../testing/UnitTestTBBDataSetSingleType.cxx | 5 - .../tbb/testing/UnitTestTBBDeviceAdapter.cxx | 5 - .../testing/UnitTestTBBImplicitFunction.cxx | 5 - .../UnitTestTBBPointLocatorUniformGrid.cxx | 5 - .../UnitTestTBBVirtualObjectHandle.cxx | 5 - .../UnitTestArrayHandleCartesianProduct.cxx | 2 - .../UnitTestArrayHandleCompositeVector.cxx | 4 - .../testing/UnitTestArrayHandleCounting.cxx | 3 - .../UnitTestArrayHandleExtractComponent.cxx | 2 +- .../UnitTestArrayHandlePermutation.cxx | 2 +- .../testing/UnitTestArrayHandleSwizzle.cxx | 26 +- .../testing/UnitTestArrayHandleTransform.cxx | 4 +- .../testing/UnitTestCellLocatorGeneral.cxx | 2 +- vtkm/cont/testing/UnitTestCellSetExplicit.cxx | 2 +- .../testing/UnitTestCellSetPermutation.cxx | 6 +- .../UnitTestDataSetBuilderExplicit.cxx | 4 +- ...itTestDeviceAdapterAlgorithmDependency.cxx | 3 - .../UnitTestDeviceAdapterAlgorithmGeneral.cxx | 3 - vtkm/cont/testing/UnitTestTryExecute.cxx | 3 - .../testing/UnitTestTaskTilingOpenMP.cxx | 3 - .../testing/UnitTestSplitSharpEdgesFilter.cxx | 1 - vtkm/rendering/raytracing/Camera.cxx | 2 +- .../testing/glut/UnitTestMapperGLUT.cxx | 2 +- vtkm/worklet/StreamLineUniformGrid.h | 410 +++++++++--------- .../worklet/testing/UnitTestExternalFaces.cxx | 8 - .../testing/UnitTestStreamLineUniformGrid.cxx | 37 +- 158 files changed, 554 insertions(+), 1587 deletions(-) delete mode 100644 examples/game_of_life/GameOfLife.cu delete mode 100644 examples/hello_world/HelloWorld.cu delete mode 100644 examples/isosurface/IsosurfaceUniformGrid.cu delete mode 100644 examples/isosurface/IsosurfaceUniformGridTBB.cxx delete mode 100644 examples/particle_advection/ParticleAdvection.cu delete mode 100644 examples/particle_advection/ParticleAdvectionTBB.cxx delete mode 100644 examples/streamline/StreamLineUniformGrid.cu delete mode 100644 examples/streamline/StreamLineUniformGridTBB.cxx delete mode 100644 examples/tau_timing/TauTiming.cu delete mode 100644 examples/tau_timing/TauTimingTBB.cxx delete mode 100644 examples/temporal_advection/TemporalAdvection.cu delete mode 100644 examples/temporal_advection/TemporalAdvectionTBB.cxx delete mode 100644 examples/tetrahedra/TetrahedralizeExplicitGrid.cu delete mode 100644 examples/tetrahedra/TetrahedralizeExplicitGridTBB.cxx delete mode 100644 examples/tetrahedra/TetrahedralizeUniformGrid.cu delete mode 100644 examples/tetrahedra/TetrahedralizeUniformGridTBB.cxx delete mode 100644 examples/tetrahedra/TriangulateExplicitGrid.cu delete mode 100644 examples/tetrahedra/TriangulateExplicitGridTBB.cxx delete mode 100644 examples/tetrahedra/TriangulateUniformGrid.cu delete mode 100644 examples/tetrahedra/TriangulateUniformGridTBB.cxx delete mode 100644 vtkm/cont/internal/DeviceAdapterDefaultSelection.h diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 8ae956def..0beff8054 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -41,7 +41,7 @@ add_subdirectory(rendering) add_subdirectory(streamline) add_subdirectory(temporal_advection) add_subdirectory(tetrahedra) -add_subdirectory(unified_memory) +# add_subdirectory(unified_memory) if (VTKm_ENABLE_TESTING) diff --git a/examples/clipping/CMakeLists.txt b/examples/clipping/CMakeLists.txt index 47b989e5c..072dcb2ce 100644 --- a/examples/clipping/CMakeLists.txt +++ b/examples/clipping/CMakeLists.txt @@ -25,23 +25,9 @@ project(Clipping CXX) #Find the VTK-m package find_package(VTKm REQUIRED QUIET) -add_executable(Clipping_SERIAL Clipping.cxx) -target_compile_definitions(Clipping_SERIAL PRIVATE - "VTKM_DEVICE_ADAPTER=VTKM_DEVICE_ADAPTER_SERIAL") -target_link_libraries(Clipping_SERIAL PRIVATE vtkm_filter) - -if(TARGET vtkm::tbb) - add_executable(Clipping_TBB Clipping.cxx) - target_compile_definitions(Clipping_TBB PRIVATE - "VTKM_DEVICE_ADAPTER=VTKM_DEVICE_ADAPTER_TBB") - target_link_libraries(Clipping_TBB PRIVATE vtkm_filter) -endif() +add_executable(Clipping Clipping.cxx) +target_link_libraries(Clipping PRIVATE vtkm_filter) if(TARGET vtkm::cuda) - vtkm_compile_as_cuda(cudaSource Clipping.cxx) - add_executable(Clipping_CUDA ${cudaSource}) - - target_compile_definitions(Clipping_CUDA PRIVATE - "VTKM_DEVICE_ADAPTER=VTKM_DEVICE_ADAPTER_CUDA") - target_link_libraries(Clipping_CUDA PRIVATE vtkm_filter) + set_source_files_properties(Clipping.cxx PROPERTIES LANGUAGE "CUDA") endif() diff --git a/examples/clipping/Clipping.cxx b/examples/clipping/Clipping.cxx index 370f67443..e1cb9726c 100644 --- a/examples/clipping/Clipping.cxx +++ b/examples/clipping/Clipping.cxx @@ -19,7 +19,9 @@ //============================================================================ #include #include +#include #include + #include #include @@ -69,10 +71,13 @@ struct FieldMapper int main(int argc, char* argv[]) { + auto opts = vtkm::cont::InitializeOptions::DefaultAnyDevice; + vtkm::cont::InitializeResult config = vtkm::cont::Initialize(argc, argv, opts); if (argc < 4) { std::cout << "Usage: " << std::endl - << "$ " << argv[0] << " [fieldName] " + << "$ " << argv[0] + << " [-d device] [fieldName] " << std::endl; return 1; } diff --git a/examples/contour_tree/CMakeLists.txt b/examples/contour_tree/CMakeLists.txt index fdb420e26..1970bce56 100644 --- a/examples/contour_tree/CMakeLists.txt +++ b/examples/contour_tree/CMakeLists.txt @@ -25,42 +25,12 @@ project(ContourTree CXX) #Find the VTK-m package find_package(VTKm REQUIRED QUIET) -add_executable(ContourTreeMesh2D_SERIAL ContourTreeMesh2D.cxx) -target_link_libraries(ContourTreeMesh2D_SERIAL vtkm_filter) +add_executable(ContourTreeMesh2D ContourTreeMesh2D.cxx) +target_link_libraries(ContourTreeMesh2D vtkm_filter) -add_executable(ContourTreeMesh3D_SERIAL ContourTreeMesh3D.cxx) -target_link_libraries(ContourTreeMesh3D_SERIAL vtkm_filter) - -target_compile_definitions(ContourTreeMesh2D_SERIAL PRIVATE - "VTKM_DEVICE_ADAPTER=VTKM_DEVICE_ADAPTER_SERIAL") -target_compile_definitions(ContourTreeMesh3D_SERIAL PRIVATE - "VTKM_DEVICE_ADAPTER=VTKM_DEVICE_ADAPTER_SERIAL") +add_executable(ContourTreeMesh3D ContourTreeMesh3D.cxx) +target_link_libraries(ContourTreeMesh3D vtkm_filter) if(TARGET vtkm::cuda) - vtkm_compile_as_cuda(cudaSource ContourTreeMesh2D.cxx) - add_executable(ContourTreeMesh2D_CUDA ${cudaSource}) - - vtkm_compile_as_cuda(cudaSource ContourTreeMesh3D.cxx) - add_executable(ContourTreeMesh3D_CUDA ${cudaSource}) - - target_link_libraries(ContourTreeMesh2D_CUDA vtkm_filter) - target_link_libraries(ContourTreeMesh3D_CUDA vtkm_filter) - - target_compile_definitions(ContourTreeMesh2D_CUDA PRIVATE - "VTKM_DEVICE_ADAPTER=VTKM_DEVICE_ADAPTER_CUDA") - target_compile_definitions(ContourTreeMesh3D_CUDA PRIVATE - "VTKM_DEVICE_ADAPTER=VTKM_DEVICE_ADAPTER_CUDA") -endif() - -if(TARGET vtkm::tbb) - add_executable(ContourTreeMesh2D_TBB ContourTreeMesh2D.cxx) - add_executable(ContourTreeMesh3D_TBB ContourTreeMesh3D.cxx) - - target_link_libraries(ContourTreeMesh2D_TBB vtkm_filter) - target_link_libraries(ContourTreeMesh3D_TBB vtkm_filter) - - target_compile_definitions(ContourTreeMesh2D_TBB PRIVATE - "VTKM_DEVICE_ADAPTER=VTKM_DEVICE_ADAPTER_TBB") - target_compile_definitions(ContourTreeMesh3D_TBB PRIVATE - "VTKM_DEVICE_ADAPTER=VTKM_DEVICE_ADAPTER_TBB") + set_source_files_properties(ContourTreeMesh2D.cxx ContourTreeMesh3D.cxx PROPERTIES LANGUAGE "CUDA") endif() diff --git a/examples/contour_tree/ContourTreeMesh2D.cxx b/examples/contour_tree/ContourTreeMesh2D.cxx index 366a55eac..dbe751d65 100644 --- a/examples/contour_tree/ContourTreeMesh2D.cxx +++ b/examples/contour_tree/ContourTreeMesh2D.cxx @@ -64,13 +64,11 @@ // Proceedings of the IEEE Symposium on Large Data Analysis and Visualization // (LDAV), October 2016, Baltimore, Maryland. -#ifndef VTKM_DEVICE_ADAPTER -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_SERIAL -#endif - #include #include #include +#include + #include #include @@ -81,9 +79,12 @@ int main(int argc, char* argv[]) { std::cout << "ContourTreeMesh2D Example" << std::endl; + auto opts = vtkm::cont::InitializeOptions::DefaultAnyDevice; + vtkm::cont::InitializeResult config = vtkm::cont::Initialize(argc, argv, opts); if (argc != 2) { - std::cout << "Parameter is fileName" << std::endl; + std::cout << "Usage: " + << "$ " << argv[0] << " [-d device] input_file" << std::endl; std::cout << "File is expected to be ASCII with xdim ydim integers " << std::endl; std::cout << "followed by vector data last dimension varying fastest" << std::endl; return 0; diff --git a/examples/contour_tree/ContourTreeMesh3D.cxx b/examples/contour_tree/ContourTreeMesh3D.cxx index 15eb36638..b339c4a7a 100644 --- a/examples/contour_tree/ContourTreeMesh3D.cxx +++ b/examples/contour_tree/ContourTreeMesh3D.cxx @@ -64,13 +64,11 @@ // Proceedings of the IEEE Symposium on Large Data Analysis and Visualization // (LDAV), October 2016, Baltimore, Maryland. -#ifndef VTKM_DEVICE_ADAPTER -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_SERIAL -#endif - #include #include #include +#include + #include #include @@ -80,10 +78,13 @@ int main(int argc, char* argv[]) { std::cout << "ContourTreeMesh3D Example" << std::endl; + auto opts = vtkm::cont::InitializeOptions::DefaultAnyDevice; + vtkm::cont::InitializeResult config = vtkm::cont::Initialize(argc, argv, opts); if (argc != 2) { - std::cout << "Parameter is fileName" << std::endl; + std::cout << "Usage: " + << "$ " << argv[0] << " [-d device] input_file" << std::endl; std::cout << "File is expected to be ASCII with xdim ydim zdim integers " << std::endl; std::cout << "followed by vector data last dimension varying fastest" << std::endl; return 0; diff --git a/examples/contour_tree_augmented/CMakeLists.txt b/examples/contour_tree_augmented/CMakeLists.txt index 4bac4bb76..ba2a536a6 100644 --- a/examples/contour_tree_augmented/CMakeLists.txt +++ b/examples/contour_tree_augmented/CMakeLists.txt @@ -66,60 +66,20 @@ #Find the VTK-m package find_package(VTKm REQUIRED QUIET) -# MAKE DEBUG BUILD -# set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g3 -g -fsanitize=address") - -# MAKE OPTIMIZED BUILD -# set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O3") - -#################################### -# Serial builds -#################################### -# Serial 2D / 3D / MC -add_executable(ContourTree_PPP2_SERIAL ContourTreeApp.cxx) -target_link_libraries(ContourTree_PPP2_SERIAL vtkm_filter) -target_compile_definitions(ContourTree_PPP2_SERIAL PRIVATE - "VTKM_DEVICE_ADAPTER=VTKM_DEVICE_ADAPTER_SERIAL") +add_executable(ContourTree ContourTreeApp.cxx) +target_link_libraries(ContourTree vtkm_filter) #################################### -# Serial debug builds +# Debug algorithm build #################################### - -# Debug Serial 2D / 3D / MC -add_executable(ContourTree_PPP2_SERIAL_DEBUG ContourTreeApp.cxx) -target_link_libraries(ContourTree_PPP2_SERIAL_DEBUG vtkm_filter) -target_compile_definitions(ContourTree_PPP2_SERIAL_DEBUG PRIVATE - "VTKM_DEVICE_ADAPTER=VTKM_DEVICE_ADAPTER_SERIAL" "DEBUG_PRINT") - +# target_compile_definitions(ContourTree PRIVATE DEBUG_PRINT) if(TARGET vtkm::tbb) # TBB 2D/3D/MC - add_executable(ContourTree_PPP2_TBB ContourTreeApp.cxx) - target_link_libraries(ContourTree_PPP2_TBB vtkm_filter) - target_compile_definitions(ContourTree_PPP2_TBB PRIVATE - "VTKM_DEVICE_ADAPTER=VTKM_DEVICE_ADAPTER_TBB" "ENABLE_SET_NUM_THREADS") - - # TBB 2D/3D/MC DEBUG - add_executable(ContourTree_PPP2_TBB_DEBUG ContourTreeApp.cxx) - target_link_libraries(ContourTree_PPP2_TBB_DEBUG vtkm_filter) - target_compile_definitions(ContourTree_PPP2_TBB_DEBUG PRIVATE - "VTKM_DEVICE_ADAPTER=VTKM_DEVICE_ADAPTER_TBB" "ENABLE_SET_NUM_THREADS" "DEBUG_PRINT") - + target_compile_definitions(ContourTree PRIVATE ENABLE_SET_NUM_THREADS) endif() if(TARGET vtkm::cuda) - # CUDA 2D/3D/MC - vtkm_compile_as_cuda(cudaSource ContourTreeApp.cxx) - add_executable(ContourTree_PPP2_CUDA ${cudaSource}) - target_link_libraries(ContourTree_PPP2_CUDA vtkm_filter) - target_compile_definitions(ContourTree_PPP2_CUDA PRIVATE - "VTKM_DEVICE_ADAPTER=VTKM_DEVICE_ADAPTER_CUDA") - - # CUDA 2D/3D/MC - # vtkm_compile_as_cuda(cudaSource ContourTreeApp.cxx) - add_executable(ContourTree_PPP2_CUDA_DEBUG ${cudaSource}) - target_link_libraries(ContourTree_PPP2_CUDA_DEBUG vtkm_filter) - target_compile_definitions(ContourTree_PPP2_CUDA_DEBUG PRIVATE - "VTKM_DEVICE_ADAPTER=VTKM_DEVICE_ADAPTER_CUDA" "DEBUG_PRINT") + set_source_files_properties(ContourTreeApp.cxx PROPERTIES LANGUAGE "CUDA") endif() diff --git a/examples/contour_tree_augmented/ContourTreeApp.cxx b/examples/contour_tree_augmented/ContourTreeApp.cxx index 872762bdc..d3f4bc1df 100644 --- a/examples/contour_tree_augmented/ContourTreeApp.cxx +++ b/examples/contour_tree_augmented/ContourTreeApp.cxx @@ -71,7 +71,9 @@ #include #include #include +#include #include + #include #include #include @@ -145,11 +147,13 @@ private: // Compute and render an isosurface for a uniform grid example int main(int argc, char* argv[]) { + auto opts = vtkm::cont::InitializeOptions::DefaultAnyDevice; + vtkm::cont::InitializeResult config = vtkm::cont::Initialize(argc, argv, opts); + vtkm::cont::Timer totalTime; totalTime.Start(); vtkm::Float64 prevTime = 0; vtkm::Float64 currTime = 0; - std::cout << "ContourTreePPP2Mesh " << std::endl; //////////////////////////////////////////// // Parse the command line options @@ -200,9 +204,11 @@ int main(int argc, char* argv[]) std::cout << "--numThreads Specify the number of threads to use. Available only with TBB." << std::endl; #endif + std::cout << config.Usage << std::endl; return 0; } + std::cout << "ContourTree " << std::endl; std::cout << "Settings:" << std::endl; std::cout << " filename=" << filename << std::endl; std::cout << " mc=" << useMarchingCubes << std::endl; @@ -211,6 +217,7 @@ int main(int argc, char* argv[]) #ifdef ENABLE_SET_NUM_THREADS std::cout << " numThreads=" << numThreads << std::endl; #endif + std::cout << config.Usage << std::endl; std::cout << std::endl; diff --git a/examples/cosmotools/CMakeLists.txt b/examples/cosmotools/CMakeLists.txt index e64156898..d738e5a2d 100644 --- a/examples/cosmotools/CMakeLists.txt +++ b/examples/cosmotools/CMakeLists.txt @@ -25,16 +25,11 @@ project(CosmoTools CXX) #Find the VTK-m package find_package(VTKm REQUIRED QUIET) -if(TARGET vtkm::cuda) - vtkm_compile_as_cuda(cu_srcs CosmoCenterFinder.cxx) - add_executable(CosmoCenterFinder ${cu_srcs}) - - vtkm_compile_as_cuda(cu_srcs CosmoHaloFinder.cxx) - add_executable(CosmoHaloFinder ${cu_srcs}) -else() - add_executable(CosmoCenterFinder CosmoCenterFinder.cxx) - add_executable(CosmoHaloFinder CosmoHaloFinder.cxx) -endif() - +add_executable(CosmoCenterFinder CosmoCenterFinder.cxx) +add_executable(CosmoHaloFinder CosmoHaloFinder.cxx) target_link_libraries(CosmoCenterFinder PRIVATE vtkm_filter) target_link_libraries(CosmoHaloFinder PRIVATE vtkm_filter) + +if(TARGET vtkm::cuda) + set_source_files_properties(CosmoCenterFinder.cxx CosmoCenterFinder.cxx PROPERTIES LANGUAGE "CUDA") +endif() diff --git a/examples/cosmotools/CosmoCenterFinder.cxx b/examples/cosmotools/CosmoCenterFinder.cxx index 6a92a2b55..724399706 100644 --- a/examples/cosmotools/CosmoCenterFinder.cxx +++ b/examples/cosmotools/CosmoCenterFinder.cxx @@ -123,11 +123,14 @@ int main(int argc, char* argv[]) { vtkm::cont::SetLogLevelName(CosmoLogLevel, "Cosmo"); vtkm::cont::SetStderrLogLevel(CosmoLogLevel); - vtkm::cont::Initialize(argc, argv); + + auto opts = vtkm::cont::InitializeOptions::DefaultAnyDevice; + vtkm::cont::InitializeResult config = vtkm::cont::Initialize(argc, argv, opts); if (argc < 2) { std::cout << "Usage: " << std::endl << "$ " << argv[0] << " " << std::endl; + std::cout << config.Usage << std::endl; return 1; } diff --git a/examples/cosmotools/CosmoHaloFinder.cxx b/examples/cosmotools/CosmoHaloFinder.cxx index 6322c9748..658690673 100644 --- a/examples/cosmotools/CosmoHaloFinder.cxx +++ b/examples/cosmotools/CosmoHaloFinder.cxx @@ -117,11 +117,14 @@ int main(int argc, char* argv[]) { vtkm::cont::SetLogLevelName(CosmoLogLevel, "Cosmo"); vtkm::cont::SetStderrLogLevel(CosmoLogLevel); - vtkm::cont::Initialize(argc, argv); + + auto opts = vtkm::cont::InitializeOptions::DefaultAnyDevice; + vtkm::cont::InitializeResult config = vtkm::cont::Initialize(argc, argv, opts); if (argc < 2) { std::cout << "Usage: " << std::endl << "$ " << argv[0] << " " << std::endl; + std::cout << config.Usage << std::endl; return 1; } diff --git a/examples/demo/Demo.cxx b/examples/demo/Demo.cxx index 1a1139828..6816346a6 100644 --- a/examples/demo/Demo.cxx +++ b/examples/demo/Demo.cxx @@ -19,8 +19,10 @@ //============================================================================ #include +#include #include #include + #include #include #include @@ -54,6 +56,9 @@ void makeScene(const vtkm::cont::DataSet& inputData, int main(int argc, char* argv[]) { + auto opts = vtkm::cont::InitializeOptions::DefaultAnyDevice; + vtkm::cont::InitializeResult config = vtkm::cont::Initialize(argc, argv, opts); + // Input variable declarations vtkm::cont::DataSet inputData; vtkm::Float32 isovalue; @@ -73,7 +78,7 @@ int main(int argc, char* argv[]) vtkm::io::reader::VTKDataSetReader reader(argv[1]); inputData = reader.ReadDataSet(); isovalue = static_cast(atof(argv[2])); - fieldName = "SCALARS:pointvar"; + fieldName = "pointvar"; } using Mapper = vtkm::rendering::MapperRayTracer; diff --git a/examples/game_of_life/CMakeLists.txt b/examples/game_of_life/CMakeLists.txt index d78380da3..e210a8482 100644 --- a/examples/game_of_life/CMakeLists.txt +++ b/examples/game_of_life/CMakeLists.txt @@ -29,11 +29,10 @@ vtkm_find_gl(OPTIONAL GL GLUT GLEW) if(TARGET OpenGL::GL AND TARGET GLUT::GLUT AND TARGET GLEW::GLEW) - if(TARGET vtkm::cuda) - add_executable(GameOfLife GameOfLife.cu LoadShaders.h) - else() - add_executable(GameOfLife GameOfLife.cxx LoadShaders.h) - endif() + add_executable(GameOfLife GameOfLife.cxx LoadShaders.h) + if(TARGET vtkm::cuda) + set_source_files_properties(GameOfLife.cxx PROPERTIES LANGUAGE "CUDA") + endif() target_link_libraries(GameOfLife PRIVATE vtkm_filter OpenGL::GL GLEW::GLEW GLUT::GLUT) endif() diff --git a/examples/game_of_life/GameOfLife.cu b/examples/game_of_life/GameOfLife.cu deleted file mode 100644 index 7419d2663..000000000 --- a/examples/game_of_life/GameOfLife.cu +++ /dev/null @@ -1,20 +0,0 @@ -//============================================================================ -// Copyright (c) Kitware, Inc. -// All rights reserved. -// See LICENSE.txt for details. -// This software is distributed WITHOUT ANY WARRANTY; without even -// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -// PURPOSE. See the above copyright notice for more information. -// -// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS). -// Copyright 2014 UT-Battelle, LLC. -// Copyright 2014 Los Alamos National Security. -// -// Under the terms of Contract DE-NA0003525 with NTESS, -// the U.S. Government retains certain rights in this software. -// -// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National -// Laboratory (LANL), the U.S. Government retains certain rights in -// this software. -//============================================================================ -#include "GameOfLife.cxx" diff --git a/examples/game_of_life/GameOfLife.cxx b/examples/game_of_life/GameOfLife.cxx index 964092b71..971d0a231 100644 --- a/examples/game_of_life/GameOfLife.cxx +++ b/examples/game_of_life/GameOfLife.cxx @@ -315,7 +315,9 @@ void populate(std::vector& input_state, int main(int argc, char** argv) { - vtkm::cont::Initialize(argc, argv); + auto opts = + vtkm::cont::InitializeOptions::DefaultAnyDevice | vtkm::cont::InitializeOptions::Strict; + vtkm::cont::Initialize(argc, argv, opts); glewExperimental = GL_TRUE; glutInit(&argc, argv); diff --git a/examples/hello_world/CMakeLists.txt b/examples/hello_world/CMakeLists.txt index c4308bb2e..8ea0888a8 100755 --- a/examples/hello_world/CMakeLists.txt +++ b/examples/hello_world/CMakeLists.txt @@ -32,10 +32,9 @@ if(TARGET OpenGL::GL AND set(gl_libs OpenGL::GL GLEW::GLEW GLUT::GLUT) + add_executable(HelloWorld HelloWorld.cxx LoadShaders.h) if(TARGET vtkm::cuda) - add_executable(HelloWorld HelloWorld.cu LoadShaders.h) - else() - add_executable(HelloWorld HelloWorld.cxx LoadShaders.h) + set_source_files_properties(HelloWorld.cxx PROPERTIES LANGUAGE "CUDA") endif() target_link_libraries(HelloWorld PRIVATE vtkm_filter ${gl_libs}) diff --git a/examples/hello_world/HelloWorld.cu b/examples/hello_world/HelloWorld.cu deleted file mode 100644 index a8897c0d8..000000000 --- a/examples/hello_world/HelloWorld.cu +++ /dev/null @@ -1,23 +0,0 @@ -//============================================================================ -// Copyright (c) Kitware, Inc. -// All rights reserved. -// See LICENSE.txt for details. -// This software is distributed WITHOUT ANY WARRANTY; without even -// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -// PURPOSE. See the above copyright notice for more information. -// -// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS). -// Copyright 2014 UT-Battelle, LLC. -// Copyright 2014 Los Alamos National Security. -// -// Under the terms of Contract DE-NA0003525 with NTESS, -// the U.S. Government retains certain rights in this software. -// -// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National -// Laboratory (LANL), the U.S. Government retains certain rights in -// this software. -//============================================================================ - -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_CUDA - -#include "HelloWorld.cxx" diff --git a/examples/hello_world/HelloWorld.cxx b/examples/hello_world/HelloWorld.cxx index 7705326c1..c6cb8f83f 100644 --- a/examples/hello_world/HelloWorld.cxx +++ b/examples/hello_world/HelloWorld.cxx @@ -196,7 +196,9 @@ void idle() int main(int argc, char** argv) { - vtkm::cont::Initialize(argc, argv); + auto opts = + vtkm::cont::InitializeOptions::DefaultAnyDevice | vtkm::cont::InitializeOptions::Strict; + vtkm::cont::Initialize(argc, argv, opts); std::cout << "Running Hello World example: " << std::endl; glewExperimental = GL_TRUE; diff --git a/examples/histogram/CMakeLists.txt b/examples/histogram/CMakeLists.txt index 2500af13c..d8eaae7be 100644 --- a/examples/histogram/CMakeLists.txt +++ b/examples/histogram/CMakeLists.txt @@ -25,24 +25,10 @@ project(Histogram CXX) #Find the VTK-m package find_package(VTKm REQUIRED QUIET) if (VTKm_ENABLE_MPI) - add_executable(Histogram_SERIAL Histogram.cxx HistogramMPI.h HistogramMPI.hxx) - target_compile_definitions(Histogram_SERIAL PRIVATE - "VTKM_DEVICE_ADAPTER=VTKM_DEVICE_ADAPTER_SERIAL") - target_link_libraries(Histogram_SERIAL PRIVATE vtkm_filter) - - if(TARGET vtkm::tbb) - add_executable(Histogram_TBB Histogram.cxx HistogramMPI.h HistogramMPI.hxx) - target_compile_definitions(Histogram_TBB PRIVATE - "VTKM_DEVICE_ADAPTER=VTKM_DEVICE_ADAPTER_TBB") - target_link_libraries(Histogram_TBB PRIVATE vtkm_filter) - endif() + add_executable(Histogram Histogram.cxx HistogramMPI.h HistogramMPI.hxx) + target_link_libraries(Histogram PRIVATE vtkm_filter) if(TARGET vtkm::cuda) - vtkm_compile_as_cuda(cudaSource Histogram.cxx) - add_executable(Histogram_CUDA ${cudaSource} HistogramMPI.h HistogramMPI.hxx) - - target_compile_definitions(Histogram_CUDA PRIVATE - "VTKM_DEVICE_ADAPTER=VTKM_DEVICE_ADAPTER_CUDA") - target_link_libraries(Histogram_CUDA PRIVATE vtkm_filter) + set_source_files_properties(Histogram.cxx PROPERTIES LANGUAGE "CUDA") endif() endif() diff --git a/examples/histogram/Histogram.cxx b/examples/histogram/Histogram.cxx index ed525f426..daa60a46a 100644 --- a/examples/histogram/Histogram.cxx +++ b/examples/histogram/Histogram.cxx @@ -30,6 +30,7 @@ #include #include #include +#include #include @@ -61,6 +62,11 @@ VTKM_CONT vtkm::cont::ArrayHandle CreateArray(T min, T max, vtkm::Id numVals) int main(int argc, char* argv[]) { + //parse out all vtk-m related command line options + auto opts = + vtkm::cont::InitializeOptions::DefaultAnyDevice | vtkm::cont::InitializeOptions::Strict; + vtkm::cont::Initialize(argc, argv, opts); + // setup MPI environment. MPI_Init(&argc, &argv); diff --git a/examples/isosurface/CMakeLists.txt b/examples/isosurface/CMakeLists.txt index b62f693f6..461306d3e 100644 --- a/examples/isosurface/CMakeLists.txt +++ b/examples/isosurface/CMakeLists.txt @@ -30,20 +30,12 @@ if(TARGET OpenGL::GL AND TARGET GLUT::GLUT AND TARGET GLEW::GLEW) - set_source_files_properties(quaternion.h PROPERTIES HEADER_FILE_ONLY TRUE) - set(gl_libs OpenGL::GL OpenGL::GLU GLEW::GLEW GLUT::GLUT) - add_executable(IsosurfaceUniformGrid_SERIAL IsosurfaceUniformGrid.cxx quaternion.h) - target_link_libraries(IsosurfaceUniformGrid_SERIAL PRIVATE vtkm_filter ${gl_libs}) + add_executable(IsosurfaceUniformGrid IsosurfaceUniformGrid.cxx quaternion.h) + target_link_libraries(IsosurfaceUniformGrid PRIVATE vtkm_filter ${gl_libs}) if(TARGET vtkm::cuda) - add_executable(IsosurfaceUniformGrid_CUDA IsosurfaceUniformGrid.cu quaternion.h) - target_link_libraries(IsosurfaceUniformGrid_CUDA PRIVATE vtkm_filter ${gl_libs}) - endif() - - if(TARGET vtkm::tbb) - add_executable(IsosurfaceUniformGrid_TBB IsosurfaceUniformGridTBB.cxx quaternion.h) - target_link_libraries(IsosurfaceUniformGrid_TBB PRIVATE vtkm_filter ${gl_libs}) + set_source_files_properties(IsosurfaceUniformGrid.cxx PROPERTIES LANGUAGE "CUDA") endif() endif() diff --git a/examples/isosurface/IsosurfaceUniformGrid.cu b/examples/isosurface/IsosurfaceUniformGrid.cu deleted file mode 100644 index 669ef17df..000000000 --- a/examples/isosurface/IsosurfaceUniformGrid.cu +++ /dev/null @@ -1,23 +0,0 @@ -//============================================================================ -// Copyright (c) Kitware, Inc. -// All rights reserved. -// See LICENSE.txt for details. -// This software is distributed WITHOUT ANY WARRANTY; without even -// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -// PURPOSE. See the above copyright notice for more information. -// -// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS). -// Copyright 2014 UT-Battelle, LLC. -// Copyright 2014 Los Alamos National Security. -// -// Under the terms of Contract DE-NA0003525 with NTESS, -// the U.S. Government retains certain rights in this software. -// -// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National -// Laboratory (LANL), the U.S. Government retains certain rights in -// this software. -//============================================================================ - -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_CUDA - -#include "IsosurfaceUniformGrid.cxx" diff --git a/examples/isosurface/IsosurfaceUniformGrid.cxx b/examples/isosurface/IsosurfaceUniformGrid.cxx index 8f44680b8..98c1f11f7 100644 --- a/examples/isosurface/IsosurfaceUniformGrid.cxx +++ b/examples/isosurface/IsosurfaceUniformGrid.cxx @@ -18,12 +18,6 @@ // this software. //============================================================================ -//We first check if VTKM_DEVICE_ADAPTER is defined, so that when TBB and CUDA -//includes this file we use the device adapter that they have set. -#ifndef VTKM_DEVICE_ADAPTER -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_SERIAL -#endif - #include #include @@ -31,6 +25,7 @@ #include #include #include +#include //Suppress warnings about glut being deprecated on OSX #if (defined(VTKM_GCC) || defined(VTKM_CLANG)) @@ -240,6 +235,11 @@ void mouseCall(int button, int state, int x, int y) // Compute and render an isosurface for a uniform grid example int main(int argc, char* argv[]) { + //parse out all vtk-m related command line options + auto opts = + vtkm::cont::InitializeOptions::DefaultAnyDevice | vtkm::cont::InitializeOptions::Strict; + vtkm::cont::Initialize(argc, argv, opts); + vtkm::cont::DataSet dataSet = MakeIsosurfaceTestDataSet(dims); vtkm::filter::MarchingCubes filter; diff --git a/examples/isosurface/IsosurfaceUniformGridTBB.cxx b/examples/isosurface/IsosurfaceUniformGridTBB.cxx deleted file mode 100644 index 6dd783dce..000000000 --- a/examples/isosurface/IsosurfaceUniformGridTBB.cxx +++ /dev/null @@ -1,23 +0,0 @@ -//============================================================================ -// Copyright (c) Kitware, Inc. -// All rights reserved. -// See LICENSE.txt for details. -// This software is distributed WITHOUT ANY WARRANTY; without even -// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -// PURPOSE. See the above copyright notice for more information. -// -// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS). -// Copyright 2014 UT-Battelle, LLC. -// Copyright 2014 Los Alamos National Security. -// -// Under the terms of Contract DE-NA0003525 with NTESS, -// the U.S. Government retains certain rights in this software. -// -// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National -// Laboratory (LANL), the U.S. Government retains certain rights in -// this software. -//============================================================================ - -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_TBB - -#include "IsosurfaceUniformGrid.cxx" diff --git a/examples/lagrangian/CMakeLists.txt b/examples/lagrangian/CMakeLists.txt index 08bb2ff7c..d49224c39 100644 --- a/examples/lagrangian/CMakeLists.txt +++ b/examples/lagrangian/CMakeLists.txt @@ -19,11 +19,14 @@ ## this software. ## ##============================================================================= +cmake_minimum_required(VERSION 3.8...3.14 FATAL_ERROR) #Find the VTK-m package find_package(VTKm REQUIRED QUIET) -add_executable(Lagrangian_SERIAL lagrangian.cxx ABCfield.h) -target_compile_definitions(Lagrangian_SERIAL PRIVATE "VTKM_DEVICE_ADAPTER=VTKM_DEVICE_ADAPTER_SERIAL") -target_link_libraries(Lagrangian_SERIAL PRIVATE vtkm_filter) -target_link_libraries(Lagrangian_SERIAL ${VTKm_LIBRARIES}) +if(TARGET vtkm::cuda) + set_source_files_properties(lagrangian.cxx PROPERTIES LANGUAGE "CUDA") +endif() + +add_executable(Lagrangian lagrangian.cxx ABCfield.h) +target_link_libraries(Lagrangian PRIVATE vtkm_filter) diff --git a/examples/lagrangian/lagrangian.cxx b/examples/lagrangian/lagrangian.cxx index 6a27db6ed..adfe4cdf4 100644 --- a/examples/lagrangian/lagrangian.cxx +++ b/examples/lagrangian/lagrangian.cxx @@ -27,12 +27,10 @@ #include #include #include +#include #include using namespace std; -#ifndef VTKM_DEVICE_ADAPTER -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_SERIAL -#endif vtkm::cont::DataSet make3DRectilinearDataSet(double time) { @@ -88,8 +86,12 @@ vtkm::cont::DataSet make3DRectilinearDataSet(double time) } -int main() +int main(int argc, char** argv) { + auto opts = + vtkm::cont::InitializeOptions::DefaultAnyDevice | vtkm::cont::InitializeOptions::Strict; + vtkm::cont::Initialize(argc, argv, opts); + vtkm::filter::Lagrangian lagrangianFilter; lagrangianFilter.SetResetParticles(true); vtkm::Float32 stepSize = 0.01f; diff --git a/examples/multi_backend/CMakeLists.txt b/examples/multi_backend/CMakeLists.txt index dfc122ad4..07c27d8c3 100644 --- a/examples/multi_backend/CMakeLists.txt +++ b/examples/multi_backend/CMakeLists.txt @@ -42,8 +42,7 @@ set(srcs ) if(TARGET vtkm::cuda) - vtkm_compile_as_cuda(cuda_srcs ${device_srcs}) - set(device_srcs ${cuda_srcs}) + set_source_files_properties(${device_srcs} PROPERTIES LANGUAGE "CUDA") endif() add_executable(MultiBackend ${device_srcs} ${srcs} ${headers}) diff --git a/examples/multi_backend/MultiBackend.cxx b/examples/multi_backend/MultiBackend.cxx index 2778aa14a..67a2e733d 100644 --- a/examples/multi_backend/MultiBackend.cxx +++ b/examples/multi_backend/MultiBackend.cxx @@ -21,6 +21,7 @@ #include #include +#include #include #include "IOGenerator.h" @@ -48,8 +49,12 @@ //threads, and 5 threads for heavy 'task' work. void multiblock_processing(TaskQueue& queue); -int main(int, char**) +int main(int argc, char** argv) { + auto opts = + vtkm::cont::InitializeOptions::DefaultAnyDevice | vtkm::cont::InitializeOptions::Strict; + vtkm::cont::Initialize(argc, argv, opts); + //Step 1. Construct the two primary 'main loops'. The threads //share a queue object so we need to explicitly pass it //by reference (the std::ref call) diff --git a/examples/multi_backend/MultiDeviceGradient.hxx b/examples/multi_backend/MultiDeviceGradient.hxx index eeb7abc9b..49afc76e5 100644 --- a/examples/multi_backend/MultiDeviceGradient.hxx +++ b/examples/multi_backend/MultiDeviceGradient.hxx @@ -20,6 +20,7 @@ #include #include +#include #include #include @@ -69,6 +70,34 @@ void process_block_tbb(RuntimeTaskQueue& queue) } } +void process_block_openMP(RuntimeTaskQueue& queue) +{ + //Step 1. Set the device adapter to this thread to TBB. + //This makes sure that any vtkm::filters used by our + //task operate only on TBB. The "global" thread tracker + //is actually thread-local, so we can use that. + // + vtkm::cont::GetRuntimeDeviceTracker().ForceDevice(vtkm::cont::DeviceAdapterTagOpenMP{}); + + while (queue.hasTasks()) + { + //Step 2. Get the task to run on TBB + auto task = queue.pop(); + + //Step 3. Run the task on TBB. We check the validity + //of the task since we could be given an empty task + //when the queue is empty and we are shutting down + if (task != nullptr) + { + task(); + } + + //Step 4. Notify the queue that we finished processing this task + queue.completedTask(); + std::cout << "finished a block on tbb (" << std::this_thread::get_id() << ")" << std::endl; + } +} + void process_block_cuda(RuntimeTaskQueue& queue, int gpuId) { //Step 1. Set the device adapter to this thread to cuda. @@ -108,8 +137,9 @@ VTKM_CONT MultiDeviceGradient::MultiDeviceGradient() { //Step 1. Determine the number of workers we want auto tracker = vtkm::cont::GetRuntimeDeviceTracker(); - const bool runOnTbb = tracker.CanRunOn(vtkm::cont::DeviceAdapterTagTBB{}); const bool runOnCuda = tracker.CanRunOn(vtkm::cont::DeviceAdapterTagCuda{}); + const bool runOnOpenMP = tracker.CanRunOn(vtkm::cont::DeviceAdapterTagOpenMP{}); + const bool runOnTbb = tracker.CanRunOn(vtkm::cont::DeviceAdapterTagTBB{}); //Note currently the virtual implementation has some issues //In a multi-threaded environment only cuda can be used or @@ -135,7 +165,15 @@ VTKM_CONT MultiDeviceGradient::MultiDeviceGradient() this->Workers.emplace_back(std::bind(process_block_cuda, std::ref(this->Queue), i)); } } - //Step 3. Launch a worker that will use tbb (if enabled). + //Step 3. Launch a worker that will use openMP (if enabled). + //The threads share a queue object so we need to explicitly pass it + //by reference (the std::ref call) + else if (runOnOpenMP) + { + std::cout << "adding a openMP worker" << std::endl; + this->Workers.emplace_back(std::bind(process_block_openMP, std::ref(this->Queue))); + } + //Step 4. Launch a worker that will use tbb (if enabled). //The threads share a queue object so we need to explicitly pass it //by reference (the std::ref call) else if (runOnTbb) diff --git a/examples/oscillator/CMakeLists.txt b/examples/oscillator/CMakeLists.txt index f48f67f47..02a252452 100644 --- a/examples/oscillator/CMakeLists.txt +++ b/examples/oscillator/CMakeLists.txt @@ -25,22 +25,9 @@ project(Oscillator CXX) #Find the VTK-m package find_package(VTKm REQUIRED QUIET) -add_executable(Oscillator_SERIAL Oscillator.cxx) -target_compile_definitions(Oscillator_SERIAL PRIVATE - "VTKM_DEVICE_ADAPTER=VTKM_DEVICE_ADAPTER_SERIAL") -target_link_libraries(Oscillator_SERIAL PRIVATE vtkm_filter) - -if (TARGET vtkm::tbb) - add_executable(Oscillator_TBB Oscillator.cxx) - target_compile_definitions(Oscillator_TBB PRIVATE - "VTKM_DEVICE_ADAPTER=VTKM_DEVICE_ADAPTER_TBB") - target_link_libraries(Oscillator_TBB PRIVATE vtkm_filter) -endif() - if (TARGET vtkm::cuda) - vtkm_compile_as_cuda(oscillatorCudaSrc Oscillator.cxx) - add_executable(Oscillator_CUDA ${oscillatorCudaSrc}) - target_compile_definitions(Oscillator_CUDA PRIVATE - "VTKM_DEVICE_ADAPTER=VTKM_DEVICE_ADAPTER_CUDA") - target_link_libraries(Oscillator_CUDA PRIVATE vtkm_filter) + set_source_files_properties(Oscillator.cxx PROPERTIES LANGUAGE "CUDA") endif() + +add_executable(Oscillator Oscillator.cxx) +target_link_libraries(Oscillator PRIVATE vtkm_filter) diff --git a/examples/oscillator/Oscillator.cxx b/examples/oscillator/Oscillator.cxx index 29d13eefd..d1098eaf5 100644 --- a/examples/oscillator/Oscillator.cxx +++ b/examples/oscillator/Oscillator.cxx @@ -23,18 +23,16 @@ #include #include -#include "vtkm/Math.h" -#include "vtkm/cont/ArrayHandle.h" -#include "vtkm/cont/DataSetBuilderUniform.h" +#include +#include +#include +#include -#include "vtkm/filter/FilterDataSet.h" +#include -#include "vtkm/cont/TryExecute.h" -#include "vtkm/cont/cuda/DeviceAdapterCuda.h" -#include "vtkm/cont/serial/DeviceAdapterSerial.h" -#include "vtkm/cont/tbb/DeviceAdapterTBB.h" +#include -#include "vtkm/filter/OscillatorSource.h" +#include #if !defined(_WIN32) || defined(__CYGWIN__) #include /* unlink */ @@ -48,20 +46,6 @@ #pragma GCC diagnostic ignored "-Wdeprecated-declarations" #endif -//This is the list of devices to compile in support for. The order of the -//devices determines the runtime preference. -struct DevicesToTry : vtkm::ListTagBase -{ -}; - -// ---------------------------------------------------------------------------- - -struct OscillatorPolicy : public vtkm::filter::PolicyBase -{ - using DeviceAdapterList = DevicesToTry; -}; // trim() from http://stackoverflow.com/a/217605/44738 static inline std::string& ltrim(std::string& s) @@ -235,18 +219,17 @@ void writeData(std::string& basePath, int timestep, int iSize, int jSize, int kS // ---------------------------------------------------------------------------- -void printUsage() +void printUsage(const std::string& vtkm_options) { - std::cout << "Usage: Oscillator [options]\n" - << std::endl - << "Options:\n" - << std::endl - << " -s, --shape POINT domain shape [default: 64x64x64]" << std::endl - << " -t, --dt FLOAT time step [default: 0.01]" << std::endl - << " -f, --config STRING oscillator file (required)" << std::endl - << " --t-end FLOAT end time [default: 10]" << std::endl + std::cout << "Usage: Oscillator [options]\n\n" + << "Options:\n\n" + << " -s, --shape POINT domain shape [default: 64x64x64]\n" + << " -t, --dt FLOAT time step [default: 0.01]\n" + << " -f, --config STRING oscillator file (required)\n" + << " --t-end FLOAT end time [default: 10]\n" << " -o, --output STRING directory to output data\n" - << std::endl; + << "General VTK-m Options:\n\n" + << vtkm_options << std::endl; } // ---------------------------------------------------------------------------- @@ -264,6 +247,9 @@ int main(int argc, char** argv) float currentTime = startTime; bool generateOutput = false; + // Process vtk-m general args + auto opts = vtkm::cont::InitializeOptions::DefaultAnyDevice; + auto initializeResults = vtkm::cont::Initialize(argc, argv, opts); // Process args int nbOptions = argc - 1; for (int i = 1; i < nbOptions; i += 2) @@ -315,7 +301,7 @@ int main(int argc, char** argv) if (oscillatorConfigFile.size() < 2) { - printUsage(); + printUsage(initializeResults.Usage); return 0; } @@ -338,7 +324,7 @@ int main(int argc, char** argv) while (currentTime < endTime) { filter.SetTime(currentTime); - vtkm::cont::DataSet rdata = filter.Execute(dataset, OscillatorPolicy()); + vtkm::cont::DataSet rdata = filter.Execute(dataset); if (generateOutput) { vtkm::cont::ArrayHandle tmp; diff --git a/examples/particle_advection/CMakeLists.txt b/examples/particle_advection/CMakeLists.txt index bc2eaf366..9e04899c7 100644 --- a/examples/particle_advection/CMakeLists.txt +++ b/examples/particle_advection/CMakeLists.txt @@ -25,15 +25,13 @@ project(ParticleAdvection CXX) #Find the VTK-m package find_package(VTKm REQUIRED QUIET) -add_executable(Particle_Advection_SERIAL ParticleAdvection.cxx) -target_link_libraries(Particle_Advection_SERIAL PRIVATE vtkm_filter) +add_executable(Particle_Advection ParticleAdvection.cxx) +target_link_libraries(Particle_Advection PRIVATE vtkm_filter) if(TARGET vtkm::tbb) - add_executable(Particle_Advection_TBB ParticleAdvectionTBB.cxx) - target_link_libraries(Particle_Advection_TBB PRIVATE vtkm_filter) + target_compile_definitions(Particle_Advection PRIVATE BUILDING_TBB_VERSION) endif() if(TARGET vtkm::cuda) - add_executable(Particle_Advection_CUDA ParticleAdvection.cu) - target_link_libraries(Particle_Advection_CUDA PRIVATE vtkm_filter) + set_source_files_properties(ParticleAdvection.cxx PROPERTIES LANGUAGE "CUDA") endif() diff --git a/examples/particle_advection/ParticleAdvection.cu b/examples/particle_advection/ParticleAdvection.cu deleted file mode 100644 index b6b166efa..000000000 --- a/examples/particle_advection/ParticleAdvection.cu +++ /dev/null @@ -1,23 +0,0 @@ -//============================================================================ -// Copyright (c) Kitware, Inc. -// All rights reserved. -// See LICENSE.txt for details. -// This software is distributed WITHOUT ANY WARRANTY; without even -// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -// PURPOSE. See the above copyright notice for more information. -// -// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS). -// Copyright 2014 UT-Battelle, LLC. -// Copyright 2014 Los Alamos National Security. -// -// Under the terms of Contract DE-NA0003525 with NTESS, -// the U.S. Government retains certain rights in this software. -// -// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National -// Laboratory (LANL), the U.S. Government retains certain rights in -// this software. -//============================================================================ - -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_CUDA - -#include "ParticleAdvection.cxx" diff --git a/examples/particle_advection/ParticleAdvection.cxx b/examples/particle_advection/ParticleAdvection.cxx index 6e706c228..e57452d56 100644 --- a/examples/particle_advection/ParticleAdvection.cxx +++ b/examples/particle_advection/ParticleAdvection.cxx @@ -19,19 +19,21 @@ //============================================================================ #include +#include +#include + #include #include #include #include #include -#include #include #include #include -#ifdef __BUILDING_TBB_VERSION__ +#ifdef BUILDING_TBB_VERSION #include #endif @@ -138,7 +140,7 @@ void RunTest(const std::string& fname, seeds.push_back(p); } -#ifdef __BUILDING_TBB_VERSION__ +#ifdef BUILDING_TBB_VERSION int nT = tbb::task_scheduler_init::default_num_threads(); if (numThreads != -1) nT = (int)numThreads; @@ -172,6 +174,7 @@ void RunTest(const std::string& fname, bool ParseArgs(int argc, char** argv, + const vtkm::cont::InitializeResult& config, vtkm::Id& numSeeds, vtkm::Id& numSteps, vtkm::Float32& stepSize, @@ -192,7 +195,7 @@ bool ParseArgs(int argc, particlesPerRound = -1; numThreads = -1; dataFile = ""; - pgmType = "UNKNOWN"; + pgmType = config.Device.GetName(); dumpOutput = false; seeding = SPARSE; @@ -206,18 +209,12 @@ bool ParseArgs(int argc, std::cerr << " -streamline steps_per_round (-1 = 0 rounds): particle history" << std::endl; std::cerr << " -t #numThreads" << std::endl; std::cerr << " -file dataFile" << std::endl; - std::cerr << " -dump : dump output points" << std::endl; + std::cerr << " -dump : dump output points" << std::endl << std::endl; + std::cerr << "General VTK-m Options" << std::endl; + std::cerr << config.Usage << std::endl; return false; } - std::string pgm = argv[0]; - if (pgm.find("SERIAL") != std::string::npos) - pgmType = "SER"; - else if (pgm.find("TBB") != std::string::npos) - pgmType = "TBB"; - else if (pgm.find("CUDA") != std::string::npos) - pgmType = "CUD"; - for (int i = 1; i < argc; i++) { std::string arg = argv[i]; @@ -284,6 +281,10 @@ bool ParseArgs(int argc, int main(int argc, char** argv) { + // Process vtk-m general args + auto opts = vtkm::cont::InitializeOptions::DefaultAnyDevice; + auto config = vtkm::cont::Initialize(argc, argv, opts); + vtkm::Id numSeeds = 100, numSteps = 100, advectType = 0, numThreads = -1, stepsPerRound = -1, particlesPerRound = -1; vtkm::Float32 stepSize = 0.1f; @@ -293,6 +294,7 @@ int main(int argc, char** argv) if (!ParseArgs(argc, argv, + config, numSeeds, numSteps, stepSize, diff --git a/examples/particle_advection/ParticleAdvectionTBB.cxx b/examples/particle_advection/ParticleAdvectionTBB.cxx deleted file mode 100644 index df567c2f0..000000000 --- a/examples/particle_advection/ParticleAdvectionTBB.cxx +++ /dev/null @@ -1,25 +0,0 @@ -//============================================================================ -// Copyright (c) Kitware, Inc. -// All rights reserved. -// See LICENSE.txt for details. -// This software is distributed WITHOUT ANY WARRANTY; without even -// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -// PURPOSE. See the above copyright notice for more information. -// -// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS). -// Copyright 2014 UT-Battelle, LLC. -// Copyright 2014 Los Alamos National Security. -// -// Under the terms of Contract DE-NA0003525 with NTESS, -// the U.S. Government retains certain rights in this software. -// -// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National -// Laboratory (LANL), the U.S. Government retains certain rights in -// this software. -//============================================================================ - -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_TBB - -#define __BUILDING_TBB_VERSION__ - -#include "ParticleAdvection.cxx" diff --git a/examples/redistribute_points/CMakeLists.txt b/examples/redistribute_points/CMakeLists.txt index dd28e2256..ec73b14b9 100644 --- a/examples/redistribute_points/CMakeLists.txt +++ b/examples/redistribute_points/CMakeLists.txt @@ -24,23 +24,9 @@ project(RedistributePoints CXX) #Find the VTK-m package find_package(VTKm REQUIRED QUIET) -add_executable(RedistributePoints_SERIAL RedistributePoints.cxx RedistributePoints.h) -target_compile_definitions(RedistributePoints_SERIAL PRIVATE - "VTKM_DEVICE_ADAPTER=VTKM_DEVICE_ADAPTER_SERIAL") -target_link_libraries(RedistributePoints_SERIAL PRIVATE vtkm_filter) - -if(TARGET vtkm::tbb) - add_executable(RedistributePoints_TBB RedistributePoints.cxx RedistributePoints.h) - target_compile_definitions(RedistributePoints_TBB PRIVATE - "VTKM_DEVICE_ADAPTER=VTKM_DEVICE_ADAPTER_TBB") - target_link_libraries(RedistributePoints_TBB PRIVATE vtkm_filter) -endif() +add_executable(RedistributePoints RedistributePoints.cxx RedistributePoints.h) +target_link_libraries(RedistributePoints PRIVATE vtkm_filter) if(TARGET vtkm::cuda) - vtkm_compile_as_cuda(cudaSource RedistributePoints.cxx) - add_executable(RedistributePoints_CUDA ${cudaSource} RedistributePoints.h) - - target_compile_definitions(RedistributePoints_CUDA PRIVATE - "VTKM_DEVICE_ADAPTER=VTKM_DEVICE_ADAPTER_CUDA") - target_link_libraries(RedistributePoints_CUDA PRIVATE vtkm_filter) + set_source_files_properties(RedistributePoints.cxx PROPERTIES LANGUAGE "CUDA") endif() diff --git a/examples/redistribute_points/RedistributePoints.cxx b/examples/redistribute_points/RedistributePoints.cxx index 9ce3f6f9f..701753d87 100644 --- a/examples/redistribute_points/RedistributePoints.cxx +++ b/examples/redistribute_points/RedistributePoints.cxx @@ -20,6 +20,8 @@ #include #include +#include + #include #include @@ -33,6 +35,10 @@ using std::endl; int main(int argc, char* argv[]) { + // Process vtk-m general args + auto opts = vtkm::cont::InitializeOptions::DefaultAnyDevice; + auto config = vtkm::cont::Initialize(argc, argv, opts); + vtkmdiy::mpi::environment env(argc, argv); auto comm = vtkmdiy::mpi::communicator(MPI_COMM_WORLD); vtkm::cont::EnvironmentTracker::SetCommunicator(comm); @@ -40,7 +46,8 @@ int main(int argc, char* argv[]) if (argc != 3) { cout << "Usage: " << endl - << "$ " << argv[0] << " " << endl; + << "$ " << argv[0] << " [options] " << endl; + cout << config.Usage << endl; return EXIT_FAILURE; } diff --git a/examples/rendering/CMakeLists.txt b/examples/rendering/CMakeLists.txt index 0020c0623..b49da8c1e 100644 --- a/examples/rendering/CMakeLists.txt +++ b/examples/rendering/CMakeLists.txt @@ -34,12 +34,5 @@ if(NOT TARGET GLUT::GLUT) return() endif() -add_executable(RenderingExample_SERIAL Rendering.cxx) -target_link_libraries(RenderingExample_SERIAL PRIVATE vtkm_rendering GLUT::GLUT) - -if(TARGET vtkm::tbb) - add_executable(RenderingExample_TBB Rendering.cxx) - target_compile_definitions(Rendering_TBB PRIVATE - "VTKM_DEVICE_ADAPTER=VTKM_DEVICE_ADAPTER_TBB") - target_link_libraries(RenderingExample_TBB PRIVATE vtkm_rendering GLUT::GLUT) -endif() +add_executable(RenderingExample Rendering.cxx) +target_link_libraries(RenderingExample PRIVATE vtkm_rendering GLUT::GLUT) diff --git a/examples/rendering/Rendering.cxx b/examples/rendering/Rendering.cxx index 694e1f050..5ac8c3dae 100644 --- a/examples/rendering/Rendering.cxx +++ b/examples/rendering/Rendering.cxx @@ -18,12 +18,6 @@ // this software. //============================================================================ -//We first check if VTKM_DEVICE_ADAPTER is defined, so that when TBB and CUDA -//includes this file we use the device adapter that they have set. -#ifndef VTKM_DEVICE_ADAPTER -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_SERIAL -#endif - #include #include #include @@ -119,6 +113,10 @@ void mouseCall(int button, int state, int vtkmNotUsed(x), int vtkmNotUsed(y)) // Compute and render an isosurface for a uniform grid example int main(int argc, char* argv[]) { + auto opts = + vtkm::cont::InitializeOptions::DefaultAnyDevice | vtkm::cont::InitializeOptions::Strict; + vtkm::cont::Initialize(argc, argv, opts); + vtkm::cont::testing::MakeTestDataSet maker; vtkm::cont::DataSet ds = maker.Make3DUniformDataSet0(); diff --git a/examples/streamline/CMakeLists.txt b/examples/streamline/CMakeLists.txt index 7e954f7a3..756a0715a 100644 --- a/examples/streamline/CMakeLists.txt +++ b/examples/streamline/CMakeLists.txt @@ -32,17 +32,11 @@ if(TARGET OpenGL::GL AND set(gl_libs OpenGL::GL OpenGL::GLU GLEW::GLEW GLUT::GLUT) - add_executable(StreamLineUniformGrid_SERIAL StreamLineUniformGrid.cxx) - target_link_libraries(StreamLineUniformGrid_SERIAL PRIVATE vtkm_filter ${gl_libs}) + add_executable(StreamLineUniformGrid StreamLineUniformGrid.cxx) + target_link_libraries(StreamLineUniformGrid PRIVATE vtkm_filter ${gl_libs}) - if(TARGET vtkm::cont) - add_executable(StreamLineUniformGrid_CUDA StreamLineUniformGrid.cu) - target_link_libraries(StreamLineUniformGrid_CUDA PRIVATE vtkm_filter ${gl_libs}) - endif() - - if(TARGET vtkm::tbb) - add_executable(StreamLineUniformGrid_TBB StreamLineUniformGridTBB.cxx) - target_link_libraries(StreamLineUniformGrid_TBB PRIVATE vtkm_filter ${gl_libs}) + if(TARGET vtkm::cuda) + set_source_files_properties(StreamLineUniformGrid.cxx PROPERTIES LANGUAGE "CUDA") endif() endif() diff --git a/examples/streamline/StreamLineUniformGrid.cu b/examples/streamline/StreamLineUniformGrid.cu deleted file mode 100644 index da30a6a88..000000000 --- a/examples/streamline/StreamLineUniformGrid.cu +++ /dev/null @@ -1,23 +0,0 @@ -//============================================================================ -// Copyright (c) Kitware, Inc. -// All rights reserved. -// See LICENSE.txt for details. -// This software is distributed WITHOUT ANY WARRANTY; without even -// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -// PURPOSE. See the above copyright notice for more information. -// -// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS). -// Copyright 2014 UT-Battelle, LLC. -// Copyright 2014 Los Alamos National Security. -// -// Under the terms of Contract DE-NA0003525 with NTESS, -// the U.S. Government retains certain rights in this software. -// -// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National -// Laboratory (LANL), the U.S. Government retains certain rights in -// this software. -//============================================================================ - -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_CUDA - -#include "StreamLineUniformGrid.cxx" diff --git a/examples/streamline/StreamLineUniformGrid.cxx b/examples/streamline/StreamLineUniformGrid.cxx index 02eb82b71..0d8e09546 100644 --- a/examples/streamline/StreamLineUniformGrid.cxx +++ b/examples/streamline/StreamLineUniformGrid.cxx @@ -18,14 +18,12 @@ // this software. //============================================================================ -#ifndef VTKM_DEVICE_ADAPTER -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_SERIAL -#endif - #include #include #include #include +#include + #include #include @@ -49,17 +47,15 @@ #include "../isosurface/quaternion.h" -using DeviceAdapter = VTKM_DEFAULT_DEVICE_ADAPTER_TAG; - // Output data set shared with opengl -static vtkm::worklet::StreamLineFilterUniformGrid* streamLineFilter; +static vtkm::worklet::StreamLineFilterUniformGrid* streamLineFilter; static vtkm::cont::DataSet outDataSet; // Input parameters const vtkm::Id nSeeds = 25; const vtkm::Id nSteps = 2000; const vtkm::Float32 tStep = 0.5f; -const vtkm::Id direction = vtkm::worklet::internal::BOTH; +const vtkm::Id direction = vtkm::worklet::streamline::BOTH; // Point location of vertices from a CastAndCall but needs a static cast eventually static vtkm::cont::ArrayHandle> vertexArray; @@ -200,12 +196,17 @@ VTKM_EXEC_CONT vtkm::Vec Normalize(vtkm::Vec v) // Run streamlines on a uniform grid of vector data int main(int argc, char* argv[]) { + auto opts = vtkm::cont::InitializeOptions::DefaultAnyDevice; + auto config = vtkm::cont::Initialize(argc, argv, opts); + std::cout << "StreamLineUniformGrid Example" << std::endl; - std::cout << "Parameters are fileName [numSeeds maxSteps timeStep direction]" << std::endl + std::cout << "Parameters are [options] fileName [numSeeds maxSteps timeStep direction]" + << std::endl << std::endl; std::cout << "Direction is FORWARD=0 BACKWARD=1 BOTH=2" << std::endl << std::endl; std::cout << "File is expected to be binary with xdim ydim zdim as 32 bit integers " << std::endl; std::cout << "followed by vector data per dimension point as 32 bit float" << std::endl; + std::cout << config.Usage << std::endl; // Read in the vector data for testing FILE* pFile = fopen(argv[1], "rb"); @@ -262,7 +263,7 @@ int main(int argc, char* argv[]) inDataSet.AddCellSet(inCellSet); // Create and run the filter - streamLineFilter = new vtkm::worklet::StreamLineFilterUniformGrid(); + streamLineFilter = new vtkm::worklet::StreamLineFilterUniformGrid(); outDataSet = streamLineFilter->Run(inDataSet, direction, nSeeds, nSteps, tStep); // Render the output dataset of polylines diff --git a/examples/streamline/StreamLineUniformGridTBB.cxx b/examples/streamline/StreamLineUniformGridTBB.cxx deleted file mode 100644 index 2ca18e8ba..000000000 --- a/examples/streamline/StreamLineUniformGridTBB.cxx +++ /dev/null @@ -1,23 +0,0 @@ -//============================================================================ -// Copyright (c) Kitware, Inc. -// All rights reserved. -// See LICENSE.txt for details. -// This software is distributed WITHOUT ANY WARRANTY; without even -// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -// PURPOSE. See the above copyright notice for more information. -// -// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS). -// Copyright 2014 UT-Battelle, LLC. -// Copyright 2014 Los Alamos National Security. -// -// Under the terms of Contract DE-NA0003525 with NTESS, -// the U.S. Government retains certain rights in this software. -// -// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National -// Laboratory (LANL), the U.S. Government retains certain rights in -// this software. -//============================================================================ - -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_TBB - -#include "StreamLineUniformGrid.cxx" diff --git a/examples/tau_timing/CMakeLists.txt b/examples/tau_timing/CMakeLists.txt index f56eb037c..db13a1699 100644 --- a/examples/tau_timing/CMakeLists.txt +++ b/examples/tau_timing/CMakeLists.txt @@ -27,16 +27,10 @@ find_package(VTKm REQUIRED QUIET) if(TARGET vtkm_rendering) - add_executable(Tau_timing_SERIAL TauTiming.cxx) - target_link_libraries(Tau_timing_SERIAL vtkm_cont) - - if(TARGET vtkm::tbb) - add_executable(Tau_timing_TBB TauTimingTBB.cxx) - target_link_libraries(Tau_timing_TBB vtkm_cont) - endif() + add_executable(Tau_timing TauTiming.cxx) + target_link_libraries(Tau_timing vtkm_cont) if(TARGET vtkm::cuda) - add_executable(Tau_timing_CUDA TauTiming.cu) - target_link_libraries(Tau_timing_CUDA PRIVATE vtkm_cont) + set_source_files_properties(TauTiming.cxx PROPERTIES LANGUAGE "CUDA") endif() endif() diff --git a/examples/tau_timing/TauTiming.cu b/examples/tau_timing/TauTiming.cu deleted file mode 100644 index 8d637e1f2..000000000 --- a/examples/tau_timing/TauTiming.cu +++ /dev/null @@ -1,23 +0,0 @@ -//============================================================================ -// Copyright (c) Kitware, Inc. -// All rights reserved. -// See LICENSE.txt for details. -// This software is distributed WITHOUT ANY WARRANTY; without even -// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -// PURPOSE. See the above copyright notice for more information. -// -// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS). -// Copyright 2014 UT-Battelle, LLC. -// Copyright 2014 Los Alamos National Security. -// -// Under the terms of Contract DE-NA0003525 with NTESS, -// the U.S. Government retains certain rights in this software. -// -// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National -// Laboratory (LANL), the U.S. Government retains certain rights in -// this software. -//============================================================================ - -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_CUDA - -#include "TauTiming.cxx" diff --git a/examples/tau_timing/TauTiming.cxx b/examples/tau_timing/TauTiming.cxx index a5f100c41..a0b88015f 100644 --- a/examples/tau_timing/TauTiming.cxx +++ b/examples/tau_timing/TauTiming.cxx @@ -17,11 +17,6 @@ // Laboratory (LANL), the U.S. Government retains certain rights in // this software. //============================================================================ - -#ifndef VTKM_DEVICE_ADAPTER -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_SERIAL -#endif - #include #include #include @@ -32,8 +27,8 @@ #include #include #include +#include -#include #include #include #include @@ -63,8 +58,6 @@ VTKM_EXEC_CONT vtkm::Vec Normalize(vtkm::Vec v) return one / magnitude * v; } -using DeviceAdapter = VTKM_DEFAULT_DEVICE_ADAPTER_TAG; - class TangleField : public vtkm::worklet::WorkletMapField { public: @@ -321,8 +314,8 @@ void StreamlineTest(vtkm::cont::DataSet& ds, int N) const vtkm::Float32 tStep = 0.05f; const vtkm::Id direction = vtkm::worklet::internal::FORWARD; //vtkm::worklet::internal::BOTH; - vtkm::worklet::StreamLineFilterUniformGrid* streamLineFilter; - streamLineFilter = new vtkm::worklet::StreamLineFilterUniformGrid(); + vtkm::worklet::StreamLineFilterUniformGrid* streamLineFilter; + streamLineFilter = new vtkm::worklet::StreamLineFilterUniformGrid(); std::cout << "Streamline test: " << N << std::endl; for (int i = 0; i < N; i++) @@ -403,19 +396,15 @@ streamlines: vector field must be named "vecData" */ int main(int argc, char** argv) { - if (0) - { - int d = 16; - if (argc > 1) - d = atoi(argv[1]); - CreateData(d); - return 0; - } + // Process vtk-m general args + auto opts = vtkm::cont::InitializeOptions::DefaultAnyDevice; + auto config = vtkm::cont::Initialize(argc, argv, opts); if (argc != 5) { - std::cout << "Error: " << argv[0] << " N SZ " - << std::endl; + std::cout << "Error: " << argv[0] + << " [options] N SZ " << std::endl; + std::cout << "General Options: \n" << config.Usage << std::endl; return -1; } diff --git a/examples/tau_timing/TauTimingTBB.cxx b/examples/tau_timing/TauTimingTBB.cxx deleted file mode 100644 index f08c4ba1a..000000000 --- a/examples/tau_timing/TauTimingTBB.cxx +++ /dev/null @@ -1,23 +0,0 @@ -//============================================================================ -// Copyright (c) Kitware, Inc. -// All rights reserved. -// See LICENSE.txt for details. -// This software is distributed WITHOUT ANY WARRANTY; without even -// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -// PURPOSE. See the above copyright notice for more information. -// -// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS). -// Copyright 2014 UT-Battelle, LLC. -// Copyright 2014 Los Alamos National Security. -// -// Under the terms of Contract DE-NA0003525 with NTESS, -// the U.S. Government retains certain rights in this software. -// -// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National -// Laboratory (LANL), the U.S. Government retains certain rights in -// this software. -//============================================================================ - -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_TBB - -#include "TauTiming.cxx" diff --git a/examples/temporal_advection/CMakeLists.txt b/examples/temporal_advection/CMakeLists.txt index 1f3efa9e4..71aff052d 100644 --- a/examples/temporal_advection/CMakeLists.txt +++ b/examples/temporal_advection/CMakeLists.txt @@ -27,15 +27,9 @@ project(TemporalAdvection CXX) #Find the VTK-m package find_package(VTKm REQUIRED QUIET) -add_executable(Temporal_Advection_SERIAL TemporalAdvection.cxx) -target_link_libraries(Temporal_Advection_SERIAL PRIVATE vtkm_filter) - -if(TARGET vtkm::tbb) - add_executable(Temporal_Advection_TBB TemporalAdvectionTBB.cxx) - target_link_libraries(Temporal_Advection_TBB PRIVATE vtkm_filter) -endif() +add_executable(Temporal_Advection TemporalAdvection.cxx) +target_link_libraries(Temporal_Advection PRIVATE vtkm_filter) if(TARGET vtkm::cuda) - add_executable(Temporal_Advection_CUDA TemporalAdvection.cu) - target_link_libraries(Temporal_Advection_CUDA PRIVATE vtkm_filter) + set_source_files_properties(TemporalAdvection.cxx PROPERTIES LANGUAGE "CUDA") endif() diff --git a/examples/temporal_advection/TemporalAdvection.cu b/examples/temporal_advection/TemporalAdvection.cu deleted file mode 100644 index 279a63a6b..000000000 --- a/examples/temporal_advection/TemporalAdvection.cu +++ /dev/null @@ -1,23 +0,0 @@ -//============================================================================ -// Copyright (c) Kitware, Inc. -// All rights reserved. -// See LICENSE.txt for details. -// This software is distributed WITHOUT ANY WARRANTY; without even -// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -// PURPOSE. See the above copyright notice for more information. -// -// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS). -// Copyright 2014 UT-Battelle, LLC. -// Copyright 2014 Los Alamos National Security. -// -// Under the terms of Contract DE-NA0003525 with NTESS, -// the U.S. Government retains certain rights in this software. -// -// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National -// Laboratory (LANL), the U.S. Government retains certain rights in -// this software. -//============================================================================ - -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_CUDA - -#include "TemporalAdvection.cxx" diff --git a/examples/temporal_advection/TemporalAdvection.cxx b/examples/temporal_advection/TemporalAdvection.cxx index 31b87a4ba..aeb550326 100644 --- a/examples/temporal_advection/TemporalAdvection.cxx +++ b/examples/temporal_advection/TemporalAdvection.cxx @@ -19,6 +19,8 @@ //============================================================================ #include +#include + #include #include #include @@ -115,6 +117,13 @@ void RunTest(vtkm::Id numSteps, vtkm::Float32 stepSize, vtkm::Id advectType) int main(int argc, char** argv) { + auto opts = vtkm::cont::InitializeOptions::DefaultAnyDevice; + auto config = vtkm::cont::Initialize(argc, argv, opts); + + std::cout << "TemporalAdvection Example" << std::endl; + std::cout << "Parameters are [options] numSteps stepSize advectionType" << std::endl << std::endl; + std::cout << "advectionType Particles=0 Streamlines=1" << std::endl; + vtkm::Id numSteps; vtkm::Float32 stepSize; vtkm::Id advectionType; diff --git a/examples/temporal_advection/TemporalAdvectionTBB.cxx b/examples/temporal_advection/TemporalAdvectionTBB.cxx deleted file mode 100644 index 4929ebed7..000000000 --- a/examples/temporal_advection/TemporalAdvectionTBB.cxx +++ /dev/null @@ -1,23 +0,0 @@ -//============================================================================ -// Copyright (c) Kitware, Inc. -// All rights reserved. -// See LICENSE.txt for details. -// This software is distributed WITHOUT ANY WARRANTY; without even -// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -// PURPOSE. See the above copyright notice for more information. -// -// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS). -// Copyright 2014 UT-Battelle, LLC. -// Copyright 2014 Los Alamos National Security. -// -// Under the terms of Contract DE-NA0003525 with NTESS, -// the U.S. Government retains certain rights in this software. -// -// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National -// Laboratory (LANL), the U.S. Government retains certain rights in -// this software. -//============================================================================ - -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_TBB - -#include "TemporalAdvection.cxx" diff --git a/examples/tetrahedra/CMakeLists.txt b/examples/tetrahedra/CMakeLists.txt index 52e036a86..18b77f801 100644 --- a/examples/tetrahedra/CMakeLists.txt +++ b/examples/tetrahedra/CMakeLists.txt @@ -32,37 +32,21 @@ if(TARGET OpenGL::GL AND set(gl_libs OpenGL::GL OpenGL::GLU GLEW::GLEW GLUT::GLUT) - add_executable(TetrahedralizeExplicitGrid_SERIAL TetrahedralizeExplicitGrid.cxx) - add_executable(TriangulateExplicitGrid_SERIAL TriangulateExplicitGrid.cxx) - add_executable(TetrahedralizeUniformGrid_SERIAL TetrahedralizeUniformGrid.cxx) - add_executable(TriangulateUniformGrid_SERIAL TriangulateUniformGrid.cxx) + add_executable(TetrahedralizeExplicitGrid TetrahedralizeExplicitGrid.cxx) + add_executable(TriangulateExplicitGrid TriangulateExplicitGrid.cxx) + add_executable(TetrahedralizeUniformGrid TetrahedralizeUniformGrid.cxx) + add_executable(TriangulateUniformGrid TriangulateUniformGrid.cxx) - target_link_libraries(TetrahedralizeExplicitGrid_SERIAL PRIVATE vtkm_filter ${gl_libs}) - target_link_libraries(TriangulateExplicitGrid_SERIAL PRIVATE vtkm_filter ${gl_libs}) - target_link_libraries(TetrahedralizeUniformGrid_SERIAL PRIVATE vtkm_filter ${gl_libs}) - target_link_libraries(TriangulateUniformGrid_SERIAL PRIVATE vtkm_filter ${gl_libs}) + target_link_libraries(TetrahedralizeExplicitGrid PRIVATE vtkm_filter ${gl_libs}) + target_link_libraries(TriangulateExplicitGrid PRIVATE vtkm_filter ${gl_libs}) + target_link_libraries(TetrahedralizeUniformGrid PRIVATE vtkm_filter ${gl_libs}) + target_link_libraries(TriangulateUniformGrid PRIVATE vtkm_filter ${gl_libs}) if(TARGET vtkm::cuda) - add_executable(TetrahedralizeExplicitGrid_CUDA TetrahedralizeExplicitGrid.cu) - add_executable(TriangulateExplicitGrid_CUDA TriangulateExplicitGrid.cu) - add_executable(TetrahedralizeUniformGrid_CUDA TetrahedralizeUniformGrid.cu) - add_executable(TriangulateUniformGrid_CUDA TriangulateUniformGrid.cu) - - target_link_libraries(TetrahedralizeExplicitGrid_CUDA PRIVATE vtkm_filter ${gl_libs}) - target_link_libraries(TriangulateExplicitGrid_CUDA PRIVATE vtkm_filter ${gl_libs}) - target_link_libraries(TetrahedralizeUniformGrid_CUDA PRIVATE vtkm_filter ${gl_libs}) - target_link_libraries(TriangulateUniformGrid_CUDA PRIVATE vtkm_filter ${gl_libs}) + set_source_files_properties(TetrahedralizeExplicitGrid.cxx + TriangulateExplicitGrid.cxx + TetrahedralizeUniformGrid.cxx + TriangulateUniformGrid.cxx PROPERTIES LANGUAGE "CUDA") endif() - if(TARGET vtkm::tbb) - add_executable(TetrahedralizeExplicitGrid_TBB TetrahedralizeExplicitGridTBB.cxx) - add_executable(TriangulateExplicitGrid_TBB TriangulateExplicitGridTBB.cxx) - add_executable(TetrahedralizeUniformGrid_TBB TetrahedralizeUniformGridTBB.cxx) - add_executable(TriangulateUniformGrid_TBB TriangulateUniformGridTBB.cxx) - - target_link_libraries(TetrahedralizeExplicitGrid_TBB PRIVATE vtkm_filter ${gl_libs}) - target_link_libraries(TriangulateExplicitGrid_TBB PRIVATE vtkm_filter ${gl_libs}) - target_link_libraries(TetrahedralizeUniformGrid_TBB PRIVATE vtkm_filter ${gl_libs}) - target_link_libraries(TriangulateUniformGrid_TBB PRIVATE vtkm_filter ${gl_libs}) - endif() endif() diff --git a/examples/tetrahedra/TetrahedralizeExplicitGrid.cu b/examples/tetrahedra/TetrahedralizeExplicitGrid.cu deleted file mode 100644 index 910d3c64b..000000000 --- a/examples/tetrahedra/TetrahedralizeExplicitGrid.cu +++ /dev/null @@ -1,23 +0,0 @@ -//============================================================================ -// Copyright (c) Kitware, Inc. -// All rights reserved. -// See LICENSE.txt for details. -// This software is distributed WITHOUT ANY WARRANTY; without even -// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -// PURPOSE. See the above copyright notice for more information. -// -// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS). -// Copyright 2014 UT-Battelle, LLC. -// Copyright 2014 Los Alamos National Security. -// -// Under the terms of Contract DE-NA0003525 with NTESS, -// the U.S. Government retains certain rights in this software. -// -// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National -// Laboratory (LANL), the U.S. Government retains certain rights in -// this software. -//============================================================================ - -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_CUDA - -#include "TetrahedralizeExplicitGrid.cxx" diff --git a/examples/tetrahedra/TetrahedralizeExplicitGrid.cxx b/examples/tetrahedra/TetrahedralizeExplicitGrid.cxx index b8856cf97..70ca4d7e5 100644 --- a/examples/tetrahedra/TetrahedralizeExplicitGrid.cxx +++ b/examples/tetrahedra/TetrahedralizeExplicitGrid.cxx @@ -17,16 +17,11 @@ // Laboratory (LANL), the U.S. Government retains certain rights in // this software. //============================================================================ - -#ifndef VTKM_DEVICE_ADAPTER -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_SERIAL -#endif - #include #include #include +#include #include -#include #include @@ -44,8 +39,6 @@ #include "../isosurface/quaternion.h" -using DeviceAdapter = VTKM_DEFAULT_DEVICE_ADAPTER_TAG; - namespace { @@ -262,6 +255,9 @@ void mouseCall(int button, int state, int x, int y) // Tetrahedralize and render uniform grid example int main(int argc, char* argv[]) { + auto opts = + vtkm::cont::InitializeOptions::DefaultAnyDevice | vtkm::cont::InitializeOptions::Strict; + vtkm::cont::Initialize(argc, argv, opts); std::cout << "TetrahedralizeExplicitGrid Example" << std::endl; // Create the input explicit cell set diff --git a/examples/tetrahedra/TetrahedralizeExplicitGridTBB.cxx b/examples/tetrahedra/TetrahedralizeExplicitGridTBB.cxx deleted file mode 100644 index 8f6e4282e..000000000 --- a/examples/tetrahedra/TetrahedralizeExplicitGridTBB.cxx +++ /dev/null @@ -1,23 +0,0 @@ -//============================================================================ -// Copyright (c) Kitware, Inc. -// All rights reserved. -// See LICENSE.txt for details. -// This software is distributed WITHOUT ANY WARRANTY; without even -// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -// PURPOSE. See the above copyright notice for more information. -// -// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS). -// Copyright 2014 UT-Battelle, LLC. -// Copyright 2014 Los Alamos National Security. -// -// Under the terms of Contract DE-NA0003525 with NTESS, -// the U.S. Government retains certain rights in this software. -// -// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National -// Laboratory (LANL), the U.S. Government retains certain rights in -// this software. -//============================================================================ - -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_TBB - -#include "TetrahedralizeExplicitGrid.cxx" diff --git a/examples/tetrahedra/TetrahedralizeUniformGrid.cu b/examples/tetrahedra/TetrahedralizeUniformGrid.cu deleted file mode 100644 index f4430b201..000000000 --- a/examples/tetrahedra/TetrahedralizeUniformGrid.cu +++ /dev/null @@ -1,23 +0,0 @@ -//============================================================================ -// Copyright (c) Kitware, Inc. -// All rights reserved. -// See LICENSE.txt for details. -// This software is distributed WITHOUT ANY WARRANTY; without even -// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -// PURPOSE. See the above copyright notice for more information. -// -// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS). -// Copyright 2014 UT-Battelle, LLC. -// Copyright 2014 Los Alamos National Security. -// -// Under the terms of Contract DE-NA0003525 with NTESS, -// the U.S. Government retains certain rights in this software. -// -// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National -// Laboratory (LANL), the U.S. Government retains certain rights in -// this software. -//============================================================================ - -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_CUDA - -#include "TetrahedralizeUniformGrid.cxx" diff --git a/examples/tetrahedra/TetrahedralizeUniformGrid.cxx b/examples/tetrahedra/TetrahedralizeUniformGrid.cxx index d755ae86b..af144ace9 100644 --- a/examples/tetrahedra/TetrahedralizeUniformGrid.cxx +++ b/examples/tetrahedra/TetrahedralizeUniformGrid.cxx @@ -17,15 +17,10 @@ // Laboratory (LANL), the U.S. Government retains certain rights in // this software. //============================================================================ - -#ifndef VTKM_DEVICE_ADAPTER -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_SERIAL -#endif - #include #include +#include #include -#include #include @@ -43,8 +38,6 @@ #include "../isosurface/quaternion.h" -using DeviceAdapter = VTKM_DEFAULT_DEVICE_ADAPTER_TAG; - // Default size of the example static vtkm::Id3 dims(4, 4, 4); static vtkm::Id cellsToDisplay = 64; @@ -233,8 +226,14 @@ void mouseCall(int button, int state, int x, int y) // Tetrahedralize and render uniform grid example int main(int argc, char* argv[]) { + // Process vtk-m general args + auto opts = vtkm::cont::InitializeOptions::DefaultAnyDevice; + auto config = vtkm::cont::Initialize(argc, argv, opts); + std::cout << "TetrahedralizeUniformGrid Example" << std::endl; - std::cout << "Parameters are [xdim ydim zdim [# of cellsToDisplay]]" << std::endl << std::endl; + std::cout << "Parameters are [options] [xdim ydim zdim [# of cellsToDisplay]]" << std::endl; + std::cout << config.Usage << std::endl << std::endl; + // Set the problem size and number of cells to display from command line if (argc >= 4) diff --git a/examples/tetrahedra/TetrahedralizeUniformGridTBB.cxx b/examples/tetrahedra/TetrahedralizeUniformGridTBB.cxx deleted file mode 100644 index bd9e5f17b..000000000 --- a/examples/tetrahedra/TetrahedralizeUniformGridTBB.cxx +++ /dev/null @@ -1,23 +0,0 @@ -//============================================================================ -// Copyright (c) Kitware, Inc. -// All rights reserved. -// See LICENSE.txt for details. -// This software is distributed WITHOUT ANY WARRANTY; without even -// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -// PURPOSE. See the above copyright notice for more information. -// -// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS). -// Copyright 2014 UT-Battelle, LLC. -// Copyright 2014 Los Alamos National Security. -// -// Under the terms of Contract DE-NA0003525 with NTESS, -// the U.S. Government retains certain rights in this software. -// -// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National -// Laboratory (LANL), the U.S. Government retains certain rights in -// this software. -//============================================================================ - -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_TBB - -#include "TetrahedralizeUniformGrid.cxx" diff --git a/examples/tetrahedra/TriangulateExplicitGrid.cu b/examples/tetrahedra/TriangulateExplicitGrid.cu deleted file mode 100644 index 6f3d4aca5..000000000 --- a/examples/tetrahedra/TriangulateExplicitGrid.cu +++ /dev/null @@ -1,23 +0,0 @@ -//============================================================================ -// Copyright (c) Kitware, Inc. -// All rights reserved. -// See LICENSE.txt for details. -// This software is distributed WITHOUT ANY WARRANTY; without even -// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -// PURPOSE. See the above copyright notice for more information. -// -// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS). -// Copyright 2014 UT-Battelle, LLC. -// Copyright 2014 Los Alamos National Security. -// -// Under the terms of Contract DE-NA0003525 with NTESS, -// the U.S. Government retains certain rights in this software. -// -// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National -// Laboratory (LANL), the U.S. Government retains certain rights in -// this software. -//============================================================================ - -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_CUDA - -#include "TriangulateExplicitGrid.cxx" diff --git a/examples/tetrahedra/TriangulateExplicitGrid.cxx b/examples/tetrahedra/TriangulateExplicitGrid.cxx index 49a4b284f..e7de62d85 100644 --- a/examples/tetrahedra/TriangulateExplicitGrid.cxx +++ b/examples/tetrahedra/TriangulateExplicitGrid.cxx @@ -18,13 +18,10 @@ // this software. //============================================================================ -#ifndef VTKM_DEVICE_ADAPTER -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_SERIAL -#endif - #include #include #include +#include #include #include @@ -41,14 +38,11 @@ #include #endif -using DeviceAdapter = VTKM_DEFAULT_DEVICE_ADAPTER_TAG; - namespace { // Takes input uniform grid and outputs unstructured grid of triangles static vtkm::cont::DataSet outDataSet; -static vtkm::Id numberOfInPoints; } // anonymous namespace @@ -181,6 +175,9 @@ void displayCall() // Triangulate and render explicit grid example int main(int argc, char* argv[]) { + auto opts = + vtkm::cont::InitializeOptions::DefaultAnyDevice | vtkm::cont::InitializeOptions::Strict; + vtkm::cont::Initialize(argc, argv, opts); std::cout << "TrianguleExplicitGrid Example" << std::endl; // Create the input uniform cell set @@ -188,8 +185,6 @@ int main(int argc, char* argv[]) vtkm::cont::CellSetExplicit<> inCellSet; inDataSet.GetCellSet(0).CopyTo(inCellSet); - numberOfInPoints = inCellSet.GetNumberOfPoints(); - // Convert 2D explicit cells to triangles vtkm::filter::Triangulate triangulate; outDataSet = triangulate.Execute(inDataSet); diff --git a/examples/tetrahedra/TriangulateExplicitGridTBB.cxx b/examples/tetrahedra/TriangulateExplicitGridTBB.cxx deleted file mode 100644 index 2f903349b..000000000 --- a/examples/tetrahedra/TriangulateExplicitGridTBB.cxx +++ /dev/null @@ -1,23 +0,0 @@ -//============================================================================ -// Copyright (c) Kitware, Inc. -// All rights reserved. -// See LICENSE.txt for details. -// This software is distributed WITHOUT ANY WARRANTY; without even -// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -// PURPOSE. See the above copyright notice for more information. -// -// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS). -// Copyright 2014 UT-Battelle, LLC. -// Copyright 2014 Los Alamos National Security. -// -// Under the terms of Contract DE-NA0003525 with NTESS, -// the U.S. Government retains certain rights in this software. -// -// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National -// Laboratory (LANL), the U.S. Government retains certain rights in -// this software. -//============================================================================ - -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_TBB - -#include "TriangulateExplicitGrid.cxx" diff --git a/examples/tetrahedra/TriangulateUniformGrid.cu b/examples/tetrahedra/TriangulateUniformGrid.cu deleted file mode 100644 index 6591fce20..000000000 --- a/examples/tetrahedra/TriangulateUniformGrid.cu +++ /dev/null @@ -1,23 +0,0 @@ -//============================================================================ -// Copyright (c) Kitware, Inc. -// All rights reserved. -// See LICENSE.txt for details. -// This software is distributed WITHOUT ANY WARRANTY; without even -// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -// PURPOSE. See the above copyright notice for more information. -// -// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS). -// Copyright 2014 UT-Battelle, LLC. -// Copyright 2014 Los Alamos National Security. -// -// Under the terms of Contract DE-NA0003525 with NTESS, -// the U.S. Government retains certain rights in this software. -// -// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National -// Laboratory (LANL), the U.S. Government retains certain rights in -// this software. -//============================================================================ - -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_CUDA - -#include "TriangulateUniformGrid.cxx" diff --git a/examples/tetrahedra/TriangulateUniformGrid.cxx b/examples/tetrahedra/TriangulateUniformGrid.cxx index c70e05f18..db240beef 100644 --- a/examples/tetrahedra/TriangulateUniformGrid.cxx +++ b/examples/tetrahedra/TriangulateUniformGrid.cxx @@ -18,14 +18,10 @@ // this software. //============================================================================ -#ifndef VTKM_DEVICE_ADAPTER -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_SERIAL -#endif - #include #include +#include #include -#include #include @@ -41,8 +37,6 @@ #include #endif -using DeviceAdapter = VTKM_DEFAULT_DEVICE_ADAPTER_TAG; - // Default size of the example static vtkm::Id2 dims(4, 4); static vtkm::Id cellsToDisplay = 16; @@ -139,9 +133,13 @@ void displayCall() // Triangulate and render uniform grid example int main(int argc, char* argv[]) { - std::cout << "TrianguleUniformGrid Example" << std::endl; - std::cout << "Parameters are [xdim ydim [# of cellsToDisplay]]" << std::endl << std::endl; + // Process vtk-m general args + auto opts = vtkm::cont::InitializeOptions::DefaultAnyDevice; + auto config = vtkm::cont::Initialize(argc, argv, opts); + std::cout << "TrianguleUniformGrid Example" << std::endl; + std::cout << "Parameters are [options] [xdim ydim [# of cellsToDisplay]]" << std::endl; + std::cout << config.Usage << std::endl << std::endl; // Set the problem size and number of cells to display from command line if (argc >= 3) { diff --git a/examples/tetrahedra/TriangulateUniformGridTBB.cxx b/examples/tetrahedra/TriangulateUniformGridTBB.cxx deleted file mode 100644 index 858e3e788..000000000 --- a/examples/tetrahedra/TriangulateUniformGridTBB.cxx +++ /dev/null @@ -1,23 +0,0 @@ -//============================================================================ -// Copyright (c) Kitware, Inc. -// All rights reserved. -// See LICENSE.txt for details. -// This software is distributed WITHOUT ANY WARRANTY; without even -// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -// PURPOSE. See the above copyright notice for more information. -// -// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS). -// Copyright 2014 UT-Battelle, LLC. -// Copyright 2014 Los Alamos National Security. -// -// Under the terms of Contract DE-NA0003525 with NTESS, -// the U.S. Government retains certain rights in this software. -// -// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National -// Laboratory (LANL), the U.S. Government retains certain rights in -// this software. -//============================================================================ - -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_TBB - -#include "TriangulateUniformGrid.cxx" diff --git a/examples/unified_memory/UnifiedMemory.cu b/examples/unified_memory/UnifiedMemory.cu index abbbbde8f..667d0fd0e 100644 --- a/examples/unified_memory/UnifiedMemory.cu +++ b/examples/unified_memory/UnifiedMemory.cu @@ -52,8 +52,9 @@ public: // Run a simple worklet, and compute an isosurface int main(int argc, char* argv[]) { - vtkm::cont::Initialize(argc, argv); - + auto opts = + vtkm::cont::InitializeOptions::DefaultAnyDevice | vtkm::cont::InitializeOptions::Strict; + vtkm::cont::Initialize(argc, argv, opts); vtkm::Int64 N = 4 * 512 * 512 * 512; if (argc > 1) diff --git a/vtkm/cont/DeviceAdapter.h b/vtkm/cont/DeviceAdapter.h index 63abb8251..90ef6fb6d 100644 --- a/vtkm/cont/DeviceAdapter.h +++ b/vtkm/cont/DeviceAdapter.h @@ -25,10 +25,15 @@ // succeed of the order is changed.) Turn off formatting to keep the order. // clang-format off -#include +#include +#include +#include +#include + #include #include #include + // clang-format on namespace vtkm @@ -43,23 +48,23 @@ namespace cont /// mechanisms to run algorithms on a type of parallel device. The tag /// DeviceAdapterTag___ does not actually exist. Rather, this documentation is /// provided to describe the interface for a DeviceAdapter. Loading the -/// vtkm/cont/DeviceAdapter.h header file will set a default device adapter -/// appropriate for the current compile environment. You can specify the -/// default device adapter by first setting the \c VTKM_DEVICE_ADAPTER macro. -/// Valid values for \c VTKM_DEVICE_ADAPTER are the following: +/// vtkm/cont/DeviceAdapter.h header file will import all device adapters +/// appropriate for the current compile environment. /// -/// \li \c VTKM_DEVICE_ADAPTER_SERIAL Runs all algorithms in serial. Can be +/// \li \c vtkm::cont::DeviceAdapterTagSerial Runs all algorithms in serial. Can be /// helpful for debugging. -/// \li \c VTKM_DEVICE_ADAPTER_CUDA Dispatches and runs algorithms on a GPU +/// \li \c vtkm::cont::DeviceAdapterTagCuda Dispatches and runs algorithms on a GPU /// using CUDA. Must be compiling with a CUDA compiler (nvcc). -/// \li \c VTKM_DEVICE_ADAPTER_OPENMP Dispatches an algorithm over multiple +/// \li \c vtkm::cont::DeviceAdapterTagOpenMP Dispatches an algorithm over multiple /// CPU cores using OpenMP compiler directives. Must be compiling with an /// OpenMP-compliant compiler with OpenMP pragmas enabled. -/// \li \c VTKM_DEVICE_ADAPTER_TBB Dispatches and runs algorithms on multiple +/// \li \c vtkm::cont::DeviceAdapterTagTBB Dispatches and runs algorithms on multiple /// threads using the Intel Threading Building Blocks (TBB) libraries. Must /// have the TBB headers available and the resulting code must be linked with /// the TBB libraries. /// +/// To execute algorithms on any device, see Algorithm.h which allows +/// for abitrary device execution. /// See the ArrayManagerExecution.h and DeviceAdapterAlgorithm.h files for /// documentation on all the functions and classes that must be /// overloaded/specialized to create a new device adapter. diff --git a/vtkm/cont/DeviceAdapterTag.h b/vtkm/cont/DeviceAdapterTag.h index 9dc3576c0..39df26df3 100644 --- a/vtkm/cont/DeviceAdapterTag.h +++ b/vtkm/cont/DeviceAdapterTag.h @@ -29,6 +29,19 @@ #include +#ifdef VTKM_DEVICE_ADAPTER +// Rather than use defines to specify the default device adapter +// VTK-m now builds for all device adapters and uses runtime controls +// to determine where execution occurs +#error The VTKM_DEVICE_ADAPTER define is no longer obeyed and needs to be removed +#endif +#ifdef VTKM_DEFAULT_DEVICE_ADAPTER_TAG +// Rather than use device adapter tag that had no shared parent +// VTK-m now uses a runtime device adapter implementation that +// allows for runtime execution selection of what device to execute on +#error The VTKM_DEFAULT_DEVICE_ADAPTER_TAG define is no longer required and needs to be removed +#endif + #define VTKM_DEVICE_ADAPTER_ERROR -2 #define VTKM_DEVICE_ADAPTER_UNDEFINED -1 #define VTKM_DEVICE_ADAPTER_SERIAL 1 diff --git a/vtkm/cont/ExecutionObjectBase.h b/vtkm/cont/ExecutionObjectBase.h index b33b123d4..47dc08f99 100644 --- a/vtkm/cont/ExecutionObjectBase.h +++ b/vtkm/cont/ExecutionObjectBase.h @@ -24,16 +24,6 @@ #include -#if ((VTKM_DEVICE_ADAPTER > 0) && (VTKM_DEVICE_ADAPTER < VTKM_MAX_DEVICE_ADAPTER_ID)) -// Use the default device adapter tag for testing whether execution objects are valid. -#define VTK_M_DEVICE_ADAPTER_TO_TEST_EXEC_OBJECT VTKM_DEFAULT_DEVICE_ADAPTER_TAG -#else -// The default device adapter is invalid. Perhaps the error device adapter is being used. -// In this case, try the serial device adapter instead. It should always be valid. -#include -#define VTK_M_DEVICE_ADAPTER_TO_TEST_EXEC_OBJECT ::vtkm::cont::DeviceAdapterTagSerial -#endif - namespace vtkm { namespace cont @@ -59,8 +49,7 @@ struct CheckPrepareForExecution { template static auto check(T* p) - -> decltype(p->PrepareForExecution(VTK_M_DEVICE_ADAPTER_TO_TEST_EXEC_OBJECT()), - std::true_type()); + -> decltype(p->PrepareForExecution(vtkm::cont::DeviceAdapterTagSerial{}), std::true_type()); template static auto check(...) -> std::false_type; diff --git a/vtkm/cont/VariantArrayHandle.cxx b/vtkm/cont/VariantArrayHandle.cxx index a17fd4dc7..d0f602192 100644 --- a/vtkm/cont/VariantArrayHandle.cxx +++ b/vtkm/cont/VariantArrayHandle.cxx @@ -21,6 +21,8 @@ #include #include +#include + #include #include diff --git a/vtkm/cont/arg/testing/UnitTestTransportArrayInOut.cxx b/vtkm/cont/arg/testing/UnitTestTransportArrayInOut.cxx index 870c89ef3..8bb154597 100644 --- a/vtkm/cont/arg/testing/UnitTestTransportArrayInOut.cxx +++ b/vtkm/cont/arg/testing/UnitTestTransportArrayInOut.cxx @@ -92,7 +92,8 @@ void TryArrayInOutTransport(Device) void TestArrayInOutTransport() { - TryArrayInOutTransport(VTKM_DEFAULT_DEVICE_ADAPTER_TAG()); + std::cout << "Trying ArrayInOut transport with serial device." << std::endl; + TryArrayInOutTransport(vtkm::cont::DeviceAdapterTagSerial()); } } // anonymous namespace diff --git a/vtkm/cont/arg/testing/UnitTestTransportWholeArray.cxx b/vtkm/cont/arg/testing/UnitTestTransportWholeArray.cxx index e83458038..e13bf3cb6 100644 --- a/vtkm/cont/arg/testing/UnitTestTransportWholeArray.cxx +++ b/vtkm/cont/arg/testing/UnitTestTransportWholeArray.cxx @@ -202,7 +202,7 @@ void TryArrayOutTransport(Device) void TestWholeArrayTransport() { std::cout << "Trying WholeArray transport." << std::endl; - TryArrayOutTransport(VTKM_DEFAULT_DEVICE_ADAPTER_TAG()); + TryArrayOutTransport(vtkm::cont::DeviceAdapterTagSerial()); } } // Anonymous namespace diff --git a/vtkm/cont/cuda/testing/UnitTestCudaArrayHandle.cu b/vtkm/cont/cuda/testing/UnitTestCudaArrayHandle.cu index 38f9e3937..e5fe0da46 100644 --- a/vtkm/cont/cuda/testing/UnitTestCudaArrayHandle.cu +++ b/vtkm/cont/cuda/testing/UnitTestCudaArrayHandle.cu @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/cuda/testing/UnitTestCudaArrayHandleFancy.cu b/vtkm/cont/cuda/testing/UnitTestCudaArrayHandleFancy.cu index 6ceba9d17..d1cb4c4fc 100644 --- a/vtkm/cont/cuda/testing/UnitTestCudaArrayHandleFancy.cu +++ b/vtkm/cont/cuda/testing/UnitTestCudaArrayHandleFancy.cu @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/cuda/testing/UnitTestCudaArrayHandleVirtualCoordinates.cu b/vtkm/cont/cuda/testing/UnitTestCudaArrayHandleVirtualCoordinates.cu index 6aefde44e..babeeeca2 100644 --- a/vtkm/cont/cuda/testing/UnitTestCudaArrayHandleVirtualCoordinates.cu +++ b/vtkm/cont/cuda/testing/UnitTestCudaArrayHandleVirtualCoordinates.cu @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/cuda/testing/UnitTestCudaBitField.cu b/vtkm/cont/cuda/testing/UnitTestCudaBitField.cu index 658f46402..b485f79a0 100644 --- a/vtkm/cont/cuda/testing/UnitTestCudaBitField.cu +++ b/vtkm/cont/cuda/testing/UnitTestCudaBitField.cu @@ -17,12 +17,6 @@ // Laboratory (LANL), the U.S. Government retains certain rights in // this software. //============================================================================ - -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/cuda/testing/UnitTestCudaCellLocatorRectilinearGrid.cu b/vtkm/cont/cuda/testing/UnitTestCudaCellLocatorRectilinearGrid.cu index 1d8d7ed01..b954055d3 100644 --- a/vtkm/cont/cuda/testing/UnitTestCudaCellLocatorRectilinearGrid.cu +++ b/vtkm/cont/cuda/testing/UnitTestCudaCellLocatorRectilinearGrid.cu @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include int UnitTestCudaCellLocatorRectilinearGrid(int argc, char* argv[]) diff --git a/vtkm/cont/cuda/testing/UnitTestCudaCellLocatorUniformBins.cu b/vtkm/cont/cuda/testing/UnitTestCudaCellLocatorUniformBins.cu index 41a1365fc..8c251e734 100644 --- a/vtkm/cont/cuda/testing/UnitTestCudaCellLocatorUniformBins.cu +++ b/vtkm/cont/cuda/testing/UnitTestCudaCellLocatorUniformBins.cu @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include int UnitTestCudaCellLocatorUniformBins(int argc, char* argv[]) diff --git a/vtkm/cont/cuda/testing/UnitTestCudaCellLocatorUniformGrid.cu b/vtkm/cont/cuda/testing/UnitTestCudaCellLocatorUniformGrid.cu index 5e024918b..23d1122fc 100644 --- a/vtkm/cont/cuda/testing/UnitTestCudaCellLocatorUniformGrid.cu +++ b/vtkm/cont/cuda/testing/UnitTestCudaCellLocatorUniformGrid.cu @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include int UnitTestCudaCellLocatorUniformGrid(int argc, char* argv[]) diff --git a/vtkm/cont/cuda/testing/UnitTestCudaColorTable.cu b/vtkm/cont/cuda/testing/UnitTestCudaColorTable.cu index a76fc79af..ae120d164 100644 --- a/vtkm/cont/cuda/testing/UnitTestCudaColorTable.cu +++ b/vtkm/cont/cuda/testing/UnitTestCudaColorTable.cu @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/cuda/testing/UnitTestCudaComputeRange.cu b/vtkm/cont/cuda/testing/UnitTestCudaComputeRange.cu index 29a7c77c6..20e6f8a7b 100644 --- a/vtkm/cont/cuda/testing/UnitTestCudaComputeRange.cu +++ b/vtkm/cont/cuda/testing/UnitTestCudaComputeRange.cu @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/cuda/testing/UnitTestCudaDataSetExplicit.cu b/vtkm/cont/cuda/testing/UnitTestCudaDataSetExplicit.cu index 951abc064..544fa95fc 100644 --- a/vtkm/cont/cuda/testing/UnitTestCudaDataSetExplicit.cu +++ b/vtkm/cont/cuda/testing/UnitTestCudaDataSetExplicit.cu @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include #include diff --git a/vtkm/cont/cuda/testing/UnitTestCudaDataSetSingleType.cu b/vtkm/cont/cuda/testing/UnitTestCudaDataSetSingleType.cu index ed82476f9..265871f77 100644 --- a/vtkm/cont/cuda/testing/UnitTestCudaDataSetSingleType.cu +++ b/vtkm/cont/cuda/testing/UnitTestCudaDataSetSingleType.cu @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/cuda/testing/UnitTestCudaDeviceAdapter.cu b/vtkm/cont/cuda/testing/UnitTestCudaDeviceAdapter.cu index dca658438..ababbbc0a 100644 --- a/vtkm/cont/cuda/testing/UnitTestCudaDeviceAdapter.cu +++ b/vtkm/cont/cuda/testing/UnitTestCudaDeviceAdapter.cu @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include #include diff --git a/vtkm/cont/cuda/testing/UnitTestCudaGeometry.cu b/vtkm/cont/cuda/testing/UnitTestCudaGeometry.cu index ebe183bab..3c28c8fda 100644 --- a/vtkm/cont/cuda/testing/UnitTestCudaGeometry.cu +++ b/vtkm/cont/cuda/testing/UnitTestCudaGeometry.cu @@ -20,11 +20,6 @@ // //============================================================================= -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include #include diff --git a/vtkm/cont/cuda/testing/UnitTestCudaImplicitFunction.cu b/vtkm/cont/cuda/testing/UnitTestCudaImplicitFunction.cu index 11e88a2b0..909b4fd0f 100644 --- a/vtkm/cont/cuda/testing/UnitTestCudaImplicitFunction.cu +++ b/vtkm/cont/cuda/testing/UnitTestCudaImplicitFunction.cu @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include namespace diff --git a/vtkm/cont/cuda/testing/UnitTestCudaMath.cu b/vtkm/cont/cuda/testing/UnitTestCudaMath.cu index 9d0263486..a073aba7f 100644 --- a/vtkm/cont/cuda/testing/UnitTestCudaMath.cu +++ b/vtkm/cont/cuda/testing/UnitTestCudaMath.cu @@ -20,11 +20,6 @@ // //============================================================================= -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include #include diff --git a/vtkm/cont/cuda/testing/UnitTestCudaPointLocatorUniformGrid.cu b/vtkm/cont/cuda/testing/UnitTestCudaPointLocatorUniformGrid.cu index 180286417..4b9925732 100644 --- a/vtkm/cont/cuda/testing/UnitTestCudaPointLocatorUniformGrid.cu +++ b/vtkm/cont/cuda/testing/UnitTestCudaPointLocatorUniformGrid.cu @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include int UnitTestCudaPointLocatorUniformGrid(int argc, char* argv[]) diff --git a/vtkm/cont/cuda/testing/UnitTestCudaShareUserProvidedManagedMemory.cu b/vtkm/cont/cuda/testing/UnitTestCudaShareUserProvidedManagedMemory.cu index f55efbdd6..200606a38 100644 --- a/vtkm/cont/cuda/testing/UnitTestCudaShareUserProvidedManagedMemory.cu +++ b/vtkm/cont/cuda/testing/UnitTestCudaShareUserProvidedManagedMemory.cu @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/cuda/testing/UnitTestCudaVirtualObjectHandle.cu b/vtkm/cont/cuda/testing/UnitTestCudaVirtualObjectHandle.cu index 2ecd30900..8eba5d12d 100644 --- a/vtkm/cont/cuda/testing/UnitTestCudaVirtualObjectHandle.cu +++ b/vtkm/cont/cuda/testing/UnitTestCudaVirtualObjectHandle.cu @@ -17,11 +17,6 @@ // Laboratory (LANL), the U.S. Government retains certain rights in // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/internal/CMakeLists.txt b/vtkm/cont/internal/CMakeLists.txt index ffe3860b6..778126049 100644 --- a/vtkm/cont/internal/CMakeLists.txt +++ b/vtkm/cont/internal/CMakeLists.txt @@ -33,7 +33,6 @@ set(headers ConnectivityExplicitInternals.h DeviceAdapterAlgorithmGeneral.h DeviceAdapterAtomicArrayImplementation.h - DeviceAdapterDefaultSelection.h DeviceAdapterError.h DeviceAdapterListHelpers.h DynamicTransform.h diff --git a/vtkm/cont/internal/DeviceAdapterDefaultSelection.h b/vtkm/cont/internal/DeviceAdapterDefaultSelection.h deleted file mode 100644 index 019be5265..000000000 --- a/vtkm/cont/internal/DeviceAdapterDefaultSelection.h +++ /dev/null @@ -1,100 +0,0 @@ -//============================================================================ -// Copyright (c) Kitware, Inc. -// All rights reserved. -// See LICENSE.txt for details. -// This software is distributed WITHOUT ANY WARRANTY; without even -// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -// PURPOSE. See the above copyright notice for more information. -// -// Copyright 2017 National Technology & Engineering Solutions of Sandia, LLC (NTESS). -// Copyright 2017 UT-Battelle, LLC. -// Copyright 2017 Los Alamos National Security. -// -// Under the terms of Contract DE-NA0003525 with NTESS, -// the U.S. Government retains certain rights in this software. -// -// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National -// Laboratory (LANL), the U.S. Government retains certain rights in -// this software. -//============================================================================ - -/* This file contains the logic to automatically determine and include a - * default device adapter. */ - -#ifndef vtk_m_cont_internal_DeviceAdapterDefaultSelection_h -#define vtk_m_cont_internal_DeviceAdapterDefaultSelection_h - -#include -#include - -//----------------------------------------------------------------------------- -// Select the default devices based on available options. -#ifndef VTKM_DEVICE_ADAPTER -#ifdef VTKM_CUDA -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_CUDA -#elif defined(VTKM_ENABLE_TBB) // !VTKM_CUDA -// Unfortunately, VTKM_ENABLE_TBB does not guarantee that TBB is (or isn't) -// available, but there is no way to check for sure in a header library. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_TBB -#elif defined(VTKM_ENABLE_OPENMP) -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_OPENMP -#else // !VTKM_CUDA && !VTKM_ENABLE_TBB && !VTKM_ENABLE_OPENMP -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_SERIAL -#endif // !VTKM_CUDA && !VTKM_ENABLE_TBB -#endif // VTKM_DEVICE_ADAPTER - -//----------------------------------------------------------------------------- -// Bring in the appropriate device adapter tags for the default device: -// -// Serial: -#if VTKM_DEVICE_ADAPTER == VTKM_DEVICE_ADAPTER_SERIAL - -#include -#include -#include -#define VTKM_DEFAULT_DEVICE_ADAPTER_TAG ::vtkm::cont::DeviceAdapterTagSerial - -// Cuda: -#elif VTKM_DEVICE_ADAPTER == VTKM_DEVICE_ADAPTER_CUDA - -#include -#include -#include -#define VTKM_DEFAULT_DEVICE_ADAPTER_TAG ::vtkm::cont::DeviceAdapterTagCuda - -// TBB: -#elif VTKM_DEVICE_ADAPTER == VTKM_DEVICE_ADAPTER_TBB - -#include -#include -#include -#define VTKM_DEFAULT_DEVICE_ADAPTER_TAG ::vtkm::cont::DeviceAdapterTagTBB - -// OpenMP: -#elif VTKM_DEVICE_ADAPTER == VTKM_DEVICE_ADAPTER_OPENMP - -#include -#include -#include -#define VTKM_DEFAULT_DEVICE_ADAPTER_TAG ::vtkm::cont::DeviceAdapterTagOpenMP - -// Error: -#elif VTKM_DEVICE_ADAPTER == VTKM_DEVICE_ADAPTER_ERROR - -#include -#define VTKM_DEFAULT_DEVICE_ADAPTER_TAG ::vtkm::cont::DeviceAdapterTagError - -// Unknown: -#elif (VTKM_DEVICE_ADAPTER == VTKM_DEVICE_ADAPTER_UNDEFINED) || !defined(VTKM_DEVICE_ADAPTER) - -#ifndef VTKM_DEFAULT_DEVICE_ADAPTER_TAG -#warning If device adapter is undefined, VTKM_DEFAULT_DEVICE_ADAPTER_TAG must be defined. -#endif - -#else - -#warning Unrecognized device adapter given. - -#endif - -#endif // vtk_m_cont_internal_DeviceAdapterDefaultSelection_h diff --git a/vtkm/cont/openmp/testing/UnitTestOpenMPArrayHandle.cxx b/vtkm/cont/openmp/testing/UnitTestOpenMPArrayHandle.cxx index 30ce4a94b..94fa68575 100644 --- a/vtkm/cont/openmp/testing/UnitTestOpenMPArrayHandle.cxx +++ b/vtkm/cont/openmp/testing/UnitTestOpenMPArrayHandle.cxx @@ -17,9 +17,6 @@ // Laboratory (LANL), the U.S. Government retains certain rights in // this software. //============================================================================ - -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/openmp/testing/UnitTestOpenMPArrayHandleFancy.cxx b/vtkm/cont/openmp/testing/UnitTestOpenMPArrayHandleFancy.cxx index fab96c394..4869ac49a 100644 --- a/vtkm/cont/openmp/testing/UnitTestOpenMPArrayHandleFancy.cxx +++ b/vtkm/cont/openmp/testing/UnitTestOpenMPArrayHandleFancy.cxx @@ -17,9 +17,6 @@ // Laboratory (LANL), the U.S. Government retains certain rights in // this software. //============================================================================ - -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/openmp/testing/UnitTestOpenMPArrayHandleVirtualCoordinates.cxx b/vtkm/cont/openmp/testing/UnitTestOpenMPArrayHandleVirtualCoordinates.cxx index a38c4e394..d45b0ca8c 100644 --- a/vtkm/cont/openmp/testing/UnitTestOpenMPArrayHandleVirtualCoordinates.cxx +++ b/vtkm/cont/openmp/testing/UnitTestOpenMPArrayHandleVirtualCoordinates.cxx @@ -17,9 +17,6 @@ // Laboratory (LANL), the U.S. Government retains certain rights in // this software. //============================================================================ - -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/openmp/testing/UnitTestOpenMPBitField.cxx b/vtkm/cont/openmp/testing/UnitTestOpenMPBitField.cxx index d413dd352..4978fac97 100644 --- a/vtkm/cont/openmp/testing/UnitTestOpenMPBitField.cxx +++ b/vtkm/cont/openmp/testing/UnitTestOpenMPBitField.cxx @@ -17,9 +17,6 @@ // Laboratory (LANL), the U.S. Government retains certain rights in // this software. //============================================================================ - -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/openmp/testing/UnitTestOpenMPCellLocatorRectilinearGrid.cxx b/vtkm/cont/openmp/testing/UnitTestOpenMPCellLocatorRectilinearGrid.cxx index bbf03f92a..3883a33cf 100644 --- a/vtkm/cont/openmp/testing/UnitTestOpenMPCellLocatorRectilinearGrid.cxx +++ b/vtkm/cont/openmp/testing/UnitTestOpenMPCellLocatorRectilinearGrid.cxx @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include int UnitTestOpenMPCellLocatorRectilinearGrid(int argc, char* argv[]) diff --git a/vtkm/cont/openmp/testing/UnitTestOpenMPCellLocatorUniformBins.cxx b/vtkm/cont/openmp/testing/UnitTestOpenMPCellLocatorUniformBins.cxx index 6f8c6b4a4..226637bc8 100644 --- a/vtkm/cont/openmp/testing/UnitTestOpenMPCellLocatorUniformBins.cxx +++ b/vtkm/cont/openmp/testing/UnitTestOpenMPCellLocatorUniformBins.cxx @@ -17,9 +17,6 @@ // Laboratory (LANL), the U.S. Government retains certain rights in // this software. //============================================================================ - -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/openmp/testing/UnitTestOpenMPCellLocatorUniformGrid.cxx b/vtkm/cont/openmp/testing/UnitTestOpenMPCellLocatorUniformGrid.cxx index 8beabed00..0c00f29f2 100644 --- a/vtkm/cont/openmp/testing/UnitTestOpenMPCellLocatorUniformGrid.cxx +++ b/vtkm/cont/openmp/testing/UnitTestOpenMPCellLocatorUniformGrid.cxx @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include int UnitTestOpenMPCellLocatorUniformGrid(int argc, char* argv[]) diff --git a/vtkm/cont/openmp/testing/UnitTestOpenMPColorTable.cxx b/vtkm/cont/openmp/testing/UnitTestOpenMPColorTable.cxx index e893c036c..a964a6cb0 100644 --- a/vtkm/cont/openmp/testing/UnitTestOpenMPColorTable.cxx +++ b/vtkm/cont/openmp/testing/UnitTestOpenMPColorTable.cxx @@ -17,9 +17,6 @@ // Laboratory (LANL), the U.S. Government retains certain rights in // this software. //============================================================================ - -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/openmp/testing/UnitTestOpenMPComputeRange.cxx b/vtkm/cont/openmp/testing/UnitTestOpenMPComputeRange.cxx index 32d9c8403..33ad27000 100644 --- a/vtkm/cont/openmp/testing/UnitTestOpenMPComputeRange.cxx +++ b/vtkm/cont/openmp/testing/UnitTestOpenMPComputeRange.cxx @@ -17,9 +17,6 @@ // Laboratory (LANL), the U.S. Government retains certain rights in // this software. //============================================================================ - -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/openmp/testing/UnitTestOpenMPDataSetExplicit.cxx b/vtkm/cont/openmp/testing/UnitTestOpenMPDataSetExplicit.cxx index 592d87a51..f78911346 100644 --- a/vtkm/cont/openmp/testing/UnitTestOpenMPDataSetExplicit.cxx +++ b/vtkm/cont/openmp/testing/UnitTestOpenMPDataSetExplicit.cxx @@ -17,9 +17,6 @@ // Laboratory (LANL), the U.S. Government retains certain rights in // this software. //============================================================================ - -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/openmp/testing/UnitTestOpenMPDataSetSingleType.cxx b/vtkm/cont/openmp/testing/UnitTestOpenMPDataSetSingleType.cxx index 165497c4f..7b6c29814 100644 --- a/vtkm/cont/openmp/testing/UnitTestOpenMPDataSetSingleType.cxx +++ b/vtkm/cont/openmp/testing/UnitTestOpenMPDataSetSingleType.cxx @@ -17,9 +17,6 @@ // Laboratory (LANL), the U.S. Government retains certain rights in // this software. //============================================================================ - -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/openmp/testing/UnitTestOpenMPDeviceAdapter.cxx b/vtkm/cont/openmp/testing/UnitTestOpenMPDeviceAdapter.cxx index 769dd9124..5173c8c07 100644 --- a/vtkm/cont/openmp/testing/UnitTestOpenMPDeviceAdapter.cxx +++ b/vtkm/cont/openmp/testing/UnitTestOpenMPDeviceAdapter.cxx @@ -17,9 +17,6 @@ // Laboratory (LANL), the U.S. Government retains certain rights in // this software. //============================================================================ - -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include #include diff --git a/vtkm/cont/openmp/testing/UnitTestOpenMPImplicitFunction.cxx b/vtkm/cont/openmp/testing/UnitTestOpenMPImplicitFunction.cxx index e36e49826..90e323510 100644 --- a/vtkm/cont/openmp/testing/UnitTestOpenMPImplicitFunction.cxx +++ b/vtkm/cont/openmp/testing/UnitTestOpenMPImplicitFunction.cxx @@ -17,9 +17,6 @@ // Laboratory (LANL), the U.S. Government retains certain rights in // this software. //============================================================================ - -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/openmp/testing/UnitTestOpenMPPointLocatorUniformGrid.cxx b/vtkm/cont/openmp/testing/UnitTestOpenMPPointLocatorUniformGrid.cxx index 3d78ca9b5..29eae38fe 100644 --- a/vtkm/cont/openmp/testing/UnitTestOpenMPPointLocatorUniformGrid.cxx +++ b/vtkm/cont/openmp/testing/UnitTestOpenMPPointLocatorUniformGrid.cxx @@ -17,9 +17,6 @@ // Laboratory (LANL), the U.S. Government retains certain rights in // this software. //============================================================================ - -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/openmp/testing/UnitTestOpenMPVirtualObjectHandle.cxx b/vtkm/cont/openmp/testing/UnitTestOpenMPVirtualObjectHandle.cxx index 7f0868e7d..6f22ccba7 100644 --- a/vtkm/cont/openmp/testing/UnitTestOpenMPVirtualObjectHandle.cxx +++ b/vtkm/cont/openmp/testing/UnitTestOpenMPVirtualObjectHandle.cxx @@ -17,9 +17,6 @@ // Laboratory (LANL), the U.S. Government retains certain rights in // this software. //============================================================================ - -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include #include diff --git a/vtkm/cont/serial/testing/UnitTestSerialArrayHandle.cxx b/vtkm/cont/serial/testing/UnitTestSerialArrayHandle.cxx index 330445022..32c15d57f 100644 --- a/vtkm/cont/serial/testing/UnitTestSerialArrayHandle.cxx +++ b/vtkm/cont/serial/testing/UnitTestSerialArrayHandle.cxx @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/serial/testing/UnitTestSerialArrayHandleFancy.cxx b/vtkm/cont/serial/testing/UnitTestSerialArrayHandleFancy.cxx index cf78229d5..8e41c7a5d 100644 --- a/vtkm/cont/serial/testing/UnitTestSerialArrayHandleFancy.cxx +++ b/vtkm/cont/serial/testing/UnitTestSerialArrayHandleFancy.cxx @@ -19,12 +19,6 @@ // this software. // //============================================================================= - -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/serial/testing/UnitTestSerialArrayHandleVirtualCoordinates.cxx b/vtkm/cont/serial/testing/UnitTestSerialArrayHandleVirtualCoordinates.cxx index 865e02f6c..af9f1e4f2 100644 --- a/vtkm/cont/serial/testing/UnitTestSerialArrayHandleVirtualCoordinates.cxx +++ b/vtkm/cont/serial/testing/UnitTestSerialArrayHandleVirtualCoordinates.cxx @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include #include diff --git a/vtkm/cont/serial/testing/UnitTestSerialBitField.cxx b/vtkm/cont/serial/testing/UnitTestSerialBitField.cxx index 6cba6759d..fe3f0f17d 100644 --- a/vtkm/cont/serial/testing/UnitTestSerialBitField.cxx +++ b/vtkm/cont/serial/testing/UnitTestSerialBitField.cxx @@ -17,12 +17,6 @@ // Laboratory (LANL), the U.S. Government retains certain rights in // this software. //============================================================================ - -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/serial/testing/UnitTestSerialCellLocatorRectilinearGrid.cxx b/vtkm/cont/serial/testing/UnitTestSerialCellLocatorRectilinearGrid.cxx index 08bff097d..dcc502ae3 100644 --- a/vtkm/cont/serial/testing/UnitTestSerialCellLocatorRectilinearGrid.cxx +++ b/vtkm/cont/serial/testing/UnitTestSerialCellLocatorRectilinearGrid.cxx @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include int UnitTestSerialCellLocatorRectilinearGrid(int argc, char* argv[]) diff --git a/vtkm/cont/serial/testing/UnitTestSerialCellLocatorUniformBins.cxx b/vtkm/cont/serial/testing/UnitTestSerialCellLocatorUniformBins.cxx index a499b930b..b7f3a8606 100644 --- a/vtkm/cont/serial/testing/UnitTestSerialCellLocatorUniformBins.cxx +++ b/vtkm/cont/serial/testing/UnitTestSerialCellLocatorUniformBins.cxx @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/serial/testing/UnitTestSerialCellLocatorUniformGrid.cxx b/vtkm/cont/serial/testing/UnitTestSerialCellLocatorUniformGrid.cxx index 9a25e20d1..407241fac 100644 --- a/vtkm/cont/serial/testing/UnitTestSerialCellLocatorUniformGrid.cxx +++ b/vtkm/cont/serial/testing/UnitTestSerialCellLocatorUniformGrid.cxx @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include int UnitTestSerialCellLocatorUniformGrid(int argc, char* argv[]) diff --git a/vtkm/cont/serial/testing/UnitTestSerialColorTable.cxx b/vtkm/cont/serial/testing/UnitTestSerialColorTable.cxx index 4a51b56ec..7278142b3 100644 --- a/vtkm/cont/serial/testing/UnitTestSerialColorTable.cxx +++ b/vtkm/cont/serial/testing/UnitTestSerialColorTable.cxx @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/serial/testing/UnitTestSerialComputeRange.cxx b/vtkm/cont/serial/testing/UnitTestSerialComputeRange.cxx index 6f5794bb1..96cd398c4 100644 --- a/vtkm/cont/serial/testing/UnitTestSerialComputeRange.cxx +++ b/vtkm/cont/serial/testing/UnitTestSerialComputeRange.cxx @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/serial/testing/UnitTestSerialDataSetExplicit.cxx b/vtkm/cont/serial/testing/UnitTestSerialDataSetExplicit.cxx index 7f6ca5d63..48a379f5a 100644 --- a/vtkm/cont/serial/testing/UnitTestSerialDataSetExplicit.cxx +++ b/vtkm/cont/serial/testing/UnitTestSerialDataSetExplicit.cxx @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/serial/testing/UnitTestSerialDataSetSingleType.cxx b/vtkm/cont/serial/testing/UnitTestSerialDataSetSingleType.cxx index 18b223065..7f9f02164 100644 --- a/vtkm/cont/serial/testing/UnitTestSerialDataSetSingleType.cxx +++ b/vtkm/cont/serial/testing/UnitTestSerialDataSetSingleType.cxx @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/serial/testing/UnitTestSerialDeviceAdapter.cxx b/vtkm/cont/serial/testing/UnitTestSerialDeviceAdapter.cxx index 4496699cd..c38b281d5 100644 --- a/vtkm/cont/serial/testing/UnitTestSerialDeviceAdapter.cxx +++ b/vtkm/cont/serial/testing/UnitTestSerialDeviceAdapter.cxx @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include #include diff --git a/vtkm/cont/serial/testing/UnitTestSerialGeometry.cxx b/vtkm/cont/serial/testing/UnitTestSerialGeometry.cxx index 182c35381..dc015de6a 100644 --- a/vtkm/cont/serial/testing/UnitTestSerialGeometry.cxx +++ b/vtkm/cont/serial/testing/UnitTestSerialGeometry.cxx @@ -20,11 +20,6 @@ // //============================================================================= -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include #include diff --git a/vtkm/cont/serial/testing/UnitTestSerialImplicitFunction.cxx b/vtkm/cont/serial/testing/UnitTestSerialImplicitFunction.cxx index 9b1ddfd59..dab23591c 100644 --- a/vtkm/cont/serial/testing/UnitTestSerialImplicitFunction.cxx +++ b/vtkm/cont/serial/testing/UnitTestSerialImplicitFunction.cxx @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include namespace diff --git a/vtkm/cont/serial/testing/UnitTestSerialPointLocatorUniformGrid.cxx b/vtkm/cont/serial/testing/UnitTestSerialPointLocatorUniformGrid.cxx index 56f903e7c..5e74653cc 100644 --- a/vtkm/cont/serial/testing/UnitTestSerialPointLocatorUniformGrid.cxx +++ b/vtkm/cont/serial/testing/UnitTestSerialPointLocatorUniformGrid.cxx @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include int UnitTestSerialPointLocatorUniformGrid(int argc, char* argv[]) diff --git a/vtkm/cont/serial/testing/UnitTestSerialVirtualObjectHandle.cxx b/vtkm/cont/serial/testing/UnitTestSerialVirtualObjectHandle.cxx index 46816108e..9c9fb8912 100644 --- a/vtkm/cont/serial/testing/UnitTestSerialVirtualObjectHandle.cxx +++ b/vtkm/cont/serial/testing/UnitTestSerialVirtualObjectHandle.cxx @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/tbb/testing/UnitTestTBBArrayHandle.cxx b/vtkm/cont/tbb/testing/UnitTestTBBArrayHandle.cxx index 948f0d37d..1ced9bd37 100644 --- a/vtkm/cont/tbb/testing/UnitTestTBBArrayHandle.cxx +++ b/vtkm/cont/tbb/testing/UnitTestTBBArrayHandle.cxx @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/tbb/testing/UnitTestTBBArrayHandleFancy.cxx b/vtkm/cont/tbb/testing/UnitTestTBBArrayHandleFancy.cxx index 718e9f92a..acec3c0bc 100644 --- a/vtkm/cont/tbb/testing/UnitTestTBBArrayHandleFancy.cxx +++ b/vtkm/cont/tbb/testing/UnitTestTBBArrayHandleFancy.cxx @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/tbb/testing/UnitTestTBBArrayHandleVirtualCoordinates.cxx b/vtkm/cont/tbb/testing/UnitTestTBBArrayHandleVirtualCoordinates.cxx index 30c0c8e4e..0766281cd 100644 --- a/vtkm/cont/tbb/testing/UnitTestTBBArrayHandleVirtualCoordinates.cxx +++ b/vtkm/cont/tbb/testing/UnitTestTBBArrayHandleVirtualCoordinates.cxx @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/tbb/testing/UnitTestTBBBitField.cxx b/vtkm/cont/tbb/testing/UnitTestTBBBitField.cxx index 3ba70b9c0..a6fe8740c 100644 --- a/vtkm/cont/tbb/testing/UnitTestTBBBitField.cxx +++ b/vtkm/cont/tbb/testing/UnitTestTBBBitField.cxx @@ -17,12 +17,6 @@ // Laboratory (LANL), the U.S. Government retains certain rights in // this software. //============================================================================ - -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/tbb/testing/UnitTestTBBCellLocatorRectilinearGrid.cxx b/vtkm/cont/tbb/testing/UnitTestTBBCellLocatorRectilinearGrid.cxx index cc4a11ee9..2b2c58eef 100644 --- a/vtkm/cont/tbb/testing/UnitTestTBBCellLocatorRectilinearGrid.cxx +++ b/vtkm/cont/tbb/testing/UnitTestTBBCellLocatorRectilinearGrid.cxx @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include int UnitTestTBBCellLocatorRectilinearGrid(int argc, char* argv[]) diff --git a/vtkm/cont/tbb/testing/UnitTestTBBCellLocatorUniformBins.cxx b/vtkm/cont/tbb/testing/UnitTestTBBCellLocatorUniformBins.cxx index 03b76756c..f4292b182 100644 --- a/vtkm/cont/tbb/testing/UnitTestTBBCellLocatorUniformBins.cxx +++ b/vtkm/cont/tbb/testing/UnitTestTBBCellLocatorUniformBins.cxx @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include int UnitTestTBBCellLocatorUniformBins(int argc, char* argv[]) diff --git a/vtkm/cont/tbb/testing/UnitTestTBBCellLocatorUniformGrid.cxx b/vtkm/cont/tbb/testing/UnitTestTBBCellLocatorUniformGrid.cxx index 8db2068b8..fc4a4e805 100644 --- a/vtkm/cont/tbb/testing/UnitTestTBBCellLocatorUniformGrid.cxx +++ b/vtkm/cont/tbb/testing/UnitTestTBBCellLocatorUniformGrid.cxx @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include int UnitTestTBBCellLocatorUniformGrid(int argc, char* argv[]) diff --git a/vtkm/cont/tbb/testing/UnitTestTBBColorTable.cxx b/vtkm/cont/tbb/testing/UnitTestTBBColorTable.cxx index aeab9d943..8be98e8e5 100644 --- a/vtkm/cont/tbb/testing/UnitTestTBBColorTable.cxx +++ b/vtkm/cont/tbb/testing/UnitTestTBBColorTable.cxx @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/tbb/testing/UnitTestTBBComputeRange.cxx b/vtkm/cont/tbb/testing/UnitTestTBBComputeRange.cxx index 59524fc62..ba408a198 100644 --- a/vtkm/cont/tbb/testing/UnitTestTBBComputeRange.cxx +++ b/vtkm/cont/tbb/testing/UnitTestTBBComputeRange.cxx @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/tbb/testing/UnitTestTBBDataSetExplicit.cxx b/vtkm/cont/tbb/testing/UnitTestTBBDataSetExplicit.cxx index 7646543bf..1b652c72f 100644 --- a/vtkm/cont/tbb/testing/UnitTestTBBDataSetExplicit.cxx +++ b/vtkm/cont/tbb/testing/UnitTestTBBDataSetExplicit.cxx @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/tbb/testing/UnitTestTBBDataSetSingleType.cxx b/vtkm/cont/tbb/testing/UnitTestTBBDataSetSingleType.cxx index 561fadd5a..b2bcefff0 100644 --- a/vtkm/cont/tbb/testing/UnitTestTBBDataSetSingleType.cxx +++ b/vtkm/cont/tbb/testing/UnitTestTBBDataSetSingleType.cxx @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/tbb/testing/UnitTestTBBDeviceAdapter.cxx b/vtkm/cont/tbb/testing/UnitTestTBBDeviceAdapter.cxx index 3ce674935..613bfda62 100644 --- a/vtkm/cont/tbb/testing/UnitTestTBBDeviceAdapter.cxx +++ b/vtkm/cont/tbb/testing/UnitTestTBBDeviceAdapter.cxx @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include #include diff --git a/vtkm/cont/tbb/testing/UnitTestTBBImplicitFunction.cxx b/vtkm/cont/tbb/testing/UnitTestTBBImplicitFunction.cxx index ddf8789f1..0365f03a8 100644 --- a/vtkm/cont/tbb/testing/UnitTestTBBImplicitFunction.cxx +++ b/vtkm/cont/tbb/testing/UnitTestTBBImplicitFunction.cxx @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include namespace diff --git a/vtkm/cont/tbb/testing/UnitTestTBBPointLocatorUniformGrid.cxx b/vtkm/cont/tbb/testing/UnitTestTBBPointLocatorUniformGrid.cxx index ee7dd9acb..c444c6875 100644 --- a/vtkm/cont/tbb/testing/UnitTestTBBPointLocatorUniformGrid.cxx +++ b/vtkm/cont/tbb/testing/UnitTestTBBPointLocatorUniformGrid.cxx @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include int UnitTestTBBPointLocatorUniformGrid(int argc, char* argv[]) diff --git a/vtkm/cont/tbb/testing/UnitTestTBBVirtualObjectHandle.cxx b/vtkm/cont/tbb/testing/UnitTestTBBVirtualObjectHandle.cxx index 93d8dc95a..d1bd8681d 100644 --- a/vtkm/cont/tbb/testing/UnitTestTBBVirtualObjectHandle.cxx +++ b/vtkm/cont/tbb/testing/UnitTestTBBVirtualObjectHandle.cxx @@ -18,11 +18,6 @@ // this software. //============================================================================ -// Make sure that the tested code is using the device adapter specified. This -// is important in the long run so we don't, for example, use the CUDA device -// for a part of an operation where the TBB device was specified. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/testing/UnitTestArrayHandleCartesianProduct.cxx b/vtkm/cont/testing/UnitTestArrayHandleCartesianProduct.cxx index 02ae9fb0b..93719ba42 100644 --- a/vtkm/cont/testing/UnitTestArrayHandleCartesianProduct.cxx +++ b/vtkm/cont/testing/UnitTestArrayHandleCartesianProduct.cxx @@ -32,8 +32,6 @@ namespace ArrayHandleCartesianProductNamespace { -using DFA = vtkm::cont::DeviceAdapterAlgorithm; - template void ArrayHandleCPBasic(vtkm::cont::ArrayHandle x, vtkm::cont::ArrayHandle y, diff --git a/vtkm/cont/testing/UnitTestArrayHandleCompositeVector.cxx b/vtkm/cont/testing/UnitTestArrayHandleCompositeVector.cxx index 3c218b897..b01ac3568 100644 --- a/vtkm/cont/testing/UnitTestArrayHandleCompositeVector.cxx +++ b/vtkm/cont/testing/UnitTestArrayHandleCompositeVector.cxx @@ -17,10 +17,6 @@ // Laboratory (LANL), the U.S. Government retains certain rights in // this software. //============================================================================ - -// Make sure ArrayHandleCompositeVector does not rely on default device adapter. -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/testing/UnitTestArrayHandleCounting.cxx b/vtkm/cont/testing/UnitTestArrayHandleCounting.cxx index 4276bf64d..4eb3883f7 100644 --- a/vtkm/cont/testing/UnitTestArrayHandleCounting.cxx +++ b/vtkm/cont/testing/UnitTestArrayHandleCounting.cxx @@ -17,9 +17,6 @@ // Laboratory (LANL), the U.S. Government retains certain rights in // this software. //============================================================================ - -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_SERIAL - #include #include diff --git a/vtkm/cont/testing/UnitTestArrayHandleExtractComponent.cxx b/vtkm/cont/testing/UnitTestArrayHandleExtractComponent.cxx index d49c52832..bbae76e98 100644 --- a/vtkm/cont/testing/UnitTestArrayHandleExtractComponent.cxx +++ b/vtkm/cont/testing/UnitTestArrayHandleExtractComponent.cxx @@ -44,7 +44,7 @@ struct ExtractComponentTests ReferenceComponentArray, ReferenceComponentArray>; - using DeviceTag = VTKM_DEFAULT_DEVICE_ADAPTER_TAG; + using DeviceTag = vtkm::cont::DeviceAdapterTagSerial; using Algo = vtkm::cont::DeviceAdapterAlgorithm; // This is used to build a ArrayHandleExtractComponent's internal array. diff --git a/vtkm/cont/testing/UnitTestArrayHandlePermutation.cxx b/vtkm/cont/testing/UnitTestArrayHandlePermutation.cxx index 78a9bacb4..51b2e3960 100644 --- a/vtkm/cont/testing/UnitTestArrayHandlePermutation.cxx +++ b/vtkm/cont/testing/UnitTestArrayHandlePermutation.cxx @@ -189,7 +189,7 @@ struct PermutationTests using ValueArrayType = vtkm::cont::ArrayHandle; using PermutationArrayType = vtkm::cont::ArrayHandlePermutation; - using Device = VTKM_DEFAULT_DEVICE_ADAPTER_TAG; + using Device = vtkm::cont::DeviceAdapterTagSerial; using Algorithm = vtkm::cont::DeviceAdapterAlgorithm; ValueArrayType MakeValueArray() const diff --git a/vtkm/cont/testing/UnitTestArrayHandleSwizzle.cxx b/vtkm/cont/testing/UnitTestArrayHandleSwizzle.cxx index c9ed3a807..588b62578 100644 --- a/vtkm/cont/testing/UnitTestArrayHandleSwizzle.cxx +++ b/vtkm/cont/testing/UnitTestArrayHandleSwizzle.cxx @@ -20,12 +20,11 @@ // //============================================================================= +#include #include #include #include #include -#include -#include #include @@ -51,8 +50,7 @@ struct SwizzleTests template using MapType = vtkm::Vec; - using DeviceTag = VTKM_DEFAULT_DEVICE_ADAPTER_TAG; - using Algo = vtkm::cont::DeviceAdapterAlgorithm; + using Algo = vtkm::cont::Algorithm; // This is used to build a ArrayHandleSwizzle's internal array. ReferenceArrayType RefArray; @@ -170,6 +168,19 @@ struct SwizzleTests void operator()(vtkm::Id index) const { this->Portal.Set(index, this->Portal.Get(index) * 2.); } }; + struct WriteExec + { + template + bool operator()(DeviceTag, SwizzleHandleType& swizzle) const + { + using Portal = typename SwizzleHandleType::template ExecutionTypes::Portal; + WriteTestFunctor functor(swizzle.PrepareForInPlace(DeviceTag())); + Algo::Schedule(functor, swizzle.GetNumberOfValues()); + return true; + } + }; + + template void WriteTest(const MapType& map) const { @@ -194,11 +205,7 @@ struct SwizzleTests SwizzleInputArrayType input = this->BuildSwizzleInputArray(); auto swizzle = vtkm::cont::make_ArrayHandleSwizzle(input, map); - using Portal = typename SwizzleArrayType::template ExecutionTypes::Portal; - - WriteTestFunctor functor(swizzle.PrepareForInPlace(DeviceTag())); - - Algo::Schedule(functor, swizzle.GetNumberOfValues()); + vtkm::cont::TryExecute(WriteExec{}, swizzle); this->ValidateWriteTestArray(input, map); } } @@ -234,6 +241,7 @@ struct SwizzleTests { this->SanityCheck(map); this->ReadTest(map); + this->WriteTest(map); } diff --git a/vtkm/cont/testing/UnitTestArrayHandleTransform.cxx b/vtkm/cont/testing/UnitTestArrayHandleTransform.cxx index a7cfebf91..f880a74dd 100644 --- a/vtkm/cont/testing/UnitTestArrayHandleTransform.cxx +++ b/vtkm/cont/testing/UnitTestArrayHandleTransform.cxx @@ -24,9 +24,9 @@ #include +#include #include #include -#include #include @@ -121,7 +121,7 @@ struct TransformTests using CountingTransformHandle = vtkm::cont::ArrayHandleTransform, MySquare>; - using Device = VTKM_DEFAULT_DEVICE_ADAPTER_TAG; + using Device = vtkm::cont::DeviceAdapterTagSerial; using Algorithm = vtkm::cont::DeviceAdapterAlgorithm; void operator()() const diff --git a/vtkm/cont/testing/UnitTestCellLocatorGeneral.cxx b/vtkm/cont/testing/UnitTestCellLocatorGeneral.cxx index 040f6174f..9fbd4749d 100644 --- a/vtkm/cont/testing/UnitTestCellLocatorGeneral.cxx +++ b/vtkm/cont/testing/UnitTestCellLocatorGeneral.cxx @@ -222,6 +222,6 @@ void TestCellLocatorGeneral() int UnitTestCellLocatorGeneral(int argc, char* argv[]) { - vtkm::cont::GetRuntimeDeviceTracker().ForceDevice(VTKM_DEFAULT_DEVICE_ADAPTER_TAG()); + vtkm::cont::GetRuntimeDeviceTracker().ForceDevice(vtkm::cont::DeviceAdapterTagSerial{}); return vtkm::cont::testing::Testing::Run(TestCellLocatorGeneral, argc, argv); } diff --git a/vtkm/cont/testing/UnitTestCellSetExplicit.cxx b/vtkm/cont/testing/UnitTestCellSetExplicit.cxx index 37054ef8c..f0688c625 100644 --- a/vtkm/cont/testing/UnitTestCellSetExplicit.cxx +++ b/vtkm/cont/testing/UnitTestCellSetExplicit.cxx @@ -175,7 +175,7 @@ void TestCellSetExplicit() "CellToPoint table exists before PrepareForInput."); // Test a raw PrepareForInput call: - cellset.PrepareForInput(VTKM_DEFAULT_DEVICE_ADAPTER_TAG{}, CellTag{}, PointTag{}); + cellset.PrepareForInput(vtkm::cont::DeviceAdapterTagSerial{}, CellTag{}, PointTag{}); VTKM_TEST_ASSERT(VTKM_PASS_COMMAS(cellset.HasConnectivity(CellTag{}, PointTag{})), "CellToPoint table missing after PrepareForInput."); diff --git a/vtkm/cont/testing/UnitTestCellSetPermutation.cxx b/vtkm/cont/testing/UnitTestCellSetPermutation.cxx index 3487d9bf8..3805a356f 100644 --- a/vtkm/cont/testing/UnitTestCellSetPermutation.cxx +++ b/vtkm/cont/testing/UnitTestCellSetPermutation.cxx @@ -19,9 +19,9 @@ //============================================================================ #include +#include #include #include -#include #include #include #include @@ -84,9 +84,7 @@ std::vector ComputeCellToPointExpected(const CellSetType& cellset, std::cout << "\n"; vtkm::cont::ArrayHandle indexOffsets; - vtkm::Id connectivityLength = - vtkm::cont::DeviceAdapterAlgorithm::ScanExclusive( - numIndices, indexOffsets); + vtkm::Id connectivityLength = vtkm::cont::Algorithm::ScanExclusive(numIndices, indexOffsets); vtkm::cont::ArrayHandle connectivity; connectivity.Allocate(connectivityLength); diff --git a/vtkm/cont/testing/UnitTestDataSetBuilderExplicit.cxx b/vtkm/cont/testing/UnitTestDataSetBuilderExplicit.cxx index e750f23f9..b8036f6d0 100644 --- a/vtkm/cont/testing/UnitTestDataSetBuilderExplicit.cxx +++ b/vtkm/cont/testing/UnitTestDataSetBuilderExplicit.cxx @@ -20,8 +20,8 @@ // //============================================================================= +#include #include -#include #include #include #include @@ -31,7 +31,7 @@ namespace DataSetBuilderExplicitNamespace { -using DFA = vtkm::cont::DeviceAdapterAlgorithm; +using DFA = vtkm::cont::Algorithm; template vtkm::Bounds ComputeBounds(std::size_t numPoints, const T* coords) diff --git a/vtkm/cont/testing/UnitTestDeviceAdapterAlgorithmDependency.cxx b/vtkm/cont/testing/UnitTestDeviceAdapterAlgorithmDependency.cxx index f3e182e54..56ae413ae 100644 --- a/vtkm/cont/testing/UnitTestDeviceAdapterAlgorithmDependency.cxx +++ b/vtkm/cont/testing/UnitTestDeviceAdapterAlgorithmDependency.cxx @@ -21,9 +21,6 @@ // This tests a previous problem where code templated on the device adapter and // used one of the device adapter algorithms (for example, the dispatcher) had // to be declared after any device adapter it was ever used with. - -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/cont/testing/UnitTestDeviceAdapterAlgorithmGeneral.cxx b/vtkm/cont/testing/UnitTestDeviceAdapterAlgorithmGeneral.cxx index 5415adbd9..5d23f20bd 100644 --- a/vtkm/cont/testing/UnitTestDeviceAdapterAlgorithmGeneral.cxx +++ b/vtkm/cont/testing/UnitTestDeviceAdapterAlgorithmGeneral.cxx @@ -25,9 +25,6 @@ // everything else. Because this test is based of the serial device adapter, // make sure that UnitTestDeviceAdapterSerial is working before trying to debug // this one. - -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include #include diff --git a/vtkm/cont/testing/UnitTestTryExecute.cxx b/vtkm/cont/testing/UnitTestTryExecute.cxx index e360debce..9616ce427 100644 --- a/vtkm/cont/testing/UnitTestTryExecute.cxx +++ b/vtkm/cont/testing/UnitTestTryExecute.cxx @@ -17,9 +17,6 @@ // Laboratory (LANL), the U.S. Government retains certain rights in // this software. //============================================================================ - -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include #include diff --git a/vtkm/exec/openmp/internal/testing/UnitTestTaskTilingOpenMP.cxx b/vtkm/exec/openmp/internal/testing/UnitTestTaskTilingOpenMP.cxx index 311b712be..c9b12e742 100644 --- a/vtkm/exec/openmp/internal/testing/UnitTestTaskTilingOpenMP.cxx +++ b/vtkm/exec/openmp/internal/testing/UnitTestTaskTilingOpenMP.cxx @@ -17,9 +17,6 @@ // Laboratory (LANL), the U.S. Government retains certain rights in // this software. //============================================================================ - -#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR - #include #include diff --git a/vtkm/filter/testing/UnitTestSplitSharpEdgesFilter.cxx b/vtkm/filter/testing/UnitTestSplitSharpEdgesFilter.cxx index 927d4b010..fe8c76fe8 100644 --- a/vtkm/filter/testing/UnitTestSplitSharpEdgesFilter.cxx +++ b/vtkm/filter/testing/UnitTestSplitSharpEdgesFilter.cxx @@ -28,7 +28,6 @@ namespace { using NormalsArrayHandle = vtkm::cont::ArrayHandle>; -using DeviceAdapter = VTKM_DEFAULT_DEVICE_ADAPTER_TAG; const vtkm::Vec expectedCoords[24] = { { 0.0, 0.0, 0.0 }, { 1.0, 0.0, 0.0 }, { 1.0, 0.0, 1.0 }, { 0.0, 0.0, 1.0 }, { 0.0, 1.0, 0.0 }, diff --git a/vtkm/rendering/raytracing/Camera.cxx b/vtkm/rendering/raytracing/Camera.cxx index 4a4341307..bf5e72911 100644 --- a/vtkm/rendering/raytracing/Camera.cxx +++ b/vtkm/rendering/raytracing/Camera.cxx @@ -1002,7 +1002,7 @@ VTKM_CONT void Camera::UpdateDimensions(Ray& rays, if (rays.NumRays != SubsetWidth * SubsetHeight) { RayOperations::Resize( - rays, this->SubsetHeight * this->SubsetWidth, VTKM_DEFAULT_DEVICE_ADAPTER_TAG()); + rays, this->SubsetHeight * this->SubsetWidth, vtkm::cont::DeviceAdapterTagSerial()); } } diff --git a/vtkm/rendering/testing/glut/UnitTestMapperGLUT.cxx b/vtkm/rendering/testing/glut/UnitTestMapperGLUT.cxx index 3735fda5f..b4c7a2466 100644 --- a/vtkm/rendering/testing/glut/UnitTestMapperGLUT.cxx +++ b/vtkm/rendering/testing/glut/UnitTestMapperGLUT.cxx @@ -60,7 +60,7 @@ static void displayCall() vtkm::cont::testing::MakeTestDataSet maker; vtkm::cont::ColorTable colorTable("inferno"); - using M = vtkm::rendering::MapperGL; + using M = vtkm::rendering::MapperGL; using C = vtkm::rendering::CanvasGL; using V3 = vtkm::rendering::View3D; using V2 = vtkm::rendering::View2D; diff --git a/vtkm/worklet/StreamLineUniformGrid.h b/vtkm/worklet/StreamLineUniformGrid.h index fe063469e..6afa1626e 100644 --- a/vtkm/worklet/StreamLineUniformGrid.h +++ b/vtkm/worklet/StreamLineUniformGrid.h @@ -30,21 +30,18 @@ #include #include -#include +#include #include #include namespace vtkm { - -// Take this out when defined in CellShape.h -const vtkm::UInt8 CELL_SHAPE_POLY_LINE = 4; - namespace worklet { - -namespace internal +namespace streamline { +// Take this out when defined in CellShape.h +const vtkm::UInt8 CELL_SHAPE_POLY_LINE = 4; enum StreamLineMode { @@ -140,203 +137,194 @@ VTKM_EXEC vtkm::Vec VecDataAtPos(vtkm::Vec pos, v[2] = (1.0f - a) * v0[2] + v1[2]; return v; } -} + +struct IsUnity +{ + template + VTKM_EXEC_CONT bool operator()(const T& x) const + { + return x == T(1); + } +}; + +template +class MakeStreamLines : public vtkm::worklet::WorkletMapField +{ +public: + using ControlSignature = void(WholeArrayIn field, + FieldIn seedId, + FieldIn position, + WholeArrayOut numIndices, + WholeArrayOut validPoint, + WholeArrayOut streamLines); + using ExecutionSignature = void(_1, _2, _3, _4, _5, _6, VisitIndex); + using InputDomain = _2; + + using ScatterType = vtkm::worklet::ScatterUniform<2>; + + const vtkm::Id3 vdims; + const vtkm::Id maxsteps; + const FieldType timestep; + const vtkm::Id planesize; + const vtkm::Id rowsize; + const vtkm::Id streammode; + + VTKM_CONT + MakeStreamLines() {} + + VTKM_CONT + MakeStreamLines(const FieldType tStep, + const vtkm::Id sMode, + const vtkm::Id nSteps, + const vtkm::Id3 dims) + : vdims(dims) + , maxsteps(nSteps) + , timestep(tStep) + , planesize(dims[0] * dims[1]) + , rowsize(dims[0]) + , streammode(sMode) + { + } + + template + VTKM_EXEC void operator()(const FieldPortalType& field, + vtkm::Id& seedId, + vtkm::Vec& seedPos, + IdComponentPortalType& numIndices, + IdComponentPortalType& validPoint, + FieldVec3PortalType& slLists, + vtkm::IdComponent visitIndex) const + { + // Set initial offset into the output streams array + vtkm::Vec pos = seedPos; + vtkm::Vec pre_pos = seedPos; + + // Forward tracing + if (visitIndex == 0 && (streammode == FORWARD || streammode == BOTH)) + { + vtkm::Id index = (seedId * 2) * maxsteps; + bool done = false; + vtkm::Id step = 0; + validPoint.Set(index, 1); + slLists.Set(index++, pos); + + while (done != true && step < maxsteps) + { + vtkm::Vec vdata, adata, bdata, cdata, ddata; + vdata = VecDataAtPos(pos, vdims, planesize, rowsize, field); + for (vtkm::IdComponent d = 0; d < 3; d++) + { + adata[d] = timestep * vdata[d]; + pos[d] += adata[d] / 2.0f; + } + + vdata = VecDataAtPos(pos, vdims, planesize, rowsize, field); + for (vtkm::IdComponent d = 0; d < 3; d++) + { + bdata[d] = timestep * vdata[d]; + pos[d] += bdata[d] / 2.0f; + } + + vdata = VecDataAtPos(pos, vdims, planesize, rowsize, field); + for (vtkm::IdComponent d = 0; d < 3; d++) + { + cdata[d] = timestep * vdata[d]; + pos[d] += cdata[d] / 2.0f; + } + + vdata = VecDataAtPos(pos, vdims, planesize, rowsize, field); + for (vtkm::IdComponent d = 0; d < 3; d++) + { + ddata[d] = timestep * vdata[d]; + pos[d] += (adata[d] + (2.0f * bdata[d]) + (2.0f * cdata[d]) + ddata[d]) / 6.0f; + } + + if (pos[0] < 0.0f || pos[0] > static_cast(vdims[0]) || pos[1] < 0.0f || + pos[1] > static_cast(vdims[1]) || pos[2] < 0.0f || + pos[2] > static_cast(vdims[2])) + { + pos = pre_pos; + done = true; + } + else + { + validPoint.Set(index, 1); + slLists.Set(index++, pos); + pre_pos = pos; + } + step++; + } + numIndices.Set(seedId * 2, static_cast(step)); + } + + // Backward tracing + if (visitIndex == 1 && (streammode == BACKWARD || streammode == BOTH)) + { + vtkm::Id index = (seedId * 2 + 1) * maxsteps; + bool done = false; + vtkm::Id step = 0; + validPoint.Set(index, 1); + slLists.Set(index++, pos); + + while (done != true && step < maxsteps) + { + vtkm::Vec vdata, adata, bdata, cdata, ddata; + vdata = VecDataAtPos(pos, vdims, planesize, rowsize, field); + for (vtkm::IdComponent d = 0; d < 3; d++) + { + adata[d] = timestep * (0.0f - vdata[d]); + pos[d] += adata[d] / 2.0f; + } + + vdata = VecDataAtPos(pos, vdims, planesize, rowsize, field); + for (vtkm::IdComponent d = 0; d < 3; d++) + { + bdata[d] = timestep * (0.0f - vdata[d]); + pos[d] += bdata[d] / 2.0f; + } + + vdata = VecDataAtPos(pos, vdims, planesize, rowsize, field); + for (vtkm::IdComponent d = 0; d < 3; d++) + { + cdata[d] = timestep * (0.0f - vdata[d]); + pos[d] += cdata[d] / 2.0f; + } + + vdata = VecDataAtPos(pos, vdims, planesize, rowsize, field); + for (vtkm::IdComponent d = 0; d < 3; d++) + { + ddata[d] = timestep * (0.0f - vdata[d]); + pos[d] += (adata[d] + (2.0f * bdata[d]) + (2.0f * cdata[d]) + ddata[d]) / 6.0f; + } + + if (pos[0] < 0.0f || pos[0] > static_cast(vdims[0]) || pos[1] < 0.0f || + pos[1] > static_cast(vdims[1]) || pos[2] < 0.0f || + pos[2] > static_cast(vdims[2])) + { + pos = pre_pos; + done = true; + } + else + { + validPoint.Set(index, 1); + slLists.Set(index++, pos); + pre_pos = pos; + } + step++; + } + numIndices.Set((seedId * 2) + 1, static_cast(step)); + } + } +}; + + +} // namespace streamline /// \brief Compute the streamline -template +template class StreamLineFilterUniformGrid { public: - struct IsUnity - { - template - VTKM_EXEC_CONT bool operator()(const T& x) const - { - return x == T(1); - } - }; - - using FieldHandle = vtkm::cont::ArrayHandle>; - using FieldPortalConstType = - typename FieldHandle::template ExecutionTypes::PortalConst; - - class MakeStreamLines : public vtkm::worklet::WorkletMapField - { - public: - using ControlSignature = void(FieldIn seedId, - FieldIn position, - WholeArrayOut numIndices, - WholeArrayOut validPoint, - WholeArrayOut streamLines); - using ExecutionSignature = void(_1, _2, _3, _4, _5, VisitIndex); - using InputDomain = _1; - - using ScatterType = vtkm::worklet::ScatterUniform<2>; - - FieldPortalConstType field; - const vtkm::Id3 vdims; - const vtkm::Id maxsteps; - const FieldType timestep; - const vtkm::Id planesize; - const vtkm::Id rowsize; - const vtkm::Id streammode; - - VTKM_CONT - MakeStreamLines(const FieldType tStep, - const vtkm::Id sMode, - const vtkm::Id nSteps, - const vtkm::Id3 dims, - FieldPortalConstType fieldArray) - : field(fieldArray) - , vdims(dims) - , maxsteps(nSteps) - , timestep(tStep) - , planesize(dims[0] * dims[1]) - , rowsize(dims[0]) - , streammode(sMode) - { - } - - template - VTKM_EXEC void operator()(vtkm::Id& seedId, - vtkm::Vec& seedPos, - IdComponentPortalType& numIndices, - IdComponentPortalType& validPoint, - FieldVec3PortalType& slLists, - vtkm::IdComponent visitIndex) const - { - // Set initial offset into the output streams array - vtkm::Vec pos = seedPos; - vtkm::Vec pre_pos = seedPos; - - // Forward tracing - if (visitIndex == 0 && (streammode == vtkm::worklet::internal::FORWARD || - streammode == vtkm::worklet::internal::BOTH)) - { - vtkm::Id index = (seedId * 2) * maxsteps; - bool done = false; - vtkm::Id step = 0; - validPoint.Set(index, 1); - slLists.Set(index++, pos); - - while (done != true && step < maxsteps) - { - vtkm::Vec vdata, adata, bdata, cdata, ddata; - vdata = internal::VecDataAtPos( - pos, vdims, planesize, rowsize, field); - for (vtkm::IdComponent d = 0; d < 3; d++) - { - adata[d] = timestep * vdata[d]; - pos[d] += adata[d] / 2.0f; - } - - vdata = internal::VecDataAtPos( - pos, vdims, planesize, rowsize, field); - for (vtkm::IdComponent d = 0; d < 3; d++) - { - bdata[d] = timestep * vdata[d]; - pos[d] += bdata[d] / 2.0f; - } - - vdata = internal::VecDataAtPos( - pos, vdims, planesize, rowsize, field); - for (vtkm::IdComponent d = 0; d < 3; d++) - { - cdata[d] = timestep * vdata[d]; - pos[d] += cdata[d] / 2.0f; - } - - vdata = internal::VecDataAtPos( - pos, vdims, planesize, rowsize, field); - for (vtkm::IdComponent d = 0; d < 3; d++) - { - ddata[d] = timestep * vdata[d]; - pos[d] += (adata[d] + (2.0f * bdata[d]) + (2.0f * cdata[d]) + ddata[d]) / 6.0f; - } - - if (pos[0] < 0.0f || pos[0] > static_cast(vdims[0]) || pos[1] < 0.0f || - pos[1] > static_cast(vdims[1]) || pos[2] < 0.0f || - pos[2] > static_cast(vdims[2])) - { - pos = pre_pos; - done = true; - } - else - { - validPoint.Set(index, 1); - slLists.Set(index++, pos); - pre_pos = pos; - } - step++; - } - numIndices.Set(seedId * 2, static_cast(step)); - } - - // Backward tracing - if (visitIndex == 1 && (streammode == vtkm::worklet::internal::BACKWARD || - streammode == vtkm::worklet::internal::BOTH)) - { - vtkm::Id index = (seedId * 2 + 1) * maxsteps; - bool done = false; - vtkm::Id step = 0; - validPoint.Set(index, 1); - slLists.Set(index++, pos); - - while (done != true && step < maxsteps) - { - vtkm::Vec vdata, adata, bdata, cdata, ddata; - vdata = internal::VecDataAtPos( - pos, vdims, planesize, rowsize, field); - for (vtkm::IdComponent d = 0; d < 3; d++) - { - adata[d] = timestep * (0.0f - vdata[d]); - pos[d] += adata[d] / 2.0f; - } - - vdata = internal::VecDataAtPos( - pos, vdims, planesize, rowsize, field); - for (vtkm::IdComponent d = 0; d < 3; d++) - { - bdata[d] = timestep * (0.0f - vdata[d]); - pos[d] += bdata[d] / 2.0f; - } - - vdata = internal::VecDataAtPos( - pos, vdims, planesize, rowsize, field); - for (vtkm::IdComponent d = 0; d < 3; d++) - { - cdata[d] = timestep * (0.0f - vdata[d]); - pos[d] += cdata[d] / 2.0f; - } - - vdata = internal::VecDataAtPos( - pos, vdims, planesize, rowsize, field); - for (vtkm::IdComponent d = 0; d < 3; d++) - { - ddata[d] = timestep * (0.0f - vdata[d]); - pos[d] += (adata[d] + (2.0f * bdata[d]) + (2.0f * cdata[d]) + ddata[d]) / 6.0f; - } - - if (pos[0] < 0.0f || pos[0] > static_cast(vdims[0]) || pos[1] < 0.0f || - pos[1] > static_cast(vdims[1]) || pos[2] < 0.0f || - pos[2] > static_cast(vdims[2])) - { - pos = pre_pos; - done = true; - } - else - { - validPoint.Set(index, 1); - slLists.Set(index++, pos); - pre_pos = pos; - } - step++; - } - numIndices.Set((seedId * 2) + 1, static_cast(step)); - } - } - }; - StreamLineFilterUniformGrid() {} vtkm::cont::DataSet Run(const vtkm::cont::DataSet& InDataSet, @@ -345,7 +333,7 @@ public: vtkm::Id maxSteps, FieldType timeStep) { - using DeviceAlgorithm = vtkm::cont::Algorithm; + using Algorithm = vtkm::cont::Algorithm; // Get information from input dataset vtkm::cont::CellSetStructured<3> inCellSet; @@ -384,36 +372,34 @@ public: // All cells are polylines vtkm::cont::ArrayHandle cellTypes; cellTypes.Allocate(numCells); - vtkm::cont::ArrayHandleConstant polyLineShape(vtkm::CELL_SHAPE_POLY_LINE, + vtkm::cont::ArrayHandleConstant polyLineShape(streamline::CELL_SHAPE_POLY_LINE, numCells); - DeviceAlgorithm::Copy(polyLineShape, cellTypes); + Algorithm::Copy(polyLineShape, cellTypes); // Possible maxSteps points but if less use stencil vtkm::cont::ArrayHandle validPoint; vtkm::cont::ArrayHandleConstant zeros(0, maxConnectivityLen); validPoint.Allocate(maxConnectivityLen); - DeviceAlgorithm::Copy(zeros, validPoint); + Algorithm::Copy(zeros, validPoint); // Worklet to make the streamlines - MakeStreamLines makeStreamLines( - timeStep, streamMode, maxSteps, vdims, fieldArray.PrepareForInput(DeviceAdapter())); - using MakeStreamLinesDispatcher = vtkm::worklet::DispatcherMapField; - MakeStreamLinesDispatcher makeStreamLinesDispatcher(makeStreamLines); - makeStreamLinesDispatcher.Invoke( - seedIdArray, seedPosArray, numIndices, validPoint, streamArray); + streamline::MakeStreamLines makeStreamLines(timeStep, streamMode, maxSteps, vdims); + + vtkm::worklet::Invoker{}( + makeStreamLines, fieldArray, seedIdArray, seedPosArray, numIndices, validPoint, streamArray); // Size of connectivity based on size of returned streamlines vtkm::cont::ArrayHandle numIndicesOut; - vtkm::IdComponent connectivityLen = DeviceAlgorithm::ScanExclusive(numIndices, numIndicesOut); + vtkm::IdComponent connectivityLen = Algorithm::ScanExclusive(numIndices, numIndicesOut); // Connectivity is sequential vtkm::cont::ArrayHandleCounting connCount(0, 1, connectivityLen); vtkm::cont::ArrayHandle connectivity; - DeviceAlgorithm::Copy(connCount, connectivity); + Algorithm::Copy(connCount, connectivity); // Compact the stream array so it only has valid points vtkm::cont::ArrayHandle> coordinates; - DeviceAlgorithm::CopyIf(streamArray, validPoint, coordinates, IsUnity()); + Algorithm::CopyIf(streamArray, validPoint, coordinates, streamline::IsUnity()); // Create the output data set vtkm::cont::DataSet OutDataSet; diff --git a/vtkm/worklet/testing/UnitTestExternalFaces.cxx b/vtkm/worklet/testing/UnitTestExternalFaces.cxx index 40733d18e..0f474a31b 100644 --- a/vtkm/worklet/testing/UnitTestExternalFaces.cxx +++ b/vtkm/worklet/testing/UnitTestExternalFaces.cxx @@ -36,12 +36,6 @@ namespace { -// For this test, we want using the default device adapter to be an error -// to make sure that all the code is using the device adapter we specify. -using MyDeviceAdapter = VTKM_DEFAULT_DEVICE_ADAPTER_TAG; -#undef VTKM_DEFAULT_DEVICE_ADAPTER_TAG -#define VTKM_DEFAULT_DEVICE_ADAPTER_TAG ::vtkm::cont::DeviceAdapterTagError - vtkm::cont::DataSet RunExternalFaces(vtkm::cont::DataSet& inDataSet) { const vtkm::cont::DynamicCellSet& inCellSet = inDataSet.GetCellSet(0); @@ -201,8 +195,6 @@ void TestExternalFaces3() void TestExternalFaces() { - // Ignore the device passed in. - vtkm::cont::GetRuntimeDeviceTracker().ForceDevice(MyDeviceAdapter()); TestExternalFaces1(); TestExternalFaces2(); TestExternalFaces3(); diff --git a/vtkm/worklet/testing/UnitTestStreamLineUniformGrid.cxx b/vtkm/worklet/testing/UnitTestStreamLineUniformGrid.cxx index 04388e6ce..dbc09445a 100644 --- a/vtkm/worklet/testing/UnitTestStreamLineUniformGrid.cxx +++ b/vtkm/worklet/testing/UnitTestStreamLineUniformGrid.cxx @@ -23,12 +23,6 @@ #include #include -#include -#include -#ifdef VTKM_ENABLE_CUDA -#include -#endif - #include #include #include @@ -115,27 +109,6 @@ float data[125 * 3] = { }; } -namespace detail -{ - -struct StreamLineFilterUniformGridFunctor -{ - vtkm::cont::DataSet OutDataSet; - template - bool operator()(DeviceAdapter, - const vtkm::cont::DataSet& inDataSet, - vtkm::Id streamMode, - vtkm::Id numSeeds, - vtkm::Id maxSteps, - FieldType timeStep) - { - vtkm::worklet::StreamLineFilterUniformGrid streamLineFilter; - OutDataSet = streamLineFilter.Run(inDataSet, streamMode, numSeeds, maxSteps, timeStep); - return true; - } -}; -} - void TestStreamLineUniformGrid() { std::cout << "Testing StreamLineUniformGrid Filter" << std::endl; @@ -175,14 +148,14 @@ void TestStreamLineUniformGrid() inDataSet.AddCellSet(inCellSet); // Create and run the filter - detail::StreamLineFilterUniformGridFunctor smfuFunctor; - vtkm::cont::TryExecute( - smfuFunctor, inDataSet, vtkm::worklet::internal::BOTH, numSeeds, maxSteps, timeStep); + vtkm::worklet::StreamLineFilterUniformGrid streamLines; + auto outDataSet = + streamLines.Run(inDataSet, vtkm::worklet::streamline::BOTH, numSeeds, maxSteps, timeStep); // Check output vtkm::cont::CellSetExplicit<> outCellSet; - smfuFunctor.OutDataSet.GetCellSet(0).CopyTo(outCellSet); - auto coordArray = smfuFunctor.OutDataSet.GetCoordinateSystem(0).GetData(); + outDataSet.GetCellSet(0).CopyTo(outCellSet); + auto coordArray = outDataSet.GetCoordinateSystem(0).GetData(); vtkm::Id numberOfCells = outCellSet.GetNumberOfCells(); vtkm::Id numberOfPoints = coordArray.GetNumberOfValues();