Commit 88596366 authored by Haocheng LIU's avatar Haocheng LIU

Merge worklet testing executables into a device dependent shared library

VTK-m has been updated to replace old per device worklet testing executables with a device
dependent shared library so that it's able to accept a device adapter
at runtime.
Meanwhile, it updates the testing infrastructure APIs. vtkm::cont::testing::Run
function would call ForceDevice when needed and if users need the device
adapter info at runtime, RunOnDevice function would pass the adapter into the functor.

Optional Parser is bumped from 1.3 to 1.7.
parent 88bcd069
......@@ -346,6 +346,7 @@ endfunction(vtkm_library)
# LIBRARIES <dependent_library_list>
# TEST_ARGS <argument_list>
# MPI
# ALL_BACKENDS
# <options>
# )
#
......@@ -363,6 +364,8 @@ endfunction(vtkm_library)
#
# [MPI] : when specified, the tests should be run in parallel if
# MPI is enabled.
# [ALL_BACKENDS] : when specified, the tests would test against all enabled
# backends. BACKEND argument would be ignored.
#
function(vtkm_unit_tests)
if (NOT VTKm_ENABLE_TESTING)
......@@ -370,7 +373,7 @@ function(vtkm_unit_tests)
endif()
set(options)
set(global_options ${options} MPI)
set(global_options ${options} MPI ALL_BACKENDS)
set(oneValueArgs BACKEND NAME)
set(multiValueArgs SOURCES LIBRARIES TEST_ARGS)
cmake_parse_arguments(VTKm_UT
......@@ -379,17 +382,36 @@ function(vtkm_unit_tests)
)
vtkm_parse_test_options(VTKm_UT_SOURCES "${options}" ${VTKm_UT_SOURCES})
set(test_prog )
set(test_prog)
set(backend ${VTKm_UT_BACKEND})
set(enable_all_backends ${VTKm_UT_ALL_BACKENDS})
set(all_backends SERIAL)
if (VTKm_ENABLE_CUDA)
list(APPEND all_backends CUDA)
endif()
if (VTKm_ENABLE_TBB)
list(APPEND all_backends TBB)
endif()
if (VTKm_ENABLE_OPENMP)
list(APPEND all_backends OPENMP)
endif()
if(VTKm_UT_NAME)
set(test_prog "${VTKm_UT_NAME}")
else()
vtkm_get_kit_name(kit)
set(test_prog "UnitTests_${kit}")
endif()
if(backend)
if(enable_all_backends)
string(REPLACE ";" "_" all_backends_name "${all_backends}")
set(test_prog "${test_prog}_${all_backends_name}")
elseif(backend)
set(test_prog "${test_prog}_${backend}")
set(all_backends ${backend})
else()
set (all_backends "NO_BACKEND")
endif()
if(VTKm_UT_MPI)
......@@ -404,7 +426,8 @@ function(vtkm_unit_tests)
#the creation of the test source list needs to occur before the labeling as
#cuda. This is so that we get the correctly named entry points generated
create_test_sourcelist(test_sources ${test_prog}.cxx ${VTKm_UT_SOURCES} ${extraArgs})
if(backend STREQUAL "CUDA")
#if all backends are enabled, we can use cuda compiler to handle all possible backends.
if(backend STREQUAL "CUDA" OR (enable_all_backends AND VTKm_ENABLE_CUDA))
vtkm_compile_as_cuda(cu_srcs ${VTKm_UT_SOURCES})
set(VTKm_UT_SOURCES ${cu_srcs})
endif()
......@@ -415,43 +438,48 @@ function(vtkm_unit_tests)
set_property(TARGET ${test_prog} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${VTKm_EXECUTABLE_OUTPUT_PATH})
target_link_libraries(${test_prog} PRIVATE vtkm_cont ${VTKm_UT_LIBRARIES})
if(backend)
target_compile_definitions(${test_prog} PRIVATE "VTKM_DEVICE_ADAPTER=VTKM_DEVICE_ADAPTER_${backend}")
endif()
#determine the timeout for all the tests based on the backend. CUDA tests
#generally require more time because of kernel generation.
set(timeout 180)
set(run_serial False)
if(backend STREQUAL "CUDA")
set(timeout 1500)
elseif(backend STREQUAL "OPENMP")
#We need to have all OpenMP tests run serially as they
#will uses all the system cores, and we will cause a N*N thread
#explosion which causes the tests to run slower than when run
#serially
set(run_serial True)
endif()
foreach(current_backend ${all_backends})
if (current_backend STREQUAL "NO_BACKEND")
set (current_backend "")
endif()
foreach (test ${VTKm_UT_SOURCES})
get_filename_component(tname ${test} NAME_WE)
if(VTKm_UT_MPI AND VTKm_ENABLE_MPI)
add_test(NAME ${tname}${current_backend}
COMMAND ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 3 ${MPIEXEC_PREFLAGS}
$<TARGET_FILE:${test_prog}> ${tname} --device=${current_backend} ${VTKm_UT_TEST_ARGS}
${MPIEXEC_POSTFLAGS}
)
else()
add_test(NAME ${tname}${current_backend}
COMMAND ${test_prog} ${tname} --device=${current_backend} ${VTKm_UT_TEST_ARGS}
)
endif()
#determine the timeout for all the tests based on the backend. CUDA tests
#generally require more time because of kernel generation.
if (current_backend STREQUAL "CUDA")
set(timeout 1500)
else()
set(timeout 180)
endif()
if(current_backend STREQUAL "OPENMP")
#We need to have all OpenMP tests run serially as they
#will uses all the system cores, and we will cause a N*N thread
#explosion which causes the tests to run slower than when run
#serially
set(run_serial True)
else()
set(run_serial False)
endif()
foreach (test ${VTKm_UT_SOURCES})
get_filename_component(tname ${test} NAME_WE)
if(VTKm_UT_MPI AND VTKm_ENABLE_MPI)
add_test(NAME ${tname}${backend}
COMMAND ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 3 ${MPIEXEC_PREFLAGS}
$<TARGET_FILE:${test_prog}> ${tname} ${VTKm_UT_TEST_ARGS}
${MPIEXEC_POSTFLAGS}
)
else()
add_test(NAME ${tname}${backend}
COMMAND ${test_prog} ${tname} ${VTKm_UT_TEST_ARGS}
)
endif()
set_tests_properties("${tname}${backend}" PROPERTIES
TIMEOUT ${timeout}
RUN_SERIAL ${run_serial}
)
endforeach (test)
set_tests_properties("${tname}${current_backend}" PROPERTIES
TIMEOUT ${timeout}
RUN_SERIAL ${run_serial}
)
endforeach (test)
endforeach(current_backend)
endfunction(vtkm_unit_tests)
......
Merge worklet testing executables into a device dependent shared library
VTK-m has been updated to replace old per device worklet testing executables with a device
dependent shared library so that it's able to accept a device adapter
at runtime.
Meanwhile, it updates the testing infrastructure APIs. vtkm::cont::testing::Run
function would call ForceDevice when needed and if users need the device
adapter info at runtime, RunOnDevice function would pass the adapter into the functor.
Optional Parser is bumped from 1.3 to 1.7.
......@@ -187,6 +187,54 @@ struct StreamingScanExclusiveFunctor
vtkm::cont::DeviceAdapterAlgorithm<Device>::StreamingScanExclusive(numBlocks, input, output);
return true;
}
template <typename Device, class CIn, class COut, class BinaryFunctor>
VTKM_CONT bool operator()(Device,
const vtkm::Id numBlocks,
const vtkm::cont::ArrayHandle<T, CIn>& input,
vtkm::cont::ArrayHandle<T, COut>& output,
BinaryFunctor binary_functor,
const T& initialValue)
{
VTKM_IS_DEVICE_ADAPTER_TAG(Device);
result = vtkm::cont::DeviceAdapterAlgorithm<Device>::StreamingScanExclusive(
numBlocks, input, output, binary_functor, initialValue);
return true;
}
};
template <typename U>
struct StreamingReduceFunctor
{
U result;
StreamingReduceFunctor()
: result(U(0))
{
}
template <typename Device, typename T, class CIn>
VTKM_CONT bool operator()(Device,
const vtkm::Id numBlocks,
const vtkm::cont::ArrayHandle<T, CIn>& input,
U initialValue)
{
VTKM_IS_DEVICE_ADAPTER_TAG(Device);
result =
vtkm::cont::DeviceAdapterAlgorithm<Device>::StreamingReduce(numBlocks, input, initialValue);
return true;
}
template <typename Device, typename T, class CIn, class BinaryFunctor>
VTKM_CONT bool operator()(Device,
const vtkm::Id numBlocks,
const vtkm::cont::ArrayHandle<T, CIn>& input,
U InitialValue,
BinaryFunctor binaryFunctor)
{
VTKM_IS_DEVICE_ADAPTER_TAG(Device);
result = vtkm::cont::DeviceAdapterAlgorithm<Device>::StreamingReduce(
numBlocks, input, InitialValue, binaryFunctor);
return true;
}
};
struct ScanInclusiveByKeyFunctor
......@@ -559,6 +607,7 @@ struct Algorithm
vtkm::cont::TryExecuteOnDevice(devId, functor, numBlocks, input, output);
return functor.result;
}
template <typename T, class CIn, class COut>
VTKM_CONT static T StreamingScanExclusive(const vtkm::Id numBlocks,
const vtkm::cont::ArrayHandle<T, CIn>& input,
......@@ -567,6 +616,46 @@ struct Algorithm
return StreamingScanExclusive(vtkm::cont::DeviceAdapterTagAny(), numBlocks, input, output);
}
template <typename T, class CIn, class COut, class BinaryFunctor>
VTKM_CONT static T StreamingScanExclusive(const vtkm::Id numBlocks,
const vtkm::cont::ArrayHandle<T, CIn>& input,
vtkm::cont::ArrayHandle<T, COut>& output,
BinaryFunctor binary_functor,
const T& initialValue)
{
detail::StreamingScanExclusiveFunctor<T> functor;
vtkm::cont::TryExecuteOnDevice(vtkm::cont::DeviceAdapterTagAny(),
functor,
numBlocks,
input,
output,
binary_functor,
initialValue);
return functor.result;
}
template <typename T, typename U, class CIn>
VTKM_CONT static U StreamingReduce(const vtkm::Id numBlocks,
const vtkm::cont::ArrayHandle<T, CIn>& input,
U initialValue)
{
detail::StreamingReduceFunctor<U> functor;
vtkm::cont::TryExecuteOnDevice(
vtkm::cont::DeviceAdapterTagAny(), functor, numBlocks, input, initialValue);
return functor.result;
}
template <typename T, typename U, class CIn, class BinaryFunctor>
VTKM_CONT static U StreamingReduce(const vtkm::Id numBlocks,
const vtkm::cont::ArrayHandle<T, CIn>& input,
U initialValue,
BinaryFunctor binaryFunctor)
{
detail::StreamingReduceFunctor<U> functor;
vtkm::cont::TryExecuteOnDevice(
vtkm::cont::DeviceAdapterTagAny(), functor, numBlocks, input, initialValue, binaryFunctor);
return functor.result;
}
template <typename T, class CIn, class COut, class BinaryFunctor>
VTKM_CONT static T ScanInclusive(vtkm::cont::DeviceAdapterId devId,
......
......@@ -29,6 +29,14 @@
#include <vtkm/cont/serial/DeviceAdapterSerial.h>
#include <vtkm/cont/tbb/DeviceAdapterTBB.h>
//Bring in each device adapters runtime class
#include <vtkm/cont/cuda/internal/DeviceAdapterRuntimeDetectorCuda.h>
#include <vtkm/cont/internal/DeviceAdapterError.h>
#include <vtkm/cont/openmp/internal/DeviceAdapterRuntimeDetectorOpenMP.h>
#include <vtkm/cont/serial/internal/DeviceAdapterRuntimeDetectorSerial.h>
#include <vtkm/cont/tbb/internal/DeviceAdapterRuntimeDetectorTBB.h>
#include <algorithm>
#include <map>
#include <mutex>
......@@ -76,6 +84,19 @@ struct RuntimeDeviceTrackerInternals
bool RuntimeValid[VTKM_MAX_DEVICE_ADAPTER_ID];
DeviceAdapterNameType DeviceNames[VTKM_MAX_DEVICE_ADAPTER_ID];
};
struct RuntimeDeviceTrackerFunctor
{
template <typename DeviceAdapter>
VTKM_CONT void operator()(DeviceAdapter, DeviceAdapterId id, RuntimeDeviceTracker* rdt)
{
vtkm::cont::RuntimeDeviceInformation runtimeDevice;
if (DeviceAdapter() == id)
{
rdt->ForceDeviceImpl(DeviceAdapter(), runtimeDevice.Exists(DeviceAdapter()));
}
}
};
}
VTKM_CONT
......@@ -206,6 +227,13 @@ vtkm::cont::RuntimeDeviceTracker GetGlobalRuntimeDeviceTracker()
#endif
}
VTKM_CONT
void RuntimeDeviceTracker::ForceDevice(DeviceAdapterId id)
{
detail::RuntimeDeviceTrackerFunctor functor;
vtkm::ListForEach(functor, VTKM_DEFAULT_DEVICE_ADAPTER_LIST_TAG(), id, this);
}
VTKM_CONT
DeviceAdapterNameType RuntimeDeviceTracker::GetDeviceName(DeviceAdapterId device) const
{
......
......@@ -23,6 +23,7 @@
#include <vtkm/cont/vtkm_cont_export.h>
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
#include <vtkm/cont/DeviceAdapterListTag.h>
#include <vtkm/cont/ErrorBadAllocation.h>
#include <vtkm/cont/ErrorBadDevice.h>
#include <vtkm/cont/RuntimeDeviceInformation.h>
......@@ -34,10 +35,12 @@ namespace vtkm
namespace cont
{
class RuntimeDeviceTracker;
namespace detail
{
struct RuntimeDeviceTrackerInternals;
struct RuntimeDeviceTrackerFunctor;
}
/// A class that can be used to determine if a given device adapter
......@@ -49,6 +52,8 @@ struct RuntimeDeviceTrackerInternals;
///
class VTKM_ALWAYS_EXPORT RuntimeDeviceTracker
{
friend struct detail::RuntimeDeviceTrackerFunctor;
public:
VTKM_CONT_EXPORT
VTKM_CONT
......@@ -196,6 +201,9 @@ public:
this->ForceDeviceImpl(device, runtimeDevice.Exists(DeviceAdapterTag()));
}
VTKM_CONT_EXPORT
VTKM_CONT void ForceDevice(DeviceAdapterId id);
VTKM_CONT_EXPORT
VTKM_CONT
DeviceAdapterNameType GetDeviceName(DeviceAdapterId id) const;
......
......@@ -64,6 +64,7 @@ struct DeviceAdapterId
protected:
friend DeviceAdapterId make_DeviceAdapterId(vtkm::Int8 id);
friend DeviceAdapterId make_DeviceAdapterIdFromName(const std::string& name);
constexpr explicit DeviceAdapterId(vtkm::Int8 id)
: Value(id)
......@@ -74,6 +75,28 @@ private:
vtkm::Int8 Value;
};
inline DeviceAdapterId make_DeviceAdapterIdFromName(const std::string& name)
{
vtkm::Int8 deviceId(VTKM_DEVICE_ADAPTER_ERROR);
if (name == "SERIAL")
{
deviceId = VTKM_DEVICE_ADAPTER_SERIAL;
}
else if (name == "CUDA")
{
deviceId = VTKM_DEVICE_ADAPTER_CUDA;
}
else if (name == "TBB")
{
deviceId = VTKM_DEVICE_ADAPTER_TBB;
}
else if (name == "OPENMP")
{
deviceId = VTKM_DEVICE_ADAPTER_OPENMP;
}
return DeviceAdapterId(deviceId);
}
inline DeviceAdapterId make_DeviceAdapterId(vtkm::Int8 id)
{
return DeviceAdapterId(id);
......
......@@ -22,6 +22,7 @@
#include <vtkm/cont/EnvironmentTracker.h>
#include <vtkm/cont/Error.h>
#include <vtkm/testing/OptionParser.h>
#include <vtkm/testing/Testing.h>
#include <vtkm/thirdparty/diy/Configure.h>
......@@ -44,13 +45,59 @@ namespace cont
{
namespace testing
{
namespace {
using namespace vtkm::testing::option;
// Lean parser related code
enum optionIndex {DEVICE};
struct Arg: public vtkm::testing::option::Arg
{
static ArgStatus Required(const Option& option, bool)
{
return option.arg == 0 ? vtkm::testing::option::ARG_ILLEGAL : vtkm::testing::option::ARG_OK;
}
};
static Descriptor Usage[] =
{
{DEVICE, 0, "d", "device", Arg::Required, " -- device \t specify a device to run on."},
{0,0,0,0,0,0}
};
}
struct Testing
{
public:
template <class Func>
static VTKM_CONT int Run(Func function)
static VTKM_CONT int Run(Func function, int argc = 0, char* argv[] = nullptr)
{
argc-=(argc>0); argv+=(argc>0); // skip program name argv[0] if present
Stats stats(Usage, argc, argv);
Option* options = new Option[stats.options_max];
Option* buffer = new Option[stats.buffer_max];
Parser parse(Usage, argc, argv, options, buffer);
if (parse.error())
{
return 1;
}
if (options[DEVICE])
{
Option* deviceOption = options[DEVICE];
vtkm::cont::DeviceAdapterId deviceId = vtkm::cont::make_DeviceAdapterIdFromName(std::string(deviceOption->arg));
vtkm::cont::GetGlobalRuntimeDeviceTracker().ForceDevice(deviceId);
}
std::vector<std::string> nonOptions;
for (int i = 0; i < parse.nonOptionsCount();i++)
{
nonOptions.push_back(std::string(parse.nonOption(i)));
}
delete[] options;
delete[] buffer;
try
{
function();
......@@ -78,6 +125,66 @@ public:
}
return 0;
}
template <class Func>
static VTKM_CONT int RunOnDevice(Func function, int argc = 0, char* argv[] = nullptr)
{
argc-=(argc>0); argv+=(argc>0); // skip program name argv[0] if present
Stats stats(Usage, argc, argv);
Option* options = new Option[stats.options_max];
Option* buffer = new Option[stats.buffer_max];
Parser parse(Usage, argc, argv, options, buffer);
if (parse.error())
{
return 1;
}
vtkm::cont::DeviceAdapterId deviceId = vtkm::cont::make_DeviceAdapterId(VTKM_DEVICE_ADAPTER_ERROR);
if (options[DEVICE])
{
Option* deviceOption = options[DEVICE];
deviceId = vtkm::cont::make_DeviceAdapterIdFromName(std::string(deviceOption->arg));
vtkm::cont::GetGlobalRuntimeDeviceTracker().ForceDevice(deviceId);
}
std::vector<std::string> nonOptions;
for (int i = 0; i < parse.nonOptionsCount();i++)
{
nonOptions.push_back(std::string(parse.nonOption(i)));
}
delete[] options;
delete[] buffer;
try
{
function(deviceId);
}
catch (vtkm::testing::Testing::TestFailure& error)
{
std::cout << "***** Test failed @ " << error.GetFile() << ":" << error.GetLine() << std::endl
<< error.GetMessage() << std::endl;
return 1;
}
catch (vtkm::cont::Error& error)
{
std::cout << "***** Uncaught VTKm exception thrown." << std::endl
<< error.GetMessage() << std::endl;
return 1;
}
catch (std::exception& error)
{
std::cout << "***** STL exception throw." << std::endl << error.what() << std::endl;
}
catch (...)
{
std::cout << "***** Unidentified exception thrown." << std::endl;
return 1;
}
return 0;
}
};
struct Environment
......
......@@ -1556,7 +1556,7 @@ public:
return false; // overflow protection: don't accept number of options that doesn't fit signed int
buffer[parser.op_count] = option;
int idx = buffer[parser.op_count].desc->index;
int idx = static_cast<int>(buffer[parser.op_count].desc->index);
if (options[idx])
options[idx].append(buffer[parser.op_count]);
else
......
......@@ -23,6 +23,7 @@
#include <vtkm/testing/TestingMath.h>
#include <vtkm/cont/serial/DeviceAdapterSerial.h>
#include <vtkm/cont/testing/Testing.h>
int UnitTestMath(int, char* [])
{
......
......@@ -78,7 +78,7 @@ class CosmoTools
{
public:
// Run the halo finder and then the NxN MBP center finder
template <typename FieldType, typename StorageType, typename DeviceAdapter>
template <typename FieldType, typename StorageType>
void RunHaloFinder(vtkm::cont::ArrayHandle<FieldType, StorageType>& xLocation,
vtkm::cont::ArrayHandle<FieldType, StorageType>& yLocation,
vtkm::cont::ArrayHandle<FieldType, StorageType>& zLocation,
......@@ -88,11 +88,10 @@ public:
const FieldType linkingLen,
vtkm::cont::ArrayHandle<vtkm::Id>& resultHaloId,
vtkm::cont::ArrayHandle<vtkm::Id>& resultMBP,
vtkm::cont::ArrayHandle<FieldType>& resultPot,
const DeviceAdapter&)
vtkm::cont::ArrayHandle<FieldType>& resultPot)
{
// Constructor gets particle locations, particle mass and min halo size
cosmotools::CosmoTools<FieldType, StorageType, DeviceAdapter> cosmo(
cosmotools::CosmoTools<FieldType, StorageType> cosmo(
nParticles, particleMass, minHaloSize, linkingLen, xLocation, yLocation, zLocation);
// Find the halos within the particles and the MBP center of each halo
......@@ -100,17 +99,16 @@ public:
}
// Run MBP on a single halo of particles using the N^2 algorithm
template <typename FieldType, typename StorageType, typename DeviceAdapter>
template <typename FieldType, typename StorageType>
void RunMBPCenterFinderNxN(vtkm::cont::ArrayHandle<FieldType, StorageType> xLocation,
vtkm::cont::ArrayHandle<FieldType, StorageType> yLocation,
vtkm::cont::ArrayHandle<FieldType, StorageType> zLocation,
const vtkm::Id nParticles,
const FieldType particleMass,
vtkm::Pair<vtkm::Id, FieldType>& nxnResult,
const DeviceAdapter&)
vtkm::Pair<vtkm::Id, FieldType>& nxnResult)
{
// Constructor gets particle locations and particle mass
cosmotools::CosmoTools<FieldType, StorageType, DeviceAdapter> cosmo(
cosmotools::CosmoTools<FieldType, StorageType> cosmo(
nParticles, particleMass, xLocation, yLocation, zLocation);
// Most Bound Particle N x N algorithm
......@@ -122,17 +120,16 @@ public:
}
// Run MBP on a single halo of particles using MxN estimation algorithm
template <typename FieldType, typename StorageType, typename DeviceAdapter>
template <typename FieldType, typename StorageType>
void RunMBPCenterFinderMxN(vtkm::cont::ArrayHandle<FieldType, StorageType> xLocation,
vtkm::cont::ArrayHandle<FieldType, StorageType> yLocation,
vtkm::cont::ArrayHandle<FieldType, StorageType> zLocation,
const vtkm::Id nParticles,
const FieldType particleMass,
vtkm::Pair<vtkm::Id, FieldType>& mxnResult,
const DeviceAdapter&)
vtkm::Pair<vtkm::Id, FieldType>& mxnResult)
{
// Constructor gets particle locations and particle mass
cosmotools::CosmoTools<FieldType, StorageType, DeviceAdapter> cosmo(
cosmotools::CosmoTools<FieldType, StorageType> cosmo(
nParticles, particleMass, xLocation, yLocation, zLocation);
// Most Bound Particle M x N algorithm with binning estimates
......
......@@ -22,6 +22,7 @@
#define vtk_m_worklet_FieldStatistics_h
#include <vtkm/Math.h>
#include <vtkm/cont/Algorithm.h>
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
#include <vtkm/worklet/DispatcherMapField.h>
......@@ -37,7 +38,7 @@ namespace worklet
{
//simple functor that prints basic statistics
template <typename FieldType, typename DeviceAdapter>
template <typename FieldType>
class FieldStatistics
{
public:
......@@ -117,7 +118,7 @@ public:
template <typename Storage>
void Run(vtkm::cont::ArrayHandle<FieldType, Storage> fieldArray, StatInfo& statinfo)
{
using DeviceAlgorithms = typename vtkm::cont::DeviceAdapterAlgorithm<DeviceAdapter>;
using DeviceAlgorithms = vtkm::cont::Algorithm;
using FieldPortal = typename vtkm::cont::ArrayHandle<FieldType, Storage>::PortalConstControl;
// Copy original data to array for sorting
......@@ -154,7 +155,6 @@ public:
// Raw moments via Worklet
vtkm::worklet::DispatcherMapField<CalculatePowers> calculatePowersDispatcher(
CalculatePowers(4));
calculatePowersDispatcher.SetDevice(DeviceAdapter());
calculatePowersDispatcher.Invoke(fieldArray, pow1Array, pow2Array, pow3Array, pow4Array);
// Accumulate the results using ScanInclusive
......@@ -166,7 +166,6 @@ public:
// Subtract the mean from every value and leave in tempArray
vtkm::worklet::DispatcherMapField<SubtractConst> subtractConstDispatcher(
SubtractConst(statinfo.mean));
subtractConstDispatcher.SetDevice(DeviceAdapter());
subtractConstDispatcher.Invoke(fieldArray, tempArray);
// Calculate sums of powers on the (value - mean) array
......
......@@ -37,16 +37,13 @@ public:
///
/// \tparam CoordType type of the x, y, z component of the point coordinates.
/// \tparam CoordStorageTag
/// \tparam DeviceAdapter
/// \param coords An ArrayHandle of x, y, z coordinates of input points.
/// \param device Tag for selecting device adapter.
///
template <typename CoordType, typename CoordStorageTag, typename DeviceAdapter>
void Build(const vtkm::cont::ArrayHandle<vtkm::Vec<CoordType, 3>, CoordStorageTag>& coords,
DeviceAdapter device)
template <typename CoordType, typename CoordStorageTag>
void Build(const vtkm::cont::ArrayHandle<vtkm::Vec<CoordType, 3>, CoordStorageTag>& coords)
{
vtkm::worklet::spatialstructure::KdTree3DConstruction().Run(
coords, this->PointIds, this->SplitIds, device);
coords, this->PointIds, this->SplitIds);
}
/// \brief Nearest neighbor search using KD-Tree
......@@ -73,10 +70,10 @@ public:
const vtkm::cont::ArrayHandle<vtkm::Vec<CoordType, 3>, CoordStorageTag2>& queryPoints,
vtkm::cont::ArrayHandle<vtkm::Id>& nearestNeighborIds,
vtkm::cont::ArrayHandle<CoordType>& distances,
DeviceAdapter device)
DeviceAdapter deviceId)
{