Commit 6ea55f83 authored by Kenneth Moreland's avatar Kenneth Moreland Committed by Kitware Robot

Merge topic 'vtkm_worklet-library'

55570a16 Add most common implementations of Keys templates to library
887f79c6 Make a vtkm_worklet library
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard's avatarRobert Maynard <robert.maynard@kitware.com>
Merge-request: !1520
parents 774957e8 55570a16
......@@ -69,7 +69,7 @@ set(benchmarks
)
foreach (benchmark ${benchmarks})
add_benchmark(${benchmark} ${benchmark}.cxx vtkm_cont)
add_benchmark(${benchmark} ${benchmark}.cxx vtkm_filter)
endforeach ()
if(TARGET vtkm_rendering)
......
......@@ -28,13 +28,13 @@ 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_cont)
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_cont)
target_link_libraries(Clipping_TBB PRIVATE vtkm_filter)
endif()
if(TARGET vtkm::cuda)
......@@ -43,5 +43,5 @@ if(TARGET vtkm::cuda)
target_compile_definitions(Clipping_CUDA PRIVATE
"VTKM_DEVICE_ADAPTER=VTKM_DEVICE_ADAPTER_CUDA")
target_link_libraries(Clipping_CUDA PRIVATE vtkm_cont)
target_link_libraries(Clipping_CUDA PRIVATE vtkm_filter)
endif()
......@@ -26,10 +26,10 @@ project(ContourTree CXX)
find_package(VTKm REQUIRED QUIET)
add_executable(ContourTreeMesh2D_SERIAL ContourTreeMesh2D.cxx)
target_link_libraries(ContourTreeMesh2D_SERIAL vtkm_cont)
target_link_libraries(ContourTreeMesh2D_SERIAL vtkm_filter)
add_executable(ContourTreeMesh3D_SERIAL ContourTreeMesh3D.cxx)
target_link_libraries(ContourTreeMesh3D_SERIAL vtkm_cont)
target_link_libraries(ContourTreeMesh3D_SERIAL vtkm_filter)
target_compile_definitions(ContourTreeMesh2D_SERIAL PRIVATE
"VTKM_DEVICE_ADAPTER=VTKM_DEVICE_ADAPTER_SERIAL")
......@@ -43,8 +43,8 @@ if(TARGET vtkm::cuda)
vtkm_compile_as_cuda(cudaSource ContourTreeMesh3D.cxx)
add_executable(ContourTreeMesh3D_CUDA ${cudaSource})
target_link_libraries(ContourTreeMesh2D_CUDA vtkm_cont)
target_link_libraries(ContourTreeMesh3D_CUDA vtkm_cont)
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")
......@@ -56,8 +56,8 @@ if(TARGET vtkm::tbb)
add_executable(ContourTreeMesh2D_TBB ContourTreeMesh2D.cxx)
add_executable(ContourTreeMesh3D_TBB ContourTreeMesh3D.cxx)
target_link_libraries(ContourTreeMesh2D_TBB vtkm_cont)
target_link_libraries(ContourTreeMesh3D_TBB vtkm_cont)
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")
......
......@@ -77,7 +77,7 @@ find_package(VTKm REQUIRED QUIET)
####################################
# Serial 2D / 3D / MC
add_executable(ContourTree_PPP2_SERIAL ContourTreeApp.cxx)
target_link_libraries(ContourTree_PPP2_SERIAL vtkm_cont)
target_link_libraries(ContourTree_PPP2_SERIAL vtkm_filter)
target_compile_definitions(ContourTree_PPP2_SERIAL PRIVATE
"VTKM_DEVICE_ADAPTER=VTKM_DEVICE_ADAPTER_SERIAL")
......@@ -88,7 +88,7 @@ target_compile_definitions(ContourTree_PPP2_SERIAL PRIVATE
# Debug Serial 2D / 3D / MC
add_executable(ContourTree_PPP2_SERIAL_DEBUG ContourTreeApp.cxx)
target_link_libraries(ContourTree_PPP2_SERIAL_DEBUG vtkm_cont)
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")
......@@ -96,13 +96,13 @@ target_compile_definitions(ContourTree_PPP2_SERIAL_DEBUG PRIVATE
if(TARGET vtkm::tbb)
# TBB 2D/3D/MC
add_executable(ContourTree_PPP2_TBB ContourTreeApp.cxx)
target_link_libraries(ContourTree_PPP2_TBB vtkm_cont)
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_cont)
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")
......@@ -112,14 +112,14 @@ 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_cont)
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_cont)
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")
endif()
......@@ -36,5 +36,5 @@ else()
add_executable(CosmoHaloFinder CosmoHaloFinder.cxx)
endif()
target_link_libraries(CosmoCenterFinder PRIVATE vtkm_cont)
target_link_libraries(CosmoHaloFinder PRIVATE vtkm_cont)
target_link_libraries(CosmoCenterFinder PRIVATE vtkm_filter)
target_link_libraries(CosmoHaloFinder PRIVATE vtkm_filter)
......@@ -35,5 +35,5 @@ if(TARGET OpenGL::GL AND
add_executable(GameOfLife GameOfLife.cxx LoadShaders.h)
endif()
target_link_libraries(GameOfLife PRIVATE vtkm_cont OpenGL::GL GLEW::GLEW GLUT::GLUT)
target_link_libraries(GameOfLife PRIVATE vtkm_filter OpenGL::GL GLEW::GLEW GLUT::GLUT)
endif()
......@@ -37,6 +37,6 @@ if(TARGET OpenGL::GL AND
else()
add_executable(HelloWorld HelloWorld.cxx LoadShaders.h)
endif()
target_link_libraries(HelloWorld PRIVATE vtkm_cont ${gl_libs})
target_link_libraries(HelloWorld PRIVATE vtkm_filter ${gl_libs})
endif()
......@@ -28,13 +28,13 @@ 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_cont)
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_cont)
target_link_libraries(Histogram_TBB PRIVATE vtkm_filter)
endif()
if(TARGET vtkm::cuda)
......@@ -43,6 +43,6 @@ if (VTKm_ENABLE_MPI)
target_compile_definitions(Histogram_CUDA PRIVATE
"VTKM_DEVICE_ADAPTER=VTKM_DEVICE_ADAPTER_CUDA")
target_link_libraries(Histogram_CUDA PRIVATE vtkm_cont)
target_link_libraries(Histogram_CUDA PRIVATE vtkm_filter)
endif()
endif()
......@@ -34,16 +34,16 @@ if(TARGET OpenGL::GL AND
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_cont ${gl_libs})
target_link_libraries(IsosurfaceUniformGrid_SERIAL PRIVATE vtkm_filter ${gl_libs})
if(TARGET vtkm::cuda)
add_executable(IsosurfaceUniformGrid_CUDA IsosurfaceUniformGrid.cu quaternion.h)
target_link_libraries(IsosurfaceUniformGrid_CUDA PRIVATE vtkm_cont ${gl_libs})
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_cont ${gl_libs})
target_link_libraries(IsosurfaceUniformGrid_TBB PRIVATE vtkm_filter ${gl_libs})
endif()
endif()
......@@ -25,5 +25,5 @@ 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_cont)
target_link_libraries(Lagrangian_SERIAL PRIVATE vtkm_filter)
target_link_libraries(Lagrangian_SERIAL ${VTKm_LIBRARIES})
......@@ -47,4 +47,4 @@ if(TARGET vtkm::cuda)
endif()
add_executable(MultiBackend ${device_srcs} ${srcs} ${headers})
target_link_libraries(MultiBackend PRIVATE vtkm_cont Threads::Threads)
target_link_libraries(MultiBackend PRIVATE vtkm_filter Threads::Threads)
......@@ -28,13 +28,13 @@ 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_cont)
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_cont)
target_link_libraries(Oscillator_TBB PRIVATE vtkm_filter)
endif()
if (TARGET vtkm::cuda)
......@@ -42,5 +42,5 @@ if (TARGET vtkm::cuda)
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_cont)
target_link_libraries(Oscillator_CUDA PRIVATE vtkm_filter)
endif()
......@@ -26,14 +26,14 @@ project(ParticleAdvection CXX)
find_package(VTKm REQUIRED QUIET)
add_executable(Particle_Advection_SERIAL ParticleAdvection.cxx)
target_link_libraries(Particle_Advection_SERIAL PRIVATE vtkm_cont)
target_link_libraries(Particle_Advection_SERIAL PRIVATE vtkm_filter)
if(TARGET vtkm::tbb)
add_executable(Particle_Advection_TBB ParticleAdvectionTBB.cxx)
target_link_libraries(Particle_Advection_TBB PRIVATE vtkm_cont)
target_link_libraries(Particle_Advection_TBB PRIVATE vtkm_filter)
endif()
if(TARGET vtkm::cuda)
add_executable(Particle_Advection_CUDA ParticleAdvection.cu)
target_link_libraries(Particle_Advection_CUDA PRIVATE vtkm_cont)
target_link_libraries(Particle_Advection_CUDA PRIVATE vtkm_filter)
endif()
......@@ -27,13 +27,13 @@ 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_cont)
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_cont)
target_link_libraries(RedistributePoints_TBB PRIVATE vtkm_filter)
endif()
if(TARGET vtkm::cuda)
......@@ -42,5 +42,5 @@ if(TARGET vtkm::cuda)
target_compile_definitions(RedistributePoints_CUDA PRIVATE
"VTKM_DEVICE_ADAPTER=VTKM_DEVICE_ADAPTER_CUDA")
target_link_libraries(RedistributePoints_CUDA PRIVATE vtkm_cont)
target_link_libraries(RedistributePoints_CUDA PRIVATE vtkm_filter)
endif()
......@@ -33,16 +33,16 @@ 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_cont ${gl_libs})
target_link_libraries(StreamLineUniformGrid_SERIAL PRIVATE vtkm_filter ${gl_libs})
if(TARGET vtkm::cont)
add_executable(StreamLineUniformGrid_CUDA StreamLineUniformGrid.cu)
target_link_libraries(StreamLineUniformGrid_CUDA PRIVATE vtkm_cont ${gl_libs})
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_cont ${gl_libs})
target_link_libraries(StreamLineUniformGrid_TBB PRIVATE vtkm_filter ${gl_libs})
endif()
endif()
......@@ -28,14 +28,14 @@ project(TemporalAdvection CXX)
find_package(VTKm REQUIRED QUIET)
add_executable(Temporal_Advection_SERIAL TemporalAdvection.cxx)
target_link_libraries(Temporal_Advection_SERIAL PRIVATE vtkm_cont)
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_cont)
target_link_libraries(Temporal_Advection_TBB PRIVATE vtkm_filter)
endif()
if(TARGET vtkm::cuda)
add_executable(Temporal_Advection_CUDA TemporalAdvection.cu)
target_link_libraries(Temporal_Advection_CUDA PRIVATE vtkm_cont)
target_link_libraries(Temporal_Advection_CUDA PRIVATE vtkm_filter)
endif()
......@@ -37,10 +37,10 @@ if(TARGET OpenGL::GL AND
add_executable(TetrahedralizeUniformGrid_SERIAL TetrahedralizeUniformGrid.cxx)
add_executable(TriangulateUniformGrid_SERIAL TriangulateUniformGrid.cxx)
target_link_libraries(TetrahedralizeExplicitGrid_SERIAL PRIVATE vtkm_cont ${gl_libs})
target_link_libraries(TriangulateExplicitGrid_SERIAL PRIVATE vtkm_cont ${gl_libs})
target_link_libraries(TetrahedralizeUniformGrid_SERIAL PRIVATE vtkm_cont ${gl_libs})
target_link_libraries(TriangulateUniformGrid_SERIAL PRIVATE vtkm_cont ${gl_libs})
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})
if(TARGET vtkm::cuda)
add_executable(TetrahedralizeExplicitGrid_CUDA TetrahedralizeExplicitGrid.cu)
......@@ -48,10 +48,10 @@ if(TARGET OpenGL::GL AND
add_executable(TetrahedralizeUniformGrid_CUDA TetrahedralizeUniformGrid.cu)
add_executable(TriangulateUniformGrid_CUDA TriangulateUniformGrid.cu)
target_link_libraries(TetrahedralizeExplicitGrid_CUDA PRIVATE vtkm_cont ${gl_libs})
target_link_libraries(TriangulateExplicitGrid_CUDA PRIVATE vtkm_cont ${gl_libs})
target_link_libraries(TetrahedralizeUniformGrid_CUDA PRIVATE vtkm_cont ${gl_libs})
target_link_libraries(TriangulateUniformGrid_CUDA PRIVATE vtkm_cont ${gl_libs})
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})
endif()
if(TARGET vtkm::tbb)
......@@ -60,9 +60,9 @@ if(TARGET OpenGL::GL AND
add_executable(TetrahedralizeUniformGrid_TBB TetrahedralizeUniformGridTBB.cxx)
add_executable(TriangulateUniformGrid_TBB TriangulateUniformGridTBB.cxx)
target_link_libraries(TetrahedralizeExplicitGrid_TBB PRIVATE vtkm_cont ${gl_libs})
target_link_libraries(TriangulateExplicitGrid_TBB PRIVATE vtkm_cont ${gl_libs})
target_link_libraries(TetrahedralizeUniformGrid_TBB PRIVATE vtkm_cont ${gl_libs})
target_link_libraries(TriangulateUniformGrid_TBB PRIVATE vtkm_cont ${gl_libs})
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()
......@@ -27,6 +27,6 @@ find_package(VTKm REQUIRED QUIET)
if(TARGET vtkm::cuda)
add_executable(UnifiedMemory_CUDA UnifiedMemory.cu)
target_link_libraries(UnifiedMemory_CUDA PRIVATE vtkm_cont)
target_link_libraries(UnifiedMemory_CUDA PRIVATE vtkm_filter)
endif()
......@@ -136,6 +136,13 @@ set(header_template_sources
vtkm_declare_headers(${headers})
vtkm_declare_headers(${header_template_sources})
# Create an interface library for vtkm_filter. At some point, this will be replaced with a real
# library that contains pre-built filters. That would be created with the vtkm_library CMake
# function (defined in VTKmWrappers.cmake).
add_library(vtkm_filter INTERFACE)
target_link_libraries(vtkm_filter INTERFACE vtkm_worklet)
install(TARGETS vtkm_filter EXPORT ${VTKm_EXPORT_NAME})
add_subdirectory(internal)
#-----------------------------------------------------------------------------
......
......@@ -66,4 +66,8 @@ set(unit_tests
UnitTestZFP.cxx
)
vtkm_unit_tests(SOURCES ${unit_tests} ALL_BACKENDS)
vtkm_unit_tests(
SOURCES ${unit_tests}
LIBRARIES vtkm_filter
ALL_BACKENDS
)
......@@ -202,7 +202,7 @@ elseif(VTKm_ENABLE_EGL_CONTEXT)
endif()
#-----------------------------------------------------------------------------
target_link_libraries(vtkm_rendering PUBLIC vtkm_cont)
target_link_libraries(vtkm_rendering PUBLIC vtkm_filter)
if(UNIX AND NOT APPLE)
......
......@@ -98,6 +98,19 @@ set(header_impls
)
# This is a list of sources that does not have code that runs on devices. It only
# needs a standard system C++ compiler.
set(sources_no_device
)
# This is a list of sources that has code that runs on devices and might need to
# be compiled with a device-specific compiler (like CUDA).
set(sources_device
Keys.cxx
ScatterCounting.cxx
)
#-----------------------------------------------------------------------------
add_subdirectory(internal)
add_subdirectory(clip)
......@@ -115,9 +128,14 @@ add_subdirectory(wavelets)
add_subdirectory(particleadvection)
add_subdirectory(zfp)
vtkm_declare_headers(${headers}
${header_impls}
)
vtkm_library(
NAME vtkm_worklet
SOURCES ${sources_no_device}
TEMPLATE_SOURCES ${header_impls}
HEADERS ${headers}
WRAP_FOR_CUDA ${sources_device}
)
target_link_libraries(vtkm_worklet PUBLIC vtkm_cont)
#-----------------------------------------------------------------------------
......
//============================================================================
// 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 2019 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
// Copyright 2019 UT-Battelle, LLC.
// Copyright 2019 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 vtk_m_worklet_Keys_cxx
#include <vtkm/worklet/Keys.h>
#define VTK_M_RM_PAREN(T) vtkm::cont::detail::GetTypeInParentheses<void T>::type
#define VTK_M_KEYS_EXPORT_TYPE(T) \
template class VTKM_WORKLET_EXPORT vtkm::worklet::Keys<VTK_M_RM_PAREN(T)>; \
template VTKM_WORKLET_EXPORT VTKM_CONT void vtkm::worklet::Keys<VTK_M_RM_PAREN(T)>::BuildArrays( \
const vtkm::cont::ArrayHandle<VTK_M_RM_PAREN(T)>& keys, \
vtkm::worklet::KeysSortType sort, \
vtkm::cont::DeviceAdapterId device); \
template VTKM_WORKLET_EXPORT VTKM_CONT void vtkm::worklet::Keys<VTK_M_RM_PAREN(T)>::BuildArrays( \
const vtkm::cont::ArrayHandleVirtual<VTK_M_RM_PAREN(T)>& keys, \
vtkm::worklet::KeysSortType sort, \
vtkm::cont::DeviceAdapterId device); \
template VTKM_WORKLET_EXPORT VTKM_CONT void vtkm::worklet::Keys<VTK_M_RM_PAREN( \
T)>::BuildArraysInPlace(vtkm::cont::ArrayHandle<VTK_M_RM_PAREN(T)>& keys, \
vtkm::worklet::KeysSortType sort, \
vtkm::cont::DeviceAdapterId device); \
extern template VTKM_WORKLET_EXPORT VTKM_CONT void vtkm::worklet::Keys<VTK_M_RM_PAREN( \
T)>::BuildArraysInPlace(vtkm::cont::ArrayHandleVirtual<VTK_M_RM_PAREN(T)>& keys, \
vtkm::worklet::KeysSortType sort, \
vtkm::cont::DeviceAdapterId device)
#define VTK_M_KEYS_EXPORT(T) \
VTK_M_KEYS_EXPORT_TYPE((T)); \
VTK_M_KEYS_EXPORT_TYPE((vtkm::Vec<T, 2>)); \
VTK_M_KEYS_EXPORT_TYPE((vtkm::Vec<T, 3>)); \
VTK_M_KEYS_EXPORT_TYPE((vtkm::Vec<T, 4>))
VTK_M_KEYS_EXPORT(char);
VTK_M_KEYS_EXPORT(vtkm::Int8);
VTK_M_KEYS_EXPORT(vtkm::UInt8);
VTK_M_KEYS_EXPORT(vtkm::Int16);
VTK_M_KEYS_EXPORT(vtkm::UInt16);
VTK_M_KEYS_EXPORT(vtkm::Int32);
VTK_M_KEYS_EXPORT(vtkm::UInt32);
VTK_M_KEYS_EXPORT(vtkm::Int64);
VTK_M_KEYS_EXPORT(vtkm::UInt64);
VTK_M_KEYS_EXPORT(vtkm::Float32);
VTK_M_KEYS_EXPORT(vtkm::Float64);
#undef VTK_M_KEYS_EXPORT
#undef VTK_M_KEYS_EXPORT_TYPE
#undef VTK_M_RM_PAREN
......@@ -27,6 +27,7 @@
#include <vtkm/cont/ArrayHandleGroupVecVariable.h>
#include <vtkm/cont/ArrayHandleIndex.h>
#include <vtkm/cont/ArrayHandlePermutation.h>
#include <vtkm/cont/ArrayHandleVirtual.h>
#include <vtkm/cont/Logging.h>
#include <vtkm/exec/internal/ReduceByKeyLookup.h>
......@@ -38,6 +39,7 @@
#include <vtkm/cont/arg/TypeCheckTagKeys.h>
#include <vtkm/worklet/StableSortIndices.h>
#include <vtkm/worklet/vtkm_worklet_export.h>
#include <vtkm/BinaryOperators.h>
......@@ -46,6 +48,15 @@ namespace vtkm
namespace worklet
{
/// Select the type of sort for BuildArrays calls. Unstable sorting is faster
/// but will not produce consistent ordering for equal keys. Stable sorting
/// is slower, but keeps equal keys in their original order.
enum class KeysSortType
{
Unstable = 0,
Stable = 1
};
/// \brief Manage keys for a \c WorkletReduceByKey.
///
/// The \c WorkletReduceByKey worklet (and its associated \c
......@@ -64,23 +75,14 @@ namespace worklet
/// creating a different \c Keys structure for each \c Invoke.
///
template <typename _KeyType>
class Keys
class VTKM_ALWAYS_EXPORT Keys
{
public:
using KeyType = _KeyType;
using KeyArrayHandleType = vtkm::cont::ArrayHandle<KeyType>;
/// Select the type of sort for BuildArrays calls. Unstable sorting is faster
/// but will not produce consistent ordering for equal keys. Stable sorting
/// is slower, but keeps equal keys in their original order.
enum class SortType
{
Unstable = 0,
Stable = 1
};
VTKM_CONT
Keys() = default;
Keys();
/// \b Construct a Keys class from an array of keys.
///
......@@ -89,13 +91,13 @@ public:
///
/// The input keys object is not modified and the result is not stable
/// sorted. This is the equivalent of calling
/// `BuildArrays(keys, SortType::Unstable, device)`.
/// `BuildArrays(keys, KeysSortType::Unstable, device)`.
///
template <typename KeyStorage>
VTKM_CONT Keys(const vtkm::cont::ArrayHandle<KeyType, KeyStorage>& keys,
vtkm::cont::DeviceAdapterId device = vtkm::cont::DeviceAdapterTagAny())
{
this->BuildArrays(keys, SortType::Unstable, device);
this->BuildArrays(keys, KeysSortType::Unstable, device);
}
/// Build the internal arrays without modifying the input. This is more
......@@ -103,14 +105,14 @@ public:
/// keys for unstable sorting.
template <typename KeyArrayType>
VTKM_CONT void BuildArrays(const KeyArrayType& keys,
SortType sort,
KeysSortType sort,
vtkm::cont::DeviceAdapterId device = vtkm::cont::DeviceAdapterTagAny())
{
VTKM_LOG_SCOPE(vtkm::cont::LogLevel::Perf, "Keys::BuildArrays");
switch (sort)
{
case SortType::Unstable:
case KeysSortType::Unstable:
{
KeyArrayHandleType mutableKeys;
vtkm::cont::Algorithm::Copy(device, keys, mutableKeys);
......@@ -118,7 +120,7 @@ public:
this->BuildArraysInternal(mutableKeys, device);
}
break;
case SortType::Stable:
case KeysSortType::Stable:
this->BuildArraysInternalStable(keys, device);
break;
}
......@@ -130,17 +132,17 @@ public:
template <typename KeyArrayType>
VTKM_CONT void BuildArraysInPlace(
KeyArrayType& keys,
SortType sort,
KeysSortType sort,
vtkm::cont::DeviceAdapterId device = vtkm::cont::DeviceAdapterTagAny())
{
VTKM_LOG_SCOPE(vtkm::cont::LogLevel::Perf, "Keys::BuildArraysInPlace");
switch (sort)
{
case SortType::Unstable:
case KeysSortType::Unstable:
this->BuildArraysInternal(keys, device);
break;
case SortType::Stable:
case KeysSortType::Stable:
{
this->BuildArraysInternalStable(keys, device);
KeyArrayHandleType tmp;
......@@ -267,6 +269,9 @@ private:
(void)offsetsTotal; // Shut up, compiler
}
};
template <typename _KeyType>
VTKM_CONT Keys<_KeyType>::Keys() = default;
}
} // namespace vtkm::worklet
......@@ -423,4 +428,51 @@ struct Transport<vtkm::cont::arg::TransportTagKeyedValuesOut, ArrayHandleType, D
}
} // namespace vtkm::cont::arg
#ifndef vtk_m_worklet_Keys_cxx
#define VTK_M_RM_PAREN(T) vtkm::cont::detail::GetTypeInParentheses<void T>::type
#define VTK_M_KEYS_EXPORT_TYPE(T) \
extern template class VTKM_WORKLET_TEMPLATE_EXPORT vtkm::worklet::Keys<VTK_M_RM_PAREN(T)>; \
extern template VTKM_WORKLET_TEMPLATE_EXPORT VTKM_CONT void vtkm::worklet::Keys<VTK_M_RM_PAREN( \
T)>::BuildArrays(const vtkm::cont::ArrayHandle<VTK_M_RM_PAREN(T)>& keys, \
vtkm::worklet::KeysSortType sort, \
vtkm::cont::DeviceAdapterId device); \
extern template VTKM_WORKLET_TEMPLATE_EXPORT VTKM_CONT void vtkm::worklet::Keys<VTK_M_RM_PAREN( \
T)>::BuildArrays(const vtkm::cont::ArrayHandleVirtual<VTK_M_RM_PAREN(T)>& keys, \
vtkm::worklet::KeysSortType sort, \
vtkm::cont::DeviceAdapterId device); \
extern template VTKM_WORKLET_TEMPLATE_EXPORT VTKM_CONT void vtkm::worklet::Keys<VTK_M_RM_PAREN( \
T)>::BuildArraysInPlace(vtkm::cont::ArrayHandle<VTK_M_RM_PAREN(T)>& keys, \
vtkm::worklet::KeysSortType sort, \
vtkm::cont::DeviceAdapterId device); \
extern template VTKM_WORKLET_TEMPLATE_EXPORT VTKM_CONT void vtkm::worklet::Keys<VTK_M_RM_PAREN( \
T)>::BuildArraysInPlace(vtkm::cont::ArrayHandleVirtual<VTK_M_RM_PAREN(T)>& keys, \
vtkm::worklet::KeysSortType sort, \
vtkm::cont::DeviceAdapterId device)
#define VTK_M_KEYS_EXPORT(T) \
VTK_M_KEYS_EXPORT_TYPE((T)); \
VTK_M_KEYS_EXPORT_TYPE((vtkm::Vec<T, 2>)); \
VTK_M_KEYS_EXPORT_TYPE((vtkm::Vec<T, 3>)); \
VTK_M_KEYS_EXPORT_TYPE((vtkm::Vec<T, 4>))
VTK_M_KEYS_EXPORT(char);
VTK_M_KEYS_EXPORT(vtkm::Int8);
VTK_M_KEYS_EXPORT(vtkm::UInt8);
VTK_M_KEYS_EXPORT(vtkm::Int16);
VTK_M_KEYS_EXPORT(vtkm::UInt16);
VTK_M_KEYS_EXPORT(vtkm::Int32);
VTK_M_KEYS_EXPORT(vtkm::UInt32);
VTK_M_KEYS_EXPORT(vtkm::Int64);
VTK_M_KEYS_EXPORT(vtkm::UInt64);
VTK_M_KEYS_EXPORT(vtkm::Float32);
VTK_M_KEYS_EXPORT(vtkm::Float64);
#undef VTK_M_KEYS_EXPORT
#undef VTK_M_KEYS_EXPORT_TYPE
#undef VTK_M_RM_PAREN
#endif // !vtk_m_worklet_Keys_cxx
#endif //vtk_m_worklet_Keys_h
//=============================================================================
//
// 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 2019 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
// Copyright 2019 UT-Battelle, LLC.
// Copyright 2019 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 <vtkm/worklet/ScatterCounting.h>
#include <vtkm/cont/Algorithm.h>
#include <vtkm/cont/ArrayCopy.h>
#include <vtkm/cont/ArrayHandleCast.h>
#include <vtkm/cont/ArrayHandleConcatenate.h>
#include <vtkm/cont/ArrayHandleConstant.h>
#include <vtkm/cont/ArrayHandleIndex.h>
#include <vtkm/cont/ArrayHandleView.h>
#include <vtkm/cont/ErrorBadValue.h>
#include <vtkm/exec/FunctorBase.h>
#include <vtkm/worklet/DispatcherMapField.h>
#include <vtkm/worklet/WorkletMapField.h>
#include <sstream>
namespace
{
VTKM_CONT
inline vtkm::cont::ArrayHandleConcatenate<
vtkm::cont::ArrayHandleConstant<vtkm::Id>,
vtkm::cont::ArrayHandleView<vtkm::cont::ArrayHandle<vtkm::Id>>>
ShiftArrayHandleByOne(const vtkm::cont::ArrayHandle<vtkm::Id>& array)
{
return vtkm::cont::make_ArrayHandleConcatenate(
vtkm::cont::make_ArrayHandleConstant<vtkm::Id>(0, 1),
vtkm::cont::make_ArrayHandleView(array, 0, array.GetNumberOfValues() - 1));
}
struct ReverseInputToOutputMapWorklet : vtkm::worklet::WorkletMapField
{
using ControlSignature = void(FieldIn outputStartIndices,
FieldIn outputEndIndices,
WholeArrayOut outputToInputMap,
WholeArrayOut visit);
using ExecutionSignature = void(_1, _2, _3, _4, InputIndex);
using InputDomain = _2;