Add DEVICE_SOURCES to vtkm_unit_tests

The `vtkm_unit_tests` function in the CMake build now allows you to specify
which files need to be compiled with a device compiler using the
`DEVICE_SOURCES` argument. Previously, the only way to specify that unit
tests needed to be compiled with a device compiler was to use the
`ALL_BACKENDS` argument, which would automatically compile everything with
the device compiler as well as test the code on all backends.
`ALL_BACKENDS` is still supported, but it no longer changes the sources to
be compiled with the device compiler.
This commit is contained in:
Kenneth Moreland 2022-07-06 13:36:00 -06:00
parent f07d57bec3
commit 163d591795
45 changed files with 263 additions and 328 deletions

@ -13,11 +13,11 @@ include(VTKmWrappers)
function(vtkm_create_test_executable
prog_name
sources
device_sources
libraries
defines
is_mpi_test
use_mpi
enable_all_backends
use_job_pool)
vtkm_diy_use_mpi_push()
@ -41,23 +41,12 @@ function(vtkm_create_test_executable
#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 ${prog}.cxx ${sources} ${extraArgs})
create_test_sourcelist(test_sources ${prog}.cxx ${sources} ${device_sources} ${extraArgs})
add_executable(${prog} ${prog}.cxx ${sources})
add_executable(${prog} ${test_sources})
vtkm_add_drop_unused_function_flags(${prog})
target_compile_definitions(${prog} PRIVATE ${defines})
#determine if we have a device that requires a separate compiler enabled
set(device_lang_enabled FALSE)
if( (TARGET vtkm::cuda) OR (TARGET vtkm::kokkos_cuda) OR (TARGET vtkm::kokkos_hip))
set(device_lang_enabled TRUE)
endif()
#if all backends are enabled, we can use the device compiler to handle all possible backends.
set(device_sources)
if(device_lang_enabled AND (enable_all_backends OR (TARGET vtkm::kokkos_hip)))
set(device_sources ${sources})
endif()
vtkm_add_target_information(${prog} DEVICE_SOURCES ${device_sources})
if(NOT VTKm_USE_DEFAULT_SYMBOL_VISIBILITY)
@ -83,68 +72,89 @@ endfunction()
# (package, module, whatever you call it). Usage:
#
# vtkm_unit_tests(
# NAME
# [ NAME <name> ]
# SOURCES <source_list>
# LIBRARIES <dependent_library_list>
# DEFINES <target_compile_definitions>
# TEST_ARGS <argument_list>
# MPI
# ALL_BACKENDS
# USE_VTKM_JOB_POOL
# <options>
# [ DEVICE_SOURCES <source_list> ]
# [ LIBRARIES <dependent_library_list> ]
# [ DEFINES <target_compile_definitions> ]
# [ TEST_ARGS <argument_list> ]
# [ MPI ]
# [ BACKEND <device> ]
# [ ALL_BACKENDS ]
# [ USE_VTKM_JOB_POOL ]
# )
#
# [LIBRARIES] : extra libraries that this set of tests need to link too
# NAME : Specify the name of the testing executable. If not specified,
# UnitTests_<kitname> is used.
#
# [DEFINES] : extra defines that need to be set for all unit test sources
# SOURCES: A list of the source files. Each file is expected to contain a
# function with the same name as the source file. For example, if SOURCES
# contains `UnitTestFoo.cxx`, then `UnitTestFoo.cxx` should contain a
# function named `UnitTestFoo`. A test with this name is also added to ctest.
#
# [LABEL] : CTest Label to associate to this set of tests
# LIBRARIES: Extra libraries that this set of tests need to link to.
#
# [TEST_ARGS] : arguments that should be passed on the command line to the
# test executable
# DEFINES: Extra defines to be set for all unit test sources.
#
# [MPI] : when specified, the tests should be run in parallel if
# MPI is enabled. The tests should also be able to build and run
# When MPI is not available, i.e., they should not make explicit
# use of MPI and instead completely rely on DIY.
# [ALL_BACKENDS] : when specified, the tests would test against all enabled
# backends. Otherwise we expect the tests to manage the
# backends at runtime.
# TEST_ARGS: Arguments that should be passed on the command line to the
# test executable when executed by ctest.
#
# MPI: When specified, the tests should be run in parallel if MPI is enabled.
# The tests should also be able to build and run when MPI is not available,
# i.e., they should not make explicit use of MPI and instead completely rely
# on DIY.
#
# BACKEND: When used, a specific backend will be forced for the device.
# A `--vtkm-device` flag will be given to the command line argument with the
# specified device. When not used, a backend will be chosen.
#
# ALL_BACKENDS: When used, a separate ctest test is created for each device
# that VTK-m is compiled for. The call will add the `--vtkm-device` flag when
# running the test to force the test for a particular backend.
#
function(vtkm_unit_tests)
set(options)
set(global_options ${options} USE_VTKM_JOB_POOL MPI ALL_BACKENDS)
set(oneValueArgs BACKEND NAME LABEL)
set(multiValueArgs SOURCES LIBRARIES DEFINES TEST_ARGS)
set(multiValueArgs SOURCES DEVICE_SOURCES LIBRARIES DEFINES TEST_ARGS)
cmake_parse_arguments(VTKm_UT
"${global_options}" "${oneValueArgs}" "${multiValueArgs}"
${ARGN}
)
vtkm_parse_test_options(VTKm_UT_SOURCES "${options}" ${VTKm_UT_SOURCES})
set(per_device_command_line_arguments "NONE")
set(per_device_suffix "")
set(per_device_timeout 180)
set(per_device_serial FALSE)
set(per_device_command_line_arguments)
set(per_device_suffix)
set(per_device_timeout)
set(per_device_serial)
set(enable_all_backends ${VTKm_UT_ALL_BACKENDS})
if(enable_all_backends)
set(per_device_command_line_arguments --vtkm-device=serial)
set(per_device_suffix "SERIAL")
if (VTKm_ENABLE_CUDA)
if(NOT VTKm_UT_BACKEND)
set(enable_all_backends ${VTKm_UT_ALL_BACKENDS})
# If ALL_BACKENDS is specified, add a test for each backend. If it is not
# specified, pick a backend to use. Pick the most "specific" backend so
# that different CI builds will use different backends. This ensures that
# we do not have a test that always drops down to serial.
if(VTKm_ENABLE_CUDA AND (enable_all_backends OR NOT per_device_suffix))
list(APPEND per_device_command_line_arguments --vtkm-device=cuda)
list(APPEND per_device_suffix "CUDA")
#CUDA tests generally require more time because of kernel generation.
list(APPEND per_device_timeout 1500)
list(APPEND per_device_serial FALSE)
endif()
if (VTKm_ENABLE_TBB)
if(VTKm_ENABLE_KOKKOS AND (enable_all_backends OR NOT per_device_suffix))
list(APPEND per_device_command_line_arguments --vtkm-device=kokkos)
list(APPEND per_device_suffix "KOKKOS")
#may require more time because of kernel generation.
list(APPEND per_device_timeout 1500)
list(APPEND per_device_serial FALSE)
endif()
if(VTKm_ENABLE_TBB AND (enable_all_backends OR NOT per_device_suffix))
list(APPEND per_device_command_line_arguments --vtkm-device=tbb)
list(APPEND per_device_suffix "TBB")
list(APPEND per_device_timeout 180)
list(APPEND per_device_serial FALSE)
endif()
if (VTKm_ENABLE_OPENMP)
if(VTKm_ENABLE_OPENMP AND (enable_all_backends OR NOT per_device_suffix))
list(APPEND per_device_command_line_arguments --vtkm-device=openmp)
list(APPEND per_device_suffix "OPENMP")
list(APPEND per_device_timeout 180)
@ -154,13 +164,26 @@ function(vtkm_unit_tests)
#serially
list(APPEND per_device_serial TRUE)
endif()
if (VTKm_ENABLE_KOKKOS)
list(APPEND per_device_command_line_arguments --vtkm-device=kokkos)
list(APPEND per_device_suffix "KOKKOS")
#may require more time because of kernel generation.
list(APPEND per_device_timeout 1500)
if(enable_all_backends OR NOT per_device_suffix)
list(APPEND per_device_command_line_arguments --vtkm-device=serial)
list(APPEND per_device_suffix "SERIAL")
list(APPEND per_device_timeout 180)
list(APPEND per_device_serial FALSE)
endif()
if(NOT enable_all_backends)
# If not enabling all backends, exactly one backend should have been added.
list(LENGTH per_device_suffix number_of_devices)
if(NOT number_of_devices EQUAL 1)
message(FATAL_ERROR "Expected to pick one backend")
endif()
endif()
else()
# A specific backend was requested.
set(per_device_command_line_arguments --vtkm-device=${VTKm_UT_BACKEND})
set(per_device_suffix ${VTKm_UT_BACKEND})
set(per_device_timeout 180)
# Some devices don't like multiple tests run at the same time.
set(per_device_serial TRUE)
endif()
set(test_prog)
@ -188,33 +211,33 @@ function(vtkm_unit_tests)
vtkm_create_test_executable(
${test_prog}
"${VTKm_UT_SOURCES}"
"${VTKm_UT_DEVICE_SOURCES}"
"${VTKm_UT_LIBRARIES}"
"${VTKm_UT_DEFINES}"
ON # is_mpi_test
ON # use_mpi
${enable_all_backends}
${VTKm_UT_USE_VTKM_JOB_POOL})
endif()
if ((NOT VTKm_ENABLE_MPI) OR VTKm_ENABLE_DIY_NOMPI)
vtkm_create_test_executable(
${test_prog}
"${VTKm_UT_SOURCES}"
"${VTKm_UT_DEVICE_SOURCES}"
"${VTKm_UT_LIBRARIES}"
"${VTKm_UT_DEFINES}"
ON # is_mpi_test
OFF # use_mpi
${enable_all_backends}
${VTKm_UT_USE_VTKM_JOB_POOL})
endif()
else()
vtkm_create_test_executable(
${test_prog}
"${VTKm_UT_SOURCES}"
"${VTKm_UT_DEVICE_SOURCES}"
"${VTKm_UT_LIBRARIES}"
"${VTKm_UT_DEFINES}"
OFF # is_mpi_test
OFF # use_mpi
${enable_all_backends}
${VTKm_UT_USE_VTKM_JOB_POOL})
endif()
@ -225,19 +248,16 @@ function(vtkm_unit_tests)
#exclusive on the end ( e.g. for(i=0; i < n; ++i))
break()
endif()
if(per_device_command_line_arguments STREQUAL "NONE")
set(device_command_line_argument)
set(upper_backend ${per_device_suffix})
set(timeout ${per_device_timeout})
set(run_serial ${per_device_serial})
else()
list(GET per_device_command_line_arguments ${index} device_command_line_argument)
if(enable_all_backends)
list(GET per_device_suffix ${index} upper_backend)
list(GET per_device_timeout ${index} timeout)
list(GET per_device_serial ${index} run_serial)
else()
set(upper_backend)
endif()
list(GET per_device_command_line_arguments ${index} device_command_line_argument)
list(GET per_device_timeout ${index} timeout)
list(GET per_device_serial ${index} run_serial)
foreach (test ${VTKm_UT_SOURCES})
foreach (test ${VTKm_UT_SOURCES} ${VTKm_UT_DEVICE_SOURCES})
get_filename_component(tname ${test} NAME_WE)
if(VTKm_UT_MPI)
if (VTKm_ENABLE_MPI)

@ -0,0 +1,10 @@
# Added DEVICE_SOURCES to vtkm_unit_tests
The `vtkm_unit_tests` function in the CMake build now allows you to specify
which files need to be compiled with a device compiler using the
`DEVICE_SOURCES` argument. Previously, the only way to specify that unit
tests needed to be compiled with a device compiler was to use the
`ALL_BACKENDS` argument, which would automatically compile everything with
the device compiler as well as test the code on all backends.
`ALL_BACKENDS` is still supported, but it no longer changes the sources to
be compiled with the device compiler.

@ -44,13 +44,8 @@ public:
{
}
// Copy constructor
VTKM_EXEC_CONT ArrayPortalExtractComponent(const ArrayPortalExtractComponent<PortalType>& src)
: Portal(src.Portal)
, Component(src.Component)
{
}
ArrayPortalExtractComponent(const ArrayPortalExtractComponent&) = default;
ArrayPortalExtractComponent(ArrayPortalExtractComponent&&) = default;
ArrayPortalExtractComponent& operator=(const ArrayPortalExtractComponent&) = default;
ArrayPortalExtractComponent& operator=(ArrayPortalExtractComponent&&) = default;

@ -35,4 +35,4 @@ if (NOT VTKm_NO_DEPRECATED_VIRTUAL)
)
endif()
vtkm_unit_tests(SOURCES ${unit_tests} LABEL "CUDA" LIBRARIES vtkm_worklet)
vtkm_unit_tests(SOURCES ${unit_tests} LABEL "CUDA" LIBRARIES vtkm_worklet BACKEND cuda)

@ -32,7 +32,7 @@ if (NOT VTKm_NO_DEPRECATED_VIRTUAL)
)
endif()
vtkm_unit_tests(SOURCES ${unit_tests} LABEL "KOKKOS" LIBRARIES vtkm_worklet)
vtkm_unit_tests(SOURCES ${unit_tests} LABEL "KOKKOS" LIBRARIES vtkm_worklet BACKEND kokkos)
if (TARGET vtkm::kokkos_cuda)
set_source_files_properties(${unit_tests} PROPERTIES LANGUAGE CUDA)

@ -35,7 +35,9 @@ endif()
vtkm_unit_tests(SOURCES ${unit_tests}
LABEL "OPENMP"
DEFINES VTKM_NO_ERROR_ON_MIXED_CUDA_CXX_TAG
LIBRARIES vtkm_worklet)
LIBRARIES vtkm_worklet
BACKEND 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

@ -13,7 +13,7 @@
int UnitTestOpenMPCellLocatorRectilinearGrid(int argc, char* argv[])
{
auto& tracker = vtkm::cont::GetRuntimeDeviceTracker();
tracker.ForceDevice(vtkm::cont::DeviceAdapterTagSerial{});
tracker.ForceDevice(vtkm::cont::DeviceAdapterTagOpenMP{});
return vtkm::cont::testing::Testing::Run(
TestingCellLocatorRectilinearGrid<vtkm::cont::DeviceAdapterTagSerial>(), argc, argv);
TestingCellLocatorRectilinearGrid<vtkm::cont::DeviceAdapterTagOpenMP>(), argc, argv);
}

@ -13,7 +13,7 @@
int UnitTestOpenMPCellLocatorUniformGrid(int argc, char* argv[])
{
auto& tracker = vtkm::cont::GetRuntimeDeviceTracker();
tracker.ForceDevice(vtkm::cont::DeviceAdapterTagSerial{});
tracker.ForceDevice(vtkm::cont::DeviceAdapterTagOpenMP{});
return vtkm::cont::testing::Testing::Run(
TestingCellLocatorUniformGrid<vtkm::cont::DeviceAdapterTagSerial>(), argc, argv);
TestingCellLocatorUniformGrid<vtkm::cont::DeviceAdapterTagOpenMP>(), argc, argv);
}

@ -34,4 +34,6 @@ endif()
vtkm_unit_tests(SOURCES ${unit_tests}
LABEL "SERIAL"
DEFINES VTKM_NO_ERROR_ON_MIXED_CUDA_CXX_TAG
LIBRARIES vtkm_worklet)
LIBRARIES vtkm_worklet
BACKEND serial
)

@ -35,4 +35,6 @@ endif()
vtkm_unit_tests(SOURCES ${unit_tests}
LABEL "TBB"
DEFINES VTKM_NO_ERROR_ON_MIXED_CUDA_CXX_TAG
LIBRARIES vtkm_worklet)
LIBRARIES vtkm_worklet
BACKEND tbb
)

@ -31,49 +31,30 @@ set(headers
)
set(unit_tests
UnitTestAlgorithm.cxx
UnitTestArrayCopy.cxx
UnitTestArrayExtractComponent.cxx
UnitTestArrayGetValues.cxx
UnitTestArrayHandleCartesianProduct.cxx
UnitTestArrayHandleCompositeVector.cxx
UnitTestArrayHandleConcatenate.cxx
UnitTestArrayHandleCounting.cxx
UnitTestArrayHandleDecorator.cxx
UnitTestArrayHandleDiscard.cxx
UnitTestArrayHandleExtractComponent.cxx
UnitTestArrayHandleImplicit.cxx
UnitTestArrayHandleIndex.cxx
UnitTestArrayHandleOffsetsToNumComponents.cxx
UnitTestArrayHandlePermutation.cxx
UnitTestArrayHandleRandomStandardNormal.cxx
UnitTestArrayHandleRandomUniformBits.cxx
UnitTestArrayHandleRandomUniformReal.cxx
UnitTestArrayHandleReverse.cxx
UnitTestArrayHandleSwizzle.cxx
UnitTestArrayHandleThreadSafety.cxx
UnitTestArrayHandleTransform.cxx
UnitTestArrayHandleUniformPointCoordinates.cxx
UnitTestArrayHandleVirtual.cxx
UnitTestArrayHandleXGCCoordinates.cxx
UnitTestArrayPortalToIterators.cxx
UnitTestArrayRangeCompute.cxx
UnitTestCellLocatorChooser.cxx
UnitTestCellLocatorGeneral.cxx
UnitTestCellSet.cxx
UnitTestCellSetExplicit.cxx
UnitTestCellSetExtrude.cxx
UnitTestCellSetPermutation.cxx
UnitTestContTesting.cxx
UnitTestDataSetBuilderCurvilinear.cxx
UnitTestDataSetBuilderExplicit.cxx
UnitTestDataSetBuilderRectilinear.cxx
UnitTestDataSetBuilderUniform.cxx
UnitTestDataSetConvertToExpected.cxx
UnitTestDataSetPermutation.cxx
UnitTestDataSetRectilinear.cxx
UnitTestDataSetUniform.cxx
UnitTestDeviceAdapterAlgorithmDependency.cxx
UnitTestDeviceAdapterAlgorithmGeneral.cxx
UnitTestDeviceSelectOnThreads.cxx
UnitTestDynamicCellSet.cxx
@ -83,7 +64,6 @@ set(unit_tests
UnitTestLogging.cxx
UnitTestMergePartitionedDataSet.cxx
UnitTestMoveConstructors.cxx
UnitTestParticleArrayCopy.cxx
UnitTestPartitionedDataSet.cxx
UnitTestRuntimeDeviceInformation.cxx
UnitTestRuntimeDeviceNames.cxx
@ -98,6 +78,29 @@ set(unit_tests
UnitTestVariantArrayHandle.cxx
)
set(unit_tests_device
UnitTestAlgorithm.cxx
UnitTestArrayCopy.cxx
UnitTestArrayHandleDecorator.cxx
UnitTestArrayHandleExtractComponent.cxx
UnitTestArrayHandlePermutation.cxx
UnitTestArrayHandleRandomStandardNormal.cxx
UnitTestArrayHandleRandomUniformReal.cxx
UnitTestArrayHandleSwizzle.cxx
UnitTestArrayHandleTransform.cxx
UnitTestArrayHandleXGCCoordinates.cxx
UnitTestArrayRangeCompute.cxx
UnitTestCellLocatorChooser.cxx
UnitTestCellLocatorGeneral.cxx
UnitTestCellSet.cxx
UnitTestCellSetExplicit.cxx
UnitTestCellSetExtrude.cxx
UnitTestCellSetPermutation.cxx
UnitTestDataSetPermutation.cxx
UnitTestDeviceAdapterAlgorithmDependency.cxx
UnitTestParticleArrayCopy.cxx
)
set(library_sources
TestEqualArrayHandles.cxx
Testing.cxx
@ -115,7 +118,7 @@ vtkm_library(
target_link_libraries(vtkm_cont_testing PUBLIC vtkm_cont)
if(VTKm_ENABLE_TESTING)
vtkm_unit_tests(SOURCES ${unit_tests} DEFINES VTKM_NO_ERROR_ON_MIXED_CUDA_CXX_TAG)
vtkm_unit_tests(SOURCES ${unit_tests} DEVICE_SOURCES ${unit_tests_device})
#add distributed tests i.e.test to run with MPI
#if MPI is enabled.
@ -124,5 +127,5 @@ if(VTKm_ENABLE_TESTING)
UnitTestSerializationArrayHandle.cxx
UnitTestSerializationDataSet.cxx
)
vtkm_unit_tests(MPI SOURCES ${mpi_unit_tests} DEFINES VTKM_NO_ERROR_ON_MIXED_CUDA_CXX_TAG)
vtkm_unit_tests(MPI SOURCES ${mpi_unit_tests})
endif()

@ -10,8 +10,6 @@
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/ArrayHandleCartesianProduct.h>
#include <vtkm/cont/DeviceAdapter.h>
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
#include <vtkm/cont/testing/Testing.h>

@ -8,12 +8,15 @@
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#include <vtkm/cont/ArrayCopy.h>
#include <vtkm/cont/ArrayCopyDevice.h>
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/ArrayHandleCompositeVector.h>
#include <vtkm/cont/ArrayHandleCounting.h>
#include <vtkm/cont/ArrayHandleExtractComponent.h>
#include <vtkm/cont/DeviceAdapter.h>
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
#include <vtkm/cont/Invoker.h>
#include <vtkm/worklet/WorkletMapField.h>
#include <vtkm/cont/testing/Testing.h>
@ -32,9 +35,6 @@ struct ExtractComponentTests
ReferenceComponentArray,
ReferenceComponentArray>;
using DeviceTag = vtkm::cont::DeviceAdapterTagSerial;
using Algo = vtkm::cont::DeviceAdapterAlgorithm<DeviceTag>;
// This is used to build a ArrayHandleExtractComponent's internal array.
ReferenceCompositeArray RefComposite;
@ -53,7 +53,7 @@ struct ExtractComponentTests
InputArray BuildInputArray() const
{
InputArray result;
Algo::Copy(this->RefComposite, result);
vtkm::cont::ArrayCopyDevice(this->RefComposite, result);
return result;
}
@ -77,7 +77,7 @@ struct ExtractComponentTests
// Copy the extract array in the execution environment to test reading:
vtkm::cont::ArrayHandle<ValueType> execCopy;
Algo::Copy(extract, execCopy);
vtkm::cont::ArrayCopy(extract, execCopy);
this->ValidateReadTestArray(execCopy, component);
}
@ -101,32 +101,22 @@ struct ExtractComponentTests
}
}
// Doubles the specified component (reading from RefVectorType).
template <typename PortalType, typename RefPortalType>
struct WriteTestFunctor : vtkm::exec::FunctorBase
// Doubles the specified component
struct WriteTestWorklet : vtkm::worklet::WorkletMapField
{
using RefVectorType = typename RefPortalType::ValueType;
using Traits = vtkm::VecTraits<RefVectorType>;
using ControlSignature = void(FieldIn referenceArray, FieldOut componentArray);
PortalType Portal;
RefPortalType RefPortal;
vtkm::IdComponent Component;
VTKM_CONT
WriteTestFunctor(const PortalType& portal,
const RefPortalType& ref,
vtkm::IdComponent component)
: Portal(portal)
, RefPortal(ref)
, Component(component)
VTKM_CONT WriteTestWorklet(vtkm::IdComponent component)
: Component(component)
{
}
VTKM_EXEC_CONT
void operator()(vtkm::Id index) const
template <typename RefType, typename ComponentType>
VTKM_EXEC void operator()(const RefType& reference, ComponentType& outComponent) const
{
this->Portal.Set(index,
Traits::GetComponent(this->RefPortal.Get(index), this->Component) * 2);
outComponent = vtkm::VecTraits<RefType>::GetComponent(reference, this->Component) * 2;
}
};
@ -138,13 +128,13 @@ struct ExtractComponentTests
ExtractArray extract(composite, component);
{
WriteTestFunctor<typename ExtractArray::WritePortalType,
typename ReferenceCompositeArray::ReadPortalType>
functor(extract.WritePortal(), this->RefComposite.ReadPortal(), component);
auto refPortal = this->RefComposite.ReadPortal();
auto outPortal = extract.WritePortal();
for (vtkm::Id i = 0; i < extract.GetNumberOfValues(); ++i)
{
functor(i);
auto ref = refPortal.Get(i);
using Traits = vtkm::VecTraits<decltype(ref)>;
outPortal.Set(i, Traits::GetComponent(ref, component) * 2);
}
}
@ -156,17 +146,7 @@ struct ExtractComponentTests
InputArray composite = this->BuildInputArray();
ExtractArray extract(composite, component);
using Portal = typename ExtractArray::WritePortalType;
using RefPortal = typename ReferenceCompositeArray::ReadPortalType;
{
vtkm::cont::Token token;
WriteTestFunctor<Portal, RefPortal> functor(
extract.PrepareForInPlace(DeviceTag(), token),
this->RefComposite.PrepareForInput(DeviceTag(), token),
component);
Algo::Schedule(functor, extract.GetNumberOfValues());
}
vtkm::cont::Invoker{}(WriteTestWorklet(component), this->RefComposite, extract);
this->ValidateWriteTestArray(composite, component);
}

@ -12,9 +12,9 @@
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/ArrayHandleImplicit.h>
#include <vtkm/cont/DeviceAdapter.h>
#include <vtkm/cont/Invoker.h>
#include <vtkm/exec/FunctorBase.h>
#include <vtkm/worklet/WorkletMapField.h>
#include <vtkm/cont/testing/Testing.h>
@ -33,17 +33,14 @@ struct DoubleIndexFunctor
using DoubleIndexArrayType = vtkm::cont::ArrayHandleImplicit<DoubleIndexFunctor>;
template <typename PermutedPortalType>
struct CheckPermutationFunctor : vtkm::exec::FunctorBase
struct CheckPermutationWorklet : vtkm::worklet::WorkletMapField
{
PermutedPortalType PermutedPortal;
using ControlSignature = void(FieldIn permutationArray);
using ExecutionSignature = void(WorkIndex, _1);
VTKM_EXEC
void operator()(vtkm::Id index) const
template <typename T>
VTKM_EXEC void operator()(vtkm::Id index, const T& value) const
{
using T = typename PermutedPortalType::ValueType;
T value = this->PermutedPortal.Get(index);
vtkm::Id permutedIndex = 2 * index;
T expectedValue = TestValue(permutedIndex, T());
@ -54,47 +51,17 @@ struct CheckPermutationFunctor : vtkm::exec::FunctorBase
}
};
template <typename PermutedArrayHandleType, typename Device>
VTKM_CONT CheckPermutationFunctor<typename PermutedArrayHandleType::ReadPortalType>
make_CheckPermutationFunctor(const PermutedArrayHandleType& permutedArray,
Device,
vtkm::cont::Token& token)
struct InPlacePermutationWorklet : vtkm::worklet::WorkletMapField
{
using PermutedPortalType = typename PermutedArrayHandleType::ReadPortalType;
CheckPermutationFunctor<PermutedPortalType> functor;
functor.PermutedPortal = permutedArray.PrepareForInput(Device(), token);
return functor;
}
using ControlSignature = void(FieldInOut permutationArray);
template <typename PermutedPortalType>
struct InPlacePermutationFunctor : vtkm::exec::FunctorBase
{
PermutedPortalType PermutedPortal;
VTKM_EXEC
void operator()(vtkm::Id index) const
template <typename T>
VTKM_EXEC void operator()(T& value) const
{
using T = typename PermutedPortalType::ValueType;
T value = this->PermutedPortal.Get(index);
value = value + T(1000);
this->PermutedPortal.Set(index, value);
}
};
template <typename PermutedArrayHandleType, typename Device>
VTKM_CONT InPlacePermutationFunctor<typename PermutedArrayHandleType::WritePortalType>
make_InPlacePermutationFunctor(PermutedArrayHandleType& permutedArray,
Device,
vtkm::cont::Token& token)
{
using PermutedPortalType = typename PermutedArrayHandleType::WritePortalType;
InPlacePermutationFunctor<PermutedPortalType> functor;
functor.PermutedPortal = permutedArray.PrepareForInPlace(Device(), token);
return functor;
}
template <typename PortalType>
VTKM_CONT void CheckInPlaceResult(PortalType portal)
{
@ -119,31 +86,20 @@ VTKM_CONT void CheckInPlaceResult(PortalType portal)
}
}
template <typename PermutedPortalType>
struct OutputPermutationFunctor : vtkm::exec::FunctorBase
struct OutputPermutationWorklet : vtkm::worklet::WorkletMapField
{
PermutedPortalType PermutedPortal;
// Note: Using a FieldOut for the input domain is rare (and mostly discouraged),
// but it works as long as the array is allocated to the size desired.
using ControlSignature = void(FieldOut permutationArray);
using ExecutionSignature = void(WorkIndex, _1);
VTKM_EXEC
void operator()(vtkm::Id index) const
template <typename T>
VTKM_EXEC void operator()(vtkm::Id index, T& value) const
{
using T = typename PermutedPortalType::ValueType;
this->PermutedPortal.Set(index, TestValue(static_cast<vtkm::Id>(index), T()));
value = TestValue(static_cast<vtkm::Id>(index), T());
}
};
template <typename PermutedArrayHandleType, typename Device>
VTKM_CONT OutputPermutationFunctor<typename PermutedArrayHandleType::WritePortalType>
make_OutputPermutationFunctor(PermutedArrayHandleType& permutedArray,
Device,
vtkm::cont::Token& token)
{
using PermutedPortalType = typename PermutedArrayHandleType::WritePortalType;
OutputPermutationFunctor<PermutedPortalType> functor;
functor.PermutedPortal = permutedArray.PrepareForOutput(ARRAY_SIZE, Device(), token);
return functor;
}
template <typename PortalType>
VTKM_CONT void CheckOutputResult(PortalType portal)
{
@ -176,9 +132,6 @@ struct PermutationTests
using ValueArrayType = vtkm::cont::ArrayHandle<ValueType, vtkm::cont::StorageTagBasic>;
using PermutationArrayType = vtkm::cont::ArrayHandlePermutation<IndexArrayType, ValueArrayType>;
using Device = vtkm::cont::DeviceAdapterTagSerial;
using Algorithm = vtkm::cont::DeviceAdapterAlgorithm<Device>;
ValueArrayType MakeValueArray() const
{
// Allocate a buffer and set initial values
@ -209,23 +162,18 @@ struct PermutationTests
VTKM_TEST_ASSERT(permutationArray.ReadPortal().GetNumberOfValues() == ARRAY_SIZE,
"Permutation portal wrong size.");
vtkm::cont::Token token;
vtkm::cont::Invoker invoke;
std::cout << "Test initial values in execution environment" << std::endl;
Algorithm::Schedule(make_CheckPermutationFunctor(permutationArray, Device(), token),
ARRAY_SIZE);
invoke(CheckPermutationWorklet{}, permutationArray);
std::cout << "Try in place operation" << std::endl;
Algorithm::Schedule(make_InPlacePermutationFunctor(permutationArray, Device(), token),
ARRAY_SIZE);
token.DetachFromAll();
invoke(InPlacePermutationWorklet{}, permutationArray);
CheckInPlaceResult(valueArray.WritePortal());
CheckInPlaceResult(valueArray.ReadPortal());
std::cout << "Try output operation" << std::endl;
Algorithm::Schedule(make_OutputPermutationFunctor(permutationArray, Device(), token),
ARRAY_SIZE);
token.DetachFromAll();
invoke(OutputPermutationWorklet{}, permutationArray);
CheckOutputResult(valueArray.ReadPortal());
CheckOutputResult(valueArray.WritePortal());
}

@ -12,11 +12,11 @@
#include <vtkm/VecTraits.h>
#include <vtkm/cont/Algorithm.h>
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/ArrayHandleCounting.h>
#include <vtkm/cont/Invoker.h>
#include <vtkm/exec/FunctorBase.h>
#include <vtkm/worklet/WorkletMapField.h>
#include <vtkm/cont/testing/Testing.h>
@ -34,18 +34,13 @@ struct MySquare
}
};
template <typename OriginalPortalType, typename TransformedPortalType>
struct CheckTransformFunctor : vtkm::exec::FunctorBase
struct CheckTransformWorklet : vtkm::worklet::WorkletMapField
{
OriginalPortalType OriginalPortal;
TransformedPortalType TransformedPortal;
using ControlSignature = void(FieldIn original, FieldIn transformed);
VTKM_EXEC
void operator()(vtkm::Id index) const
template <typename T, typename U>
VTKM_EXEC void operator()(const T& original, const U& transformed) const
{
using T = typename TransformedPortalType::ValueType;
typename OriginalPortalType::ValueType original = this->OriginalPortal.Get(index);
T transformed = this->TransformedPortal.Get(index);
if (!test_equal(transformed, MySquare{}(original)))
{
this->RaiseError("Encountered bad transformed value.");
@ -53,22 +48,6 @@ struct CheckTransformFunctor : vtkm::exec::FunctorBase
}
};
template <typename OriginalArrayHandleType, typename TransformedArrayHandleType, typename Device>
VTKM_CONT CheckTransformFunctor<typename OriginalArrayHandleType::ReadPortalType,
typename TransformedArrayHandleType::ReadPortalType>
make_CheckTransformFunctor(const OriginalArrayHandleType& originalArray,
const TransformedArrayHandleType& transformedArray,
Device,
vtkm::cont::Token& token)
{
using OriginalPortalType = typename OriginalArrayHandleType::ReadPortalType;
using TransformedPortalType = typename TransformedArrayHandleType::ReadPortalType;
CheckTransformFunctor<OriginalPortalType, TransformedPortalType> functor;
functor.OriginalPortal = originalArray.PrepareForInput(Device(), token);
functor.TransformedPortal = transformedArray.PrepareForInput(Device(), token);
return functor;
}
template <typename OriginalArrayHandleType, typename TransformedArrayHandleType>
VTKM_CONT void CheckControlPortals(const OriginalArrayHandleType& originalArray,
const TransformedArrayHandleType& transformedArray)
@ -113,22 +92,18 @@ struct TransformTests
void operator()() const
{
MySquare functor;
vtkm::cont::Invoker invoke;
std::cout << "Test a transform handle with a counting handle as the values" << std::endl;
{
vtkm::cont::Token token;
vtkm::cont::ArrayHandleCounting<InputValueType> counting =
vtkm::cont::make_ArrayHandleCounting(
InputValueType(OutputValueType(0)), InputValueType(1), ARRAY_SIZE);
CountingTransformHandle countingTransformed =
vtkm::cont::make_ArrayHandleTransform(counting, functor);
vtkm::cont::ArrayHandleCounting<InputValueType> counting = vtkm::cont::make_ArrayHandleCounting(
InputValueType(OutputValueType(0)), InputValueType(1), ARRAY_SIZE);
CountingTransformHandle countingTransformed =
vtkm::cont::make_ArrayHandleTransform(counting, functor);
CheckControlPortals(counting, countingTransformed);
CheckControlPortals(counting, countingTransformed);
std::cout << " Verify that the execution portal works" << std::endl;
Algorithm::Schedule(
make_CheckTransformFunctor(counting, countingTransformed, Device(), token), ARRAY_SIZE);
}
std::cout << " Verify that the execution portal works" << std::endl;
invoke(CheckTransformWorklet{}, counting, countingTransformed);
std::cout << "Test a transform handle with a normal handle as the values" << std::endl;
//we are going to connect the two handles up, and than fill
@ -149,10 +124,7 @@ struct TransformTests
CheckControlPortals(input, thandle);
std::cout << " Verify that the execution portal works" << std::endl;
{
vtkm::cont::Token token;
Algorithm::Schedule(make_CheckTransformFunctor(input, thandle, Device(), token), ARRAY_SIZE);
}
invoke(CheckTransformWorklet{}, input, thandle);
std::cout << "Modify array handle values to ensure transform gets updated" << std::endl;
{
@ -166,10 +138,7 @@ struct TransformTests
CheckControlPortals(input, thandle);
std::cout << " Verify that the execution portal works" << std::endl;
{
vtkm::cont::Token token;
Algorithm::Schedule(make_CheckTransformFunctor(input, thandle, Device(), token), ARRAY_SIZE);
}
invoke(CheckTransformWorklet{}, input, thandle);
}
};

@ -138,6 +138,5 @@ int TestArrayHandleXGCCoordinates()
int UnitTestArrayHandleXGCCoordinates(int argc, char* argv[])
{
vtkm::cont::GetRuntimeDeviceTracker().ForceDevice(vtkm::cont::DeviceAdapterTagSerial{});
return vtkm::cont::testing::Testing::Run(TestArrayHandleXGCCoordinates, argc, argv);
}

@ -224,6 +224,5 @@ void TestCellLocatorChooser()
int UnitTestCellLocatorChooser(int argc, char* argv[])
{
vtkm::cont::GetRuntimeDeviceTracker().ForceDevice(vtkm::cont::DeviceAdapterTagSerial{});
return vtkm::cont::testing::Testing::Run(TestCellLocatorChooser, argc, argv);
}

@ -214,6 +214,5 @@ void TestCellLocatorGeneral()
int UnitTestCellLocatorGeneral(int argc, char* argv[])
{
vtkm::cont::GetRuntimeDeviceTracker().ForceDevice(vtkm::cont::DeviceAdapterTagSerial{});
return vtkm::cont::testing::Testing::Run(TestCellLocatorGeneral, argc, argv);
}

@ -10,6 +10,7 @@
#include <vtkm/cont/CellSetExplicit.h>
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/RuntimeDeviceTracker.h>
#include <vtkm/cont/testing/Testing.h>
#include <vtkm/worklet/DispatcherMapTopology.h>
#include <vtkm/worklet/WorkletMapTopology.h>
@ -171,7 +172,10 @@ void TestCellSetExplicit()
// Test a raw PrepareForInput call:
vtkm::cont::Token token;
cellset.PrepareForInput(vtkm::cont::DeviceAdapterTagSerial{}, PointTag{}, CellTag{}, token);
{
vtkm::cont::ScopedRuntimeDeviceTracker deviceScope(vtkm::cont::DeviceAdapterTagSerial{});
cellset.PrepareForInput(vtkm::cont::DeviceAdapterTagSerial{}, PointTag{}, CellTag{}, token);
}
VTKM_TEST_ASSERT(VTKM_PASS_COMMAS(cellset.HasConnectivity(PointTag{}, CellTag{})),
"CellToPoint table missing after PrepareForInput.");

@ -8,7 +8,6 @@
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#include <vtkm/cont/Algorithm.h>
#include <vtkm/cont/DataSetBuilderExplicit.h>
#include <vtkm/cont/testing/ExplicitTestData.h>
#include <vtkm/cont/testing/MakeTestDataSet.h>
@ -19,8 +18,6 @@
namespace DataSetBuilderExplicitNamespace
{
using DFA = vtkm::cont::Algorithm;
template <typename T>
vtkm::Bounds ComputeBounds(std::size_t numPoints, const T* coords)
{

@ -15,6 +15,12 @@
// everything else. Because this test is based of the serial device adapter,
// make sure that UnitTestDeviceAdapterSerial is working before trying to debug
// this one.
// It's OK to compile this without the device compiler.
#ifndef VTKM_NO_ERROR_ON_MIXED_CUDA_CXX_TAG
#define VTKM_NO_ERROR_ON_MIXED_CUDA_CXX_TAG 1
#endif
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/RuntimeDeviceTracker.h>
#include <vtkm/cont/internal/DeviceAdapterAlgorithmGeneral.h>

@ -72,12 +72,15 @@ int UnitTestDeviceSelectOnThreads(int argc, char* argv[])
std::vector<char*> newArgs;
for (int i = 0; i < argc; ++i)
{
newArgs.push_back(argv[i]);
if (std::strncmp(argv[i], "--vtkm-device", 13) != 0)
{
newArgs.push_back(argv[i]);
}
}
newArgs.push_back(deviceSelectArg.data());
newArgs.push_back(nullptr);
int newArgc = argc + 1;
int newArgc = static_cast<int>(newArgs.size() - 1);
return vtkm::cont::testing::Testing::Run(DoTest, newArgc, newArgs.data());
}

@ -10,11 +10,7 @@
#include <vtkm/cont/RuntimeDeviceInformation.h>
//include all backends
#include <vtkm/cont/cuda/DeviceAdapterCuda.h>
#include <vtkm/cont/openmp/DeviceAdapterOpenMP.h>
#include <vtkm/cont/serial/DeviceAdapterSerial.h>
#include <vtkm/cont/tbb/DeviceAdapterTBB.h>
#include <vtkm/cont/DeviceAdapterTag.h>
#include <vtkm/cont/testing/Testing.h>

@ -10,10 +10,7 @@
#include <vtkm/cont/RuntimeDeviceInformation.h>
#include <vtkm/cont/cuda/DeviceAdapterCuda.h>
#include <vtkm/cont/openmp/DeviceAdapterOpenMP.h>
#include <vtkm/cont/serial/DeviceAdapterSerial.h>
#include <vtkm/cont/tbb/DeviceAdapterTBB.h>
#include <vtkm/cont/DeviceAdapterTag.h>
#include <vtkm/cont/testing/Testing.h>

@ -10,11 +10,7 @@
#include <vtkm/cont/RuntimeDeviceTracker.h>
//include all backends
#include <vtkm/cont/cuda/DeviceAdapterCuda.h>
#include <vtkm/cont/openmp/DeviceAdapterOpenMP.h>
#include <vtkm/cont/serial/DeviceAdapterSerial.h>
#include <vtkm/cont/tbb/DeviceAdapterTBB.h>
#include <vtkm/cont/DeviceAdapterTag.h>
#include <vtkm/cont/testing/Testing.h>
@ -90,6 +86,9 @@ void verify_srdt_support(vtkm::cont::DeviceAdapterId tag,
void VerifyScopedRuntimeDeviceTracker()
{
// This test requires all valid devices to be on.
vtkm::cont::GetRuntimeDeviceTracker().Reset();
std::array<bool, VTKM_MAX_DEVICE_ADAPTER_ID> all_off;
std::array<bool, VTKM_MAX_DEVICE_ADAPTER_ID> all_on;
std::array<bool, VTKM_MAX_DEVICE_ADAPTER_ID> defaults;

@ -13,6 +13,7 @@
#include <vtkm/cont/ErrorBadDevice.h>
#include <vtkm/cont/ErrorBadType.h>
#include <vtkm/cont/ErrorBadValue.h>
#include <vtkm/cont/RuntimeDeviceTracker.h>
#include <vtkm/cont/TryExecute.h>
#include <vtkm/cont/serial/DeviceAdapterSerial.h>
@ -211,6 +212,9 @@ void TryExecuteErrorTests()
static void Run()
{
// This test requires all available devices to be enabled.
vtkm::cont::GetRuntimeDeviceTracker().Reset();
using ValidDevice = vtkm::cont::DeviceAdapterTagSerial;
using InvalidDevice = vtkm::cont::DeviceAdapterTagUndefined;

@ -9,10 +9,13 @@
##============================================================================
set(unit_tests
UnitTestCellSetConnectivityFilter.cxx
UnitTestImageConnectivityFilter.cxx
)
set(unit_tests_device
UnitTestCellSetConnectivityFilter.cxx # uses vtkm::cont::Algorithm
)
set(libraries
vtkm_filter_contour
vtkm_filter_connected_components
@ -21,7 +24,7 @@ set(libraries
vtkm_unit_tests(
SOURCES ${unit_tests}
DEVICE_SOURCES ${unit_tests_device}
LIBRARIES ${libraries}
ALL_BACKENDS # uses vtkm::cont::Algorithm
USE_VTKM_JOB_POOL
)

@ -10,11 +10,14 @@
set(unit_tests
UnitTestClipWithFieldFilter.cxx
UnitTestClipWithImplicitFunctionFilter.cxx
UnitTestContourFilter.cxx
UnitTestContourFilterNormals.cxx
UnitTestMIRFilter.cxx
)
set(unit_tests_device
UnitTestContourFilter.cxx # Algorithm used, needs device compiler
UnitTestMIRFilter.cxx # Algorithm used, needs device compiler
)
set(libraries
vtkm_filter_clean_grid
vtkm_filter_contour
@ -37,7 +40,7 @@ endif()
vtkm_unit_tests(
SOURCES ${unit_tests}
DEVICE_SOURCES ${unit_tests_device}
LIBRARIES ${libraries}
ALL_BACKENDS # Algorithm::Sort called, needs device compiler
USE_VTKM_JOB_POOL
)

@ -14,7 +14,11 @@ set(unit_tests
UnitTestNDEntropyFilter.cxx
UnitTestNDHistogramFilter.cxx
UnitTestPartitionedDataSetHistogramFilter.cxx
UnitTestParticleDensity.cxx)
)
set(unit_tests_device
UnitTestParticleDensity.cxx # uses DescriptiveStatistcs worklet
)
set(libraries
vtkm_filter_density_estimate
@ -22,7 +26,7 @@ set(libraries
vtkm_unit_tests(
SOURCES ${unit_tests}
DEVICE_SOURCES ${unit_tests_device}
LIBRARIES ${libraries}
ALL_BACKENDS # UnitTestParticleDensity.cxx uses DescriptiveStatistcs worklet
USE_VTKM_JOB_POOL
)

@ -20,6 +20,9 @@ set(headers
set(unit_tests
UnitTestContourTreeUniformFilter.cxx
)
set(unit_tests_device
UnitTestContourTreeUniformAugmentedFilter.cxx
UnitTestContourTreeUniformAugmentedWorklet.cxx
UnitTestContourTreeUniformDistributedFilter.cxx
@ -34,19 +37,22 @@ set(libraries
vtkm_unit_tests(
SOURCES ${unit_tests}
DEVICE_SOURCES ${unit_tests_device}
LIBRARIES ${libraries}
ALL_BACKENDS # includes Worklet unit test and uses vtkm::cont::Algorithm
USE_VTKM_JOB_POOL
)
if (VTKm_ENABLE_MPI)
set(mpi_unit_tests
)
set(mpi_unit_tests_device
UnitTestContourTreeUniformDistributedFilterMPI.cxx
)
vtkm_unit_tests(
MPI SOURCES ${mpi_unit_tests}
MPI
SOURCES ${mpi_unit_tests}
DEVICE_SOURCES ${mpi_unit_tests_device}
LIBRARIES vtkm_filter vtkm_source vtkm_io
ALL_BACKENDS
USE_VTKM_JOB_POOL
)
endif()

@ -55,9 +55,8 @@ if ((TARGET vtkm::cuda) OR (TARGET vtkm::kokkos_cuda))
endif()
vtkm_unit_tests(
SOURCES ${unit_tests}
DEVICE_SOURCES ${unit_tests}
LIBRARIES ${libraries}
ALL_BACKENDS
USE_VTKM_JOB_POOL
)
@ -69,9 +68,9 @@ if (VTKm_ENABLE_MPI)
UnitTestStreamlineFilterMPI.cxx
)
vtkm_unit_tests(
MPI SOURCES ${mpi_unit_tests}
MPI
DEVICE_SOURCES ${mpi_unit_tests}
LIBRARIES vtkm_filter vtkm_source vtkm_io
ALL_BACKENDS
USE_VTKM_JOB_POOL
)
endif()

@ -44,4 +44,4 @@ vtkm_library(
target_link_libraries(vtkm_rendering_testing PUBLIC vtkm_cont_testing vtkm_rendering)
target_link_libraries(vtkm_rendering_testing PRIVATE vtkm_io)
vtkm_unit_tests(SOURCES ${unit_tests} ALL_BACKENDS LIBRARIES vtkm_rendering vtkm_rendering_testing)
vtkm_unit_tests(SOURCES ${unit_tests} LIBRARIES vtkm_rendering vtkm_rendering_testing)

@ -8,7 +8,6 @@
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#include <vtkm/cont/DeviceAdapter.h>
#include <vtkm/cont/testing/MakeTestDataSet.h>
#include <vtkm/cont/testing/Testing.h>
#include <vtkm/rendering/Actor.h>

@ -8,7 +8,6 @@
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#include <vtkm/cont/DeviceAdapter.h>
#include <vtkm/cont/testing/MakeTestDataSet.h>
#include <vtkm/cont/testing/Testing.h>
#include <vtkm/rendering/Actor.h>

@ -8,7 +8,6 @@
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#include <vtkm/cont/DeviceAdapter.h>
#include <vtkm/cont/testing/MakeTestDataSet.h>
#include <vtkm/cont/testing/Testing.h>
#include <vtkm/rendering/Actor.h>

@ -8,7 +8,6 @@
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#include <vtkm/cont/DeviceAdapter.h>
#include <vtkm/cont/testing/MakeTestDataSet.h>
#include <vtkm/cont/testing/Testing.h>
#include <vtkm/rendering/Actor.h>

@ -8,7 +8,6 @@
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#include <vtkm/cont/DeviceAdapter.h>
#include <vtkm/cont/testing/MakeTestDataSet.h>
#include <vtkm/cont/testing/Testing.h>
#include <vtkm/rendering/Actor.h>

@ -8,7 +8,6 @@
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#include <vtkm/cont/DeviceAdapter.h>
#include <vtkm/cont/testing/MakeTestDataSet.h>
#include <vtkm/cont/testing/Testing.h>
#include <vtkm/rendering/Actor.h>

@ -8,7 +8,6 @@
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#include <vtkm/cont/DeviceAdapter.h>
#include <vtkm/cont/testing/MakeTestDataSet.h>
#include <vtkm/cont/testing/Testing.h>
#include <vtkm/io/VTKDataSetReader.h>
@ -19,7 +18,6 @@
#include <vtkm/rendering/Scene.h>
#include <vtkm/rendering/View3D.h>
#include <vtkm/rendering/testing/RenderTest.h>
#include <vtkm/testing/Testing.h>
namespace
{

@ -11,7 +11,6 @@
#include <vtkm/cont/ArrayCopy.h>
#include <vtkm/cont/DataSetBuilderExplicit.h>
#include <vtkm/cont/DataSetBuilderUniform.h>
#include <vtkm/cont/DeviceAdapter.h>
#include <vtkm/cont/testing/MakeTestDataSet.h>
#include <vtkm/cont/testing/Testing.h>
#include <vtkm/rendering/CanvasRayTracer.h>

@ -8,10 +8,6 @@
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#include <vtkm/cont/DeviceAdapter.h>
#include <vtkm/cont/testing/MakeTestDataSet.h>
#include <vtkm/cont/testing/Testing.h>
#include <vtkm/rendering/Actor.h>
#include <vtkm/rendering/Canvas.h>
#include <vtkm/rendering/CanvasRayTracer.h>
@ -22,7 +18,8 @@
#include <vtkm/rendering/View3D.h>
#include <vtkm/rendering/testing/RenderTest.h>
#include <vtkm/rendering/raytracing/RayOperations.h>
#include <vtkm/cont/testing/MakeTestDataSet.h>
#include <vtkm/cont/testing/Testing.h>
namespace
{

@ -65,5 +65,9 @@ if(VTKm_ENABLE_TESTING)
vtkm_unit_tests(SOURCES ${unit_tests})
vtkm_unit_tests(NAME UnitTests_vtkm_testing_device SOURCES ${unit_tests_device} ALL_BACKENDS)
vtkm_unit_tests(
NAME UnitTests_vtkm_testing_device
DEVICE_SOURCES ${unit_tests_device}
ALL_BACKENDS
)
endif()

@ -12,4 +12,4 @@ set(unit_tests
UnitTestDispatcherBase.cxx
)
vtkm_unit_tests(SOURCES ${unit_tests} DEFINES VTKM_NO_ERROR_ON_MIXED_CUDA_CXX_TAG)
vtkm_unit_tests(DEVICE_SOURCES ${unit_tests})

@ -259,11 +259,8 @@ public:
template <typename ExecObjectType>
VTKM_EXEC vtkm::Id operator()(vtkm::Id value, ExecObjectType execObject, vtkm::Id index) const
{
#ifndef __HIP__
VTKM_TEST_ASSERT(value == TestValue(index, vtkm::Id()), "Got bad value in worklet.");
VTKM_TEST_ASSERT(execObject.Value == EXPECTED_EXEC_OBJECT_VALUE,
"Got bad exec object in worklet.");
#endif
VTKM_ASSERT(value == TestValue(index, vtkm::Id()));
VTKM_ASSERT(execObject.Value == EXPECTED_EXEC_OBJECT_VALUE);
return TestValue(index, vtkm::Id()) + 1000;
}
};

@ -51,9 +51,8 @@ set(unit_tests
)
vtkm_unit_tests(
SOURCES ${unit_tests}
DEVICE_SOURCES ${unit_tests}
LIBRARIES vtkm_source vtkm_worklet vtkm_filter vtkm_io
ALL_BACKENDS
USE_VTKM_JOB_POOL
)
if (TARGET vtkm::cuda)