Consolidate tests for base vtkm code that is device-specific

Some of the code in the base `vtkm` namespace is device specific. For
example, the functions in `Math.h` are customized for specific devices.
Thus, we want this code to be specially compiled and run on these
devices.

Previously, we made a header file and then added separate tests to each
device package. That was created before we had ways of running on any
device. Now, it is much easier to compile the test a single time for all
devices and use the `ALL_BACKENDS` feature of `vtkm_unit_tests` CMake
function to automatically create the test for all devices.
This commit is contained in:
Kenneth Moreland 2020-08-18 10:33:31 -06:00
parent 88a0cff7cb
commit ed41874cc8
19 changed files with 1254 additions and 1519 deletions

@ -9,7 +9,6 @@
##============================================================================
set(unit_tests
UnitTestCudaAlgorithms.cu
UnitTestCudaArrayHandle.cu
UnitTestCudaArrayHandleFancy.cu
UnitTestCudaArrayHandleMultiplexer.cu
@ -23,10 +22,9 @@ set(unit_tests
UnitTestCudaDataSetExplicit.cu
UnitTestCudaDataSetSingleType.cu
UnitTestCudaDeviceAdapter.cu
UnitTestCudaGeometry.cu
UnitTestCudaImplicitFunction.cu
UnitTestCudaIterators.cu
UnitTestCudaMath.cu
UnitTestCudaMathEdgeCases.cu
UnitTestCudaShareUserProvidedManagedMemory.cu
UnitTestCudaPointLocatorUniformGrid.cu
UnitTestCudaVirtualObjectHandle.cu

@ -1,20 +0,0 @@
//============================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
//
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#include <vtkm/testing/Testing.h>
#include <vtkm/testing/TestingAlgorithms.h>
#include <vtkm/cont/cuda/DeviceAdapterCuda.h>
int UnitTestCudaAlgorithms(int argc, char* argv[])
{
return vtkm::testing::Testing::Run(
RunAlgorithmsTests<vtkm::cont::DeviceAdapterTagCuda>, argc, argv);
}

@ -1,21 +0,0 @@
//============================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
//
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#include <vtkm/cont/RuntimeDeviceTracker.h>
#include <vtkm/cont/cuda/DeviceAdapterCuda.h>
#include <vtkm/testing/TestingGeometry.h>
int UnitTestCudaGeometry(int argc, char* argv[])
{
auto& tracker = vtkm::cont::GetRuntimeDeviceTracker();
tracker.ForceDevice(vtkm::cont::DeviceAdapterTagCuda{});
return vtkm::cont::testing::Testing::Run(
UnitTestGeometryNamespace::RunGeometryTests<vtkm::cont::DeviceAdapterTagCuda>, argc, argv);
}

@ -10,12 +10,12 @@
#include <vtkm/cont/RuntimeDeviceTracker.h>
#include <vtkm/cont/cuda/DeviceAdapterCuda.h>
#include <vtkm/cont/testing/Testing.h>
#include <vtkm/testing/TestingMath.h>
#include <vtkm/worklet/DispatcherMapField.h>
#include <vtkm/worklet/WorkletMapField.h>
#include <vtkm/cont/testing/Testing.h>
#include <cmath>
#include <iostream>
#include <limits>
@ -164,15 +164,11 @@ void RunEdgeCases()
} //namespace
int UnitTestCudaMath(int argc, char* argv[])
int UnitTestCudaMathEdgeCases(int argc, char* argv[])
{
auto& tracker = vtkm::cont::GetRuntimeDeviceTracker();
tracker.ForceDevice(vtkm::cont::DeviceAdapterTagCuda{});
int tests_valid = vtkm::cont::testing::Testing::Run(
UnitTestMathNamespace::RunMathTests<vtkm::cont::DeviceAdapterTagCuda>, argc, argv);
tests_valid +=
vtkm::cont::testing::Testing::Run(RunEdgeCases<vtkm::cont::DeviceAdapterTagCuda>, argc, argv);
return tests_valid;
return vtkm::cont::testing::Testing::Run(
RunEdgeCases<vtkm::cont::DeviceAdapterTagCuda>, argc, argv);
}

@ -9,7 +9,6 @@
##============================================================================
set(unit_tests
UnitTestKokkosAlgorithms.cxx
UnitTestKokkosArrayHandle.cxx
UnitTestKokkosArrayHandleFancy.cxx
UnitTestKokkosArrayHandleMultiplexer.cxx
@ -23,7 +22,6 @@ set(unit_tests
UnitTestKokkosDataSetExplicit.cxx
UnitTestKokkosDataSetSingleType.cxx
UnitTestKokkosDeviceAdapter.cxx
UnitTestKokkosGeometry.cxx
UnitTestKokkosImplicitFunction.cxx
UnitTestKokkosPointLocatorUniformGrid.cxx
UnitTestKokkosVirtualObjectHandle.cxx

@ -1,20 +0,0 @@
//============================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
//
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#include <vtkm/cont/testing/Testing.h>
#include <vtkm/testing/TestingAlgorithms.h>
#include <vtkm/cont/kokkos/DeviceAdapterKokkos.h>
int UnitTestKokkosAlgorithms(int argc, char* argv[])
{
return vtkm::cont::testing::Testing::Run(
RunAlgorithmsTests<vtkm::cont::DeviceAdapterTagKokkos>, argc, argv);
}

@ -1,21 +0,0 @@
//============================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
//
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#include <vtkm/cont/RuntimeDeviceTracker.h>
#include <vtkm/cont/kokkos/DeviceAdapterKokkos.h>
#include <vtkm/testing/TestingGeometry.h>
int UnitTestKokkosGeometry(int argc, char* argv[])
{
auto& tracker = vtkm::cont::GetRuntimeDeviceTracker();
tracker.ForceDevice(vtkm::cont::DeviceAdapterTagKokkos{});
return vtkm::cont::testing::Testing::Run(
UnitTestGeometryNamespace::RunGeometryTests<vtkm::cont::DeviceAdapterTagKokkos>, argc, argv);
}

@ -9,7 +9,6 @@
##============================================================================
set(unit_tests
UnitTestOpenMPAlgorithms.cxx
UnitTestOpenMPArrayHandle.cxx
UnitTestOpenMPArrayHandleFancy.cxx
UnitTestOpenMPArrayHandleMultiplexer.cxx

@ -1,20 +0,0 @@
//============================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
//
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#include <vtkm/testing/Testing.h>
#include <vtkm/testing/TestingAlgorithms.h>
#include <vtkm/cont/openmp/DeviceAdapterOpenMP.h>
int UnitTestOpenMPAlgorithms(int argc, char* argv[])
{
return vtkm::testing::Testing::Run(
RunAlgorithmsTests<vtkm::cont::DeviceAdapterTagOpenMP>, argc, argv);
}

@ -22,7 +22,6 @@ set(unit_tests
UnitTestSerialDataSetExplicit.cxx
UnitTestSerialDataSetSingleType.cxx
UnitTestSerialDeviceAdapter.cxx
UnitTestSerialGeometry.cxx
UnitTestSerialImplicitFunction.cxx
UnitTestSerialPointLocatorUniformGrid.cxx
UnitTestSerialVirtualObjectHandle.cxx

@ -1,21 +0,0 @@
//============================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
//
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#include <vtkm/cont/RuntimeDeviceTracker.h>
#include <vtkm/cont/serial/DeviceAdapterSerial.h>
#include <vtkm/testing/TestingGeometry.h>
int UnitTestSerialGeometry(int argc, char* argv[])
{
auto& tracker = vtkm::cont::GetRuntimeDeviceTracker();
tracker.ForceDevice(vtkm::cont::DeviceAdapterTagSerial{});
return vtkm::cont::testing::Testing::Run(
UnitTestGeometryNamespace::RunGeometryTests<vtkm::cont::DeviceAdapterTagSerial>, argc, argv);
}

@ -9,7 +9,6 @@
##============================================================================
set(unit_tests
UnitTestTBBAlgorithms.cxx
UnitTestTBBArrayHandle.cxx
UnitTestTBBArrayHandleFancy.cxx
UnitTestTBBArrayHandleMultiplexer.cxx

@ -1,20 +0,0 @@
//============================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
//
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#include <vtkm/testing/Testing.h>
#include <vtkm/testing/TestingAlgorithms.h>
#include <vtkm/cont/tbb/DeviceAdapterTBB.h>
int UnitTestTBBAlgorithms(int argc, char* argv[])
{
return vtkm::testing::Testing::Run(
RunAlgorithmsTests<vtkm::cont::DeviceAdapterTagTBB>, argc, argv);
}

@ -10,16 +10,12 @@
set(headers
Testing.h
TestingAlgorithms.h
TestingMath.h
TestingGeometry.h
VecTraitsTests.h
)
VTKM_declare_headers(${headers})
set(unit_tests
UnitTestAlgorithms.cxx
UnitTestBinaryPredicates.cxx
UnitTestBinaryOperators.cxx
UnitTestBounds.cxx
@ -29,7 +25,6 @@ set(unit_tests
UnitTestHash.cxx
UnitTestList.cxx
UnitTestListTag.cxx
UnitTestMath.cxx
UnitTestMatrix.cxx
UnitTestNewtonsMethod.cxx
UnitTestNoAssert.cxx
@ -51,6 +46,13 @@ set(unit_tests
UnitTestVecVariable.cxx
)
# Unit tests that have device-specific code to be tested
set(unit_tests_device
UnitTestAlgorithms.cxx
UnitTestGeometry.cxx
UnitTestMath.cxx
)
#suppress gcc note:
#variable tracking size limit exceeded with -fvar-tracking-assignments, retrying without
@ -59,3 +61,5 @@ if (VTKM_COMPILER_IS_GNU)
endif()
vtkm_unit_tests(SOURCES ${unit_tests})
vtkm_unit_tests(NAME UnitTests_vtkm_testing_device SOURCES ${unit_tests_device} ALL_BACKENDS)

@ -1,230 +0,0 @@
//============================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
//
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#ifndef vtk_m_testing_TestingAlgorithms_h
#define vtk_m_testing_TestingAlgorithms_h
#include <vtkm/Algorithms.h>
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
#include <vtkm/exec/FunctorBase.h>
#include <vtkm/testing/Testing.h>
#include <vector>
namespace
{
using IdArray = vtkm::cont::ArrayHandle<vtkm::Id>;
struct TestBinarySearch
{
template <typename NeedlesT, typename HayStackT, typename ResultsT>
struct Impl : public vtkm::exec::FunctorBase
{
NeedlesT Needles;
HayStackT HayStack;
ResultsT Results;
VTKM_CONT
Impl(const NeedlesT& needles, const HayStackT& hayStack, const ResultsT& results)
: Needles(needles)
, HayStack(hayStack)
, Results(results)
{
}
VTKM_EXEC
void operator()(vtkm::Id index) const
{
this->Results.Set(index, vtkm::BinarySearch(this->HayStack, this->Needles.Get(index)));
}
};
template <typename Device>
static void Run()
{
using Algo = vtkm::cont::DeviceAdapterAlgorithm<Device>;
IdArray needles = vtkm::cont::make_ArrayHandle<vtkm::Id>({ -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 });
IdArray hayStack =
vtkm::cont::make_ArrayHandle<vtkm::Id>({ -3, -2, -2, -2, 0, 0, 1, 1, 1, 4, 4 });
IdArray results;
std::vector<bool> expectedFound{
false, true, true, false, true, true, false, false, true, false
};
vtkm::cont::Token token;
using Functor = Impl<typename IdArray::ExecutionTypes<Device>::PortalConst,
typename IdArray::ExecutionTypes<Device>::PortalConst,
typename IdArray::ExecutionTypes<Device>::Portal>;
Functor functor{ needles.PrepareForInput(Device{}, token),
hayStack.PrepareForInput(Device{}, token),
results.PrepareForOutput(needles.GetNumberOfValues(), Device{}, token) };
Algo::Schedule(functor, needles.GetNumberOfValues());
token.DetachFromAll();
// Verify:
auto needlesPortal = needles.ReadPortal();
auto hayStackPortal = hayStack.ReadPortal();
auto resultsPortal = results.ReadPortal();
for (vtkm::Id i = 0; i < needles.GetNumberOfValues(); ++i)
{
if (expectedFound[static_cast<size_t>(i)])
{
const auto resIdx = resultsPortal.Get(i);
const auto expVal = needlesPortal.Get(i);
VTKM_TEST_ASSERT(resIdx >= 0);
VTKM_TEST_ASSERT(hayStackPortal.Get(resIdx) == expVal);
}
else
{
VTKM_TEST_ASSERT(resultsPortal.Get(i) == -1);
}
}
}
};
struct TestLowerBound
{
template <typename NeedlesT, typename HayStackT, typename ResultsT>
struct Impl : public vtkm::exec::FunctorBase
{
NeedlesT Needles;
HayStackT HayStack;
ResultsT Results;
VTKM_CONT
Impl(const NeedlesT& needles, const HayStackT& hayStack, const ResultsT& results)
: Needles(needles)
, HayStack(hayStack)
, Results(results)
{
}
VTKM_EXEC
void operator()(vtkm::Id index) const
{
this->Results.Set(index, vtkm::LowerBound(this->HayStack, this->Needles.Get(index)));
}
};
template <typename Device>
static void Run()
{
using Algo = vtkm::cont::DeviceAdapterAlgorithm<Device>;
IdArray needles = vtkm::cont::make_ArrayHandle<vtkm::Id>({ -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 });
IdArray hayStack =
vtkm::cont::make_ArrayHandle<vtkm::Id>({ -3, -2, -2, -2, 0, 0, 1, 1, 1, 4, 4 });
IdArray results;
std::vector<vtkm::Id> expected{ 0, 0, 1, 4, 4, 6, 9, 9, 9, 11 };
vtkm::cont::Token token;
using Functor = Impl<typename IdArray::ExecutionTypes<Device>::PortalConst,
typename IdArray::ExecutionTypes<Device>::PortalConst,
typename IdArray::ExecutionTypes<Device>::Portal>;
Functor functor{ needles.PrepareForInput(Device{}, token),
hayStack.PrepareForInput(Device{}, token),
results.PrepareForOutput(needles.GetNumberOfValues(), Device{}, token) };
Algo::Schedule(functor, needles.GetNumberOfValues());
token.DetachFromAll();
// Verify:
auto resultsPortal = results.ReadPortal();
for (vtkm::Id i = 0; i < needles.GetNumberOfValues(); ++i)
{
VTKM_TEST_ASSERT(resultsPortal.Get(i) == expected[static_cast<size_t>(i)]);
}
}
};
struct TestUpperBound
{
template <typename NeedlesT, typename HayStackT, typename ResultsT>
struct Impl : public vtkm::exec::FunctorBase
{
NeedlesT Needles;
HayStackT HayStack;
ResultsT Results;
VTKM_CONT
Impl(const NeedlesT& needles, const HayStackT& hayStack, const ResultsT& results)
: Needles(needles)
, HayStack(hayStack)
, Results(results)
{
}
VTKM_EXEC
void operator()(vtkm::Id index) const
{
this->Results.Set(index, vtkm::UpperBound(this->HayStack, this->Needles.Get(index)));
}
};
template <typename Device>
static void Run()
{
using Algo = vtkm::cont::DeviceAdapterAlgorithm<Device>;
IdArray needles = vtkm::cont::make_ArrayHandle<vtkm::Id>({ -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 });
IdArray hayStack =
vtkm::cont::make_ArrayHandle<vtkm::Id>({ -3, -2, -2, -2, 0, 0, 1, 1, 1, 4, 4 });
IdArray results;
std::vector<vtkm::Id> expected{ 0, 1, 4, 4, 6, 9, 9, 9, 11, 11 };
vtkm::cont::Token token;
using Functor = Impl<typename IdArray::ExecutionTypes<Device>::PortalConst,
typename IdArray::ExecutionTypes<Device>::PortalConst,
typename IdArray::ExecutionTypes<Device>::Portal>;
Functor functor{ needles.PrepareForInput(Device{}, token),
hayStack.PrepareForInput(Device{}, token),
results.PrepareForOutput(needles.GetNumberOfValues(), Device{}, token) };
Algo::Schedule(functor, needles.GetNumberOfValues());
token.DetachFromAll();
// Verify:
auto resultsPortal = results.ReadPortal();
for (vtkm::Id i = 0; i < needles.GetNumberOfValues(); ++i)
{
VTKM_TEST_ASSERT(resultsPortal.Get(i) == expected[static_cast<size_t>(i)]);
}
}
};
} // anon namespace
template <typename Device>
void RunAlgorithmsTests()
{
std::cout << "Testing binary search." << std::endl;
TestBinarySearch::Run<Device>();
std::cout << "Testing lower bound." << std::endl;
TestLowerBound::Run<Device>();
std::cout << "Testing upper bound." << std::endl;
TestUpperBound::Run<Device>();
}
#endif //vtk_m_testing_TestingAlgorithms_h

File diff suppressed because it is too large Load Diff

@ -8,13 +8,157 @@
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#include <vtkm/testing/Testing.h>
#include <vtkm/testing/TestingAlgorithms.h>
#include <vtkm/Algorithms.h>
#include <vtkm/cont/serial/DeviceAdapterSerial.h>
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/Invoker.h>
#include <vtkm/worklet/WorkletMapField.h>
#include <vtkm/cont/testing/Testing.h>
#include <vector>
namespace
{
using IdArray = vtkm::cont::ArrayHandle<vtkm::Id>;
struct TestBinarySearch
{
struct Impl : public vtkm::worklet::WorkletMapField
{
using ControlSignature = void(FieldIn needles, WholeArrayIn haystack, FieldOut results);
using ExecutionSignature = _3(_1, _2);
using InputDomain = _1;
template <typename HaystackPortal>
VTKM_EXEC vtkm::Id operator()(vtkm::Id needle, const HaystackPortal& haystack) const
{
return vtkm::BinarySearch(haystack, needle);
}
};
static void Run()
{
IdArray needles = vtkm::cont::make_ArrayHandle<vtkm::Id>({ -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 });
IdArray haystack =
vtkm::cont::make_ArrayHandle<vtkm::Id>({ -3, -2, -2, -2, 0, 0, 1, 1, 1, 4, 4 });
IdArray results;
std::vector<bool> expectedFound{
false, true, true, false, true, true, false, false, true, false
};
vtkm::cont::Invoker invoke;
invoke(Impl{}, needles, haystack, results);
// Verify:
auto needlesPortal = needles.ReadPortal();
auto haystackPortal = haystack.ReadPortal();
auto resultsPortal = results.ReadPortal();
for (vtkm::Id i = 0; i < needles.GetNumberOfValues(); ++i)
{
if (expectedFound[static_cast<size_t>(i)])
{
const auto resIdx = resultsPortal.Get(i);
const auto expVal = needlesPortal.Get(i);
VTKM_TEST_ASSERT(resIdx >= 0);
VTKM_TEST_ASSERT(haystackPortal.Get(resIdx) == expVal);
}
else
{
VTKM_TEST_ASSERT(resultsPortal.Get(i) == -1);
}
}
}
};
struct TestLowerBound
{
struct Impl : public vtkm::worklet::WorkletMapField
{
using ControlSignature = void(FieldIn needles, WholeArrayIn haystack, FieldOut results);
using ExecutionSignature = _3(_1, _2);
using InputDomain = _1;
template <typename HaystackPortal>
VTKM_EXEC vtkm::Id operator()(vtkm::Id needle, const HaystackPortal& haystack) const
{
return vtkm::LowerBound(haystack, needle);
}
};
static void Run()
{
IdArray needles = vtkm::cont::make_ArrayHandle<vtkm::Id>({ -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 });
IdArray haystack =
vtkm::cont::make_ArrayHandle<vtkm::Id>({ -3, -2, -2, -2, 0, 0, 1, 1, 1, 4, 4 });
IdArray results;
std::vector<vtkm::Id> expected{ 0, 0, 1, 4, 4, 6, 9, 9, 9, 11 };
vtkm::cont::Invoker invoke;
invoke(Impl{}, needles, haystack, results);
// Verify:
auto resultsPortal = results.ReadPortal();
for (vtkm::Id i = 0; i < needles.GetNumberOfValues(); ++i)
{
VTKM_TEST_ASSERT(resultsPortal.Get(i) == expected[static_cast<size_t>(i)]);
}
}
};
struct TestUpperBound
{
struct Impl : public vtkm::worklet::WorkletMapField
{
using ControlSignature = void(FieldIn needles, WholeArrayIn haystack, FieldOut results);
using ExecutionSignature = _3(_1, _2);
using InputDomain = _1;
template <typename HaystackPortal>
VTKM_EXEC vtkm::Id operator()(vtkm::Id needle, const HaystackPortal& haystack) const
{
return vtkm::UpperBound(haystack, needle);
}
};
static void Run()
{
IdArray needles = vtkm::cont::make_ArrayHandle<vtkm::Id>({ -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 });
IdArray haystack =
vtkm::cont::make_ArrayHandle<vtkm::Id>({ -3, -2, -2, -2, 0, 0, 1, 1, 1, 4, 4 });
IdArray results;
std::vector<vtkm::Id> expected{ 0, 1, 4, 4, 6, 9, 9, 9, 11, 11 };
vtkm::cont::Invoker invoke;
invoke(Impl{}, needles, haystack, results);
// Verify:
auto resultsPortal = results.ReadPortal();
for (vtkm::Id i = 0; i < needles.GetNumberOfValues(); ++i)
{
VTKM_TEST_ASSERT(resultsPortal.Get(i) == expected[static_cast<size_t>(i)]);
}
}
};
void RunAlgorithmsTests()
{
std::cout << "Testing binary search." << std::endl;
TestBinarySearch::Run();
std::cout << "Testing lower bound." << std::endl;
TestLowerBound::Run();
std::cout << "Testing upper bound." << std::endl;
TestUpperBound::Run();
}
} // anon namespace
int UnitTestAlgorithms(int argc, char* argv[])
{
return vtkm::testing::Testing::Run(
RunAlgorithmsTests<vtkm::cont::DeviceAdapterTagSerial>, argc, argv);
return vtkm::cont::testing::Testing::Run(RunAlgorithmsTests, argc, argv);
}

@ -7,8 +7,6 @@
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#ifndef vtk_m_testing_TestingGeometry_h
#define vtk_m_testing_TestingGeometry_h
#include <vtkm/Geometry.h>
#include <vtkm/Math.h>
@ -18,7 +16,7 @@
#include <vtkm/exec/FunctorBase.h>
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
#include <vtkm/cont/Algorithm.h>
#include <vtkm/cont/testing/Testing.h>
@ -29,7 +27,7 @@
}
//-----------------------------------------------------------------------------
namespace UnitTestGeometryNamespace
namespace
{
class Coords
@ -126,13 +124,12 @@ struct RayTests : public vtkm::exec::FunctorBase
}
};
template <typename Device>
struct TryRayTests
{
template <typename T>
void operator()(const T&) const
{
vtkm::cont::DeviceAdapterAlgorithm<Device>::Schedule(RayTests<T>(), 1);
vtkm::cont::Algorithm::Schedule(RayTests<T>(), 1);
}
};
@ -215,13 +212,12 @@ struct LineSegmentTests : public vtkm::exec::FunctorBase
}
};
template <typename Device>
struct TryLineSegmentTests
{
template <typename T>
void operator()(const T&) const
{
vtkm::cont::DeviceAdapterAlgorithm<Device>::Schedule(LineSegmentTests<T>(), 1);
vtkm::cont::Algorithm::Schedule(LineSegmentTests<T>(), 1);
}
};
@ -349,13 +345,12 @@ struct PlaneTests : public vtkm::exec::FunctorBase
}
};
template <typename Device>
struct TryPlaneTests
{
template <typename T>
void operator()(const T&) const
{
vtkm::cont::DeviceAdapterAlgorithm<Device>::Schedule(PlaneTests<T>(), 1);
vtkm::cont::Algorithm::Schedule(PlaneTests<T>(), 1);
}
};
@ -457,30 +452,31 @@ struct SphereTests : public vtkm::exec::FunctorBase
}
};
template <typename Device>
struct TrySphereTests
{
template <typename T>
void operator()(const T&) const
{
vtkm::cont::DeviceAdapterAlgorithm<Device>::Schedule(SphereTests<T>(), 1);
vtkm::cont::Algorithm::Schedule(SphereTests<T>(), 1);
}
};
//-----------------------------------------------------------------------------
template <typename Device>
void RunGeometryTests()
{
std::cout << "Tests for rays." << std::endl;
vtkm::testing::Testing::TryTypes(TryRayTests<Device>(), vtkm::TypeListFieldScalar());
vtkm::testing::Testing::TryTypes(TryRayTests(), vtkm::TypeListFieldScalar());
std::cout << "Tests for line segments." << std::endl;
vtkm::testing::Testing::TryTypes(TryLineSegmentTests<Device>(), vtkm::TypeListFieldScalar());
vtkm::testing::Testing::TryTypes(TryLineSegmentTests(), vtkm::TypeListFieldScalar());
std::cout << "Tests for planes." << std::endl;
vtkm::testing::Testing::TryTypes(TryPlaneTests<Device>(), vtkm::TypeListFieldScalar());
vtkm::testing::Testing::TryTypes(TryPlaneTests(), vtkm::TypeListFieldScalar());
std::cout << "Tests for spheres." << std::endl;
vtkm::testing::Testing::TryTypes(TrySphereTests<Device>(), vtkm::TypeListFieldScalar());
vtkm::testing::Testing::TryTypes(TrySphereTests(), vtkm::TypeListFieldScalar());
}
} // namespace UnitTestGeometryNamespace
} // anonymous namespace
#endif //vtk_m_testing_TestingGeometry_h
int UnitTestGeometry(int argc, char* argv[])
{
return vtkm::cont::testing::Testing::Run(RunGeometryTests, argc, argv);
}

File diff suppressed because it is too large Load Diff