Commit c2101b8f authored by Robert Maynard's avatar Robert Maynard

Add in a serial device adapter and required supporting classes.

We now can verify that the array handle is usable by a device adapter.
parent a94abd7a
//============================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//
// Copyright 2014 Sandia Corporation.
// Copyright 2014 UT-Battelle, LLC.
// Copyright 2014. Los Alamos National Security
//
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
// 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.
//============================================================================
#ifndef vtkm_cont_ArrayHandleCounting_h
#define vtkm_cont_ArrayHandleCounting_h
#include <vtkm/cont/ArrayContainerControlImplicit.h>
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/internal/IteratorFromArrayPortal.h>
namespace vtkm {
namespace cont {
namespace internal {
/// \brief An implicit array portal that returns an counting value.
template <class CountingValueType>
class ArrayPortalCounting
{
public:
typedef CountingValueType ValueType;
VTKM_EXEC_CONT_EXPORT
ArrayPortalCounting() :
StartingValue(),
NumberOfValues(0)
{ }
VTKM_EXEC_CONT_EXPORT
ArrayPortalCounting(ValueType startingValue, vtkm::Id numValues) :
StartingValue(startingValue),
NumberOfValues(numValues)
{ }
template<typename OtherValueType>
VTKM_EXEC_CONT_EXPORT
ArrayPortalCounting(const ArrayPortalCounting<OtherValueType> &src)
: StartingValue(src.StartingValue),
NumberOfValues(src.NumberOfValues)
{ }
template<typename OtherValueType>
VTKM_EXEC_CONT_EXPORT
ArrayPortalCounting<ValueType> &operator=(
const ArrayPortalCounting<OtherValueType> &src)
{
this->StartingValue = src.StartingValue;
this->NumberOfValues = src.NumberOfValues;
return *this;
}
VTKM_EXEC_CONT_EXPORT
vtkm::Id GetNumberOfValues() const { return this->NumberOfValues; }
VTKM_EXEC_CONT_EXPORT
ValueType Get(vtkm::Id index) const { return StartingValue+index; }
typedef vtkm::cont::internal::IteratorFromArrayPortal<
ArrayPortalCounting < CountingValueType> > IteratorType;
VTKM_CONT_EXPORT
IteratorType GetIteratorBegin() const
{
return IteratorType(*this);
}
VTKM_CONT_EXPORT
IteratorType GetIteratorEnd() const
{
return IteratorType(*this, this->NumberOfValues);
}
private:
CountingValueType StartingValue;
vtkm::Id NumberOfValues;
};
/// A convenience class that provides a typedef to the appropriate tag for
/// a counting array container.
template<typename ConstantValueType>
struct ArrayHandleCountingTraits
{
typedef vtkm::cont::ArrayContainerControlTagImplicit<
vtkm::cont::internal::ArrayPortalCounting<ConstantValueType> > Tag;
};
} // namespace internal
/// ArrayHandleCountings is a specialization of ArrayHandle. By default it
/// contains a increment value, that is increment for each step between zero
/// and the passed in length
template <typename CountingValueType>
class ArrayHandleCounting
: public vtkm::cont::ArrayHandle <
CountingValueType,
typename internal::ArrayHandleCountingTraits<CountingValueType>::Tag
>
{
typedef vtkm::cont::ArrayHandle <
CountingValueType,
typename internal::ArrayHandleCountingTraits<CountingValueType>::Tag
> Superclass;
public:
ArrayHandleCounting(CountingValueType startingValue, vtkm::Id length)
:Superclass(typename Superclass::PortalConstControl(startingValue, length))
{
}
ArrayHandleCounting():Superclass() {}
};
/// A convenience function for creating an ArrayHandleCounting. It takes the
/// value to start counting from and and the number of times to increment.
template<typename CountingValueType>
VTKM_CONT_EXPORT
vtkm::cont::ArrayHandleCounting<CountingValueType>
make_ArrayHandleCounting(CountingValueType startingValue,
vtkm::Id length)
{
return vtkm::cont::ArrayHandleCounting<CountingValueType>(startingValue,
length);
}
}
} // namespace vtkm::cont
#endif //vtkm_cont_ArrayHandleCounting_h
......@@ -27,6 +27,8 @@ set(headers
ArrayHandle.h
ArrayPortal.h
Assert.h
DeviceAdapter.h
DeviceAdapterSerial.h
Error.h
ErrorControl.h
ErrorControlAssert.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 2014 Sandia Corporation.
// Copyright 2014 UT-Battelle, LLC.
// Copyright 2014. Los Alamos National Security
//
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
// 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.
//============================================================================
#ifndef vtkm_cont_DeviceAdapter_h
#define vtkm_cont_DeviceAdapter_h
// These are listed in non-alphabetical order because this is the conceptual
// order in which the sub-files are loaded. (But the compile should still
// succeed of the order is changed.)
#include <vtkm/cont/internal/DeviceAdapterTag.h>
#include <vtkm/cont/internal/ArrayManagerExecution.h>
#include <vtkm/cont/internal/DeviceAdapterAlgorithm.h>
namespace vtkm {
namespace cont {
#ifdef VTKM_DOXYGEN_ONLY
/// \brief A tag specifying the interface between the control and execution environments.
///
/// A DeviceAdapter tag specifies a set of functions and classes that provide
/// mechanisms to run algorithms on a type of parallel device. The tag
/// DeviceAdapterTag___ does not actually exist. Rather, this documentation is
/// provided to describe the interface for a DeviceAdapter. Loading the
/// dax/cont/DeviceAdapter.h header file will set a default device adapter
/// appropriate for the current compile environment. You can specify the
/// default device adapter by first setting the \c VTKM_DEVICE_ADAPTER macro.
/// Valid values for \c VTKM_DEVICE_ADAPTER are the following:
///
/// \li \c VTKM_DEVICE_ADAPTER_SERIAL Runs all algorithms in serial. Can be
/// helpful for debugging.
/// \li \c VTKM_DEVICE_ADAPTER_CUDA Dispatches and runs algorithms on a GPU
/// using CUDA. Must be compiling with a CUDA compiler (nvcc).
/// \li \c VTKM_DEVICE_ADAPTER_OPENMP Dispatches an algorithm over multiple
/// CPU cores using OpenMP compiler directives. Must be compiling with an
/// OpenMP-compliant compiler with OpenMP pragmas enabled.
/// \li \c VTKM_DEVICE_ADAPTER_TBB Dispatches and runs algorithms on multiple
/// threads using the Intel Threading Building Blocks (TBB) libraries. Must
/// have the TBB headers available and the resulting code must be linked with
/// the TBB libraries.
///
/// See the ArrayManagerExecution.h and DeviceAdapterAlgorithm.h files for
/// documentation on all the functions and classes that must be
/// overloaded/specialized to create a new device adapter.
///
struct DeviceAdapterTag___ { };
#endif //VTKM_DOXYGEN_ONLY
namespace internal {
} // namespace internal
}
} // namespace vtkm::cont
#endif //vtkm_cont_DeviceAdapter_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 2014 Sandia Corporation.
// Copyright 2014 UT-Battelle, LLC.
// Copyright 2014. Los Alamos National Security
//
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
// 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.
//============================================================================
#ifndef vtkm_cont_DeviceAdapterSerial_h
#define vtkm_cont_DeviceAdapterSerial_h
#include <vtkm/cont/internal/DeviceAdapterTagSerial.h>
#include <vtkm/cont/internal/ArrayManagerExecutionSerial.h>
#include <vtkm/cont/internal/DeviceAdapterAlgorithmSerial.h>
#endif //vtkm_cont_DeviceAdapterSerial_h
......@@ -26,6 +26,13 @@ set(headers
ArrayPortalFromIterators.h
ArrayPortalShrink.h
ArrayTransfer.h
DeviceAdapterAlgorithm.h
DeviceAdapterAlgorithmGeneral.h
DeviceAdapterAlgorithmSerial.h
DeviceAdapterError.h
DeviceAdapterTag.h
DeviceAdapterTagSerial.h
IteratorFromArrayPortal.h
)
vtkm_declare_headers(${headers})
......
This diff is collapsed.
This diff is collapsed.
//============================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//
// Copyright 2014 Sandia Corporation.
// Copyright 2014 UT-Battelle, LLC.
// Copyright 2014. Los Alamos National Security
//
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
// 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.
//============================================================================
#ifndef vtkm_cont_internal_DeviceAdapterAlgorithmSerial_h
#define vtkm_cont_internal_DeviceAdapterAlgorithmSerial_h
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/ErrorExecution.h>
#include <vtkm/cont/internal/DeviceAdapterAlgorithm.h>
#include <vtkm/cont/internal/DeviceAdapterAlgorithmGeneral.h>
#include <vtkm/cont/internal/DeviceAdapterTagSerial.h>
#include <vtkm/exec/internal/ErrorMessageBuffer.h>
#include <boost/iterator/counting_iterator.hpp>
#include <boost/utility/enable_if.hpp>
#include <algorithm>
#include <numeric>
namespace vtkm {
namespace cont {
template<>
struct DeviceAdapterAlgorithm<vtkm::cont::DeviceAdapterTagSerial> :
vtkm::cont::internal::DeviceAdapterAlgorithmGeneral<
DeviceAdapterAlgorithm<vtkm::cont::DeviceAdapterTagSerial>,
vtkm::cont::DeviceAdapterTagSerial>
{
private:
typedef vtkm::cont::DeviceAdapterTagSerial Device;
public:
template<typename T, class CIn, class COut>
VTKM_CONT_EXPORT static T ScanInclusive(
const vtkm::cont::ArrayHandle<T,CIn> &input,
vtkm::cont::ArrayHandle<T,COut>& output)
{
typedef typename vtkm::cont::ArrayHandle<T,COut>
::template ExecutionTypes<Device>::Portal PortalOut;
typedef typename vtkm::cont::ArrayHandle<T,CIn>
::template ExecutionTypes<Device>::PortalConst PortalIn;
vtkm::Id numberOfValues = input.GetNumberOfValues();
PortalIn inputPortal = input.PrepareForInput(Device());
PortalOut outputPortal = output.PrepareForOutput(numberOfValues, Device());
if (numberOfValues <= 0) { return 0; }
std::partial_sum(inputPortal.GetIteratorBegin(),
inputPortal.GetIteratorEnd(),
outputPortal.GetIteratorBegin());
// Return the value at the last index in the array, which is the full sum.
return outputPortal.Get(numberOfValues - 1);
}
template<typename T, class CIn, class COut>
VTKM_CONT_EXPORT static T ScanExclusive(
const vtkm::cont::ArrayHandle<T,CIn> &input,
vtkm::cont::ArrayHandle<T,COut>& output)
{
typedef typename vtkm::cont::ArrayHandle<T,COut>
::template ExecutionTypes<Device>::Portal PortalOut;
typedef typename vtkm::cont::ArrayHandle<T,CIn>
::template ExecutionTypes<Device>::PortalConst PortalIn;
vtkm::Id numberOfValues = input.GetNumberOfValues();
PortalIn inputPortal = input.PrepareForInput(Device());
PortalOut outputPortal = output.PrepareForOutput(numberOfValues, Device());
if (numberOfValues <= 0) { return 0; }
std::partial_sum(inputPortal.GetIteratorBegin(),
inputPortal.GetIteratorEnd(),
outputPortal.GetIteratorBegin());
T fullSum = outputPortal.Get(numberOfValues - 1);
// Shift right by one
std::copy_backward(outputPortal.GetIteratorBegin(),
outputPortal.GetIteratorEnd()-1,
outputPortal.GetIteratorEnd());
outputPortal.Set(0, 0);
return fullSum;
}
private:
// This runs in the execution environment.
template<class FunctorType>
class ScheduleKernel
{
public:
ScheduleKernel(const FunctorType &functor)
: Functor(functor) { }
//needed for when calling from schedule on a range
VTKM_EXEC_EXPORT void operator()(vtkm::Id index) const
{
this->Functor(index);
}
private:
const FunctorType Functor;
};
public:
template<class Functor>
VTKM_CONT_EXPORT static void Schedule(Functor functor,
vtkm::Id numInstances)
{
const vtkm::Id MESSAGE_SIZE = 1024;
char errorString[MESSAGE_SIZE];
errorString[0] = '\0';
vtkm::exec::internal::ErrorMessageBuffer
errorMessage(errorString, MESSAGE_SIZE);
functor.SetErrorMessageBuffer(errorMessage);
DeviceAdapterAlgorithm<Device>::ScheduleKernel<Functor> kernel(functor);
std::for_each(
::boost::counting_iterator<vtkm::Id>(0),
::boost::counting_iterator<vtkm::Id>(numInstances),
kernel);
if (errorMessage.IsErrorRaised())
{
throw vtkm::cont::ErrorExecution(errorString);
}
}
template<class FunctorType>
VTKM_CONT_EXPORT
static void Schedule(FunctorType functor, vtkm::Id3 rangeMax)
{
DeviceAdapterAlgorithm<Device>::Schedule(functor,
rangeMax[0] * rangeMax[1] * rangeMax[2] );
}
template<typename T, class Container>
VTKM_CONT_EXPORT static void Sort(vtkm::cont::ArrayHandle<T,Container>& values)
{
typedef typename vtkm::cont::ArrayHandle<T,Container>
::template ExecutionTypes<Device>::Portal PortalType;
PortalType arrayPortal = values.PrepareForInPlace(Device());
std::sort(arrayPortal.GetIteratorBegin(), arrayPortal.GetIteratorEnd());
}
template<typename T, class Container, class Compare>
VTKM_CONT_EXPORT static void Sort(vtkm::cont::ArrayHandle<T,Container>& values,
Compare comp)
{
typedef typename vtkm::cont::ArrayHandle<T,Container>
::template ExecutionTypes<Device>::Portal PortalType;
PortalType arrayPortal = values.PrepareForInPlace(Device());
std::sort(arrayPortal.GetIteratorBegin(), arrayPortal.GetIteratorEnd(),comp);
}
VTKM_CONT_EXPORT static void Synchronize()
{
// Nothing to do. This device is serial and has no asynchronous operations.
}
};
}
} // namespace vtkm::cont
#endif //vtkm_cont_internal_DeviceAdapterAlgorithmSerial_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 2014 Sandia Corporation.
// Copyright 2014 UT-Battelle, LLC.
// Copyright 2014. Los Alamos National Security
//
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
// 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.
//============================================================================
#ifndef vtkm_cont_internal_DeviceAdapterError_h
#define vtkm_cont_internal_DeviceAdapterError_h
#include <vtkm/cont/internal/DeviceAdapterTag.h>
/// This is an invalid DeviceAdapter. The point of this class is to include the
/// header file to make this invalid class the default DeviceAdapter. From that
/// point, you have to specify an appropriate DeviceAdapter or else get a
/// compile error.
///
VTKM_CREATE_DEVICE_ADAPTER(Error);
#endif //vtkm_cont_internal_DeviceAdapterError_h
......@@ -91,6 +91,11 @@ struct DeviceAdapterTagCheck
#include <vtkm/cont/internal/DeviceAdapterTagSerial.h>
#define VTKM_DEFAULT_DEVICE_ADAPTER_TAG ::vtkm::cont::DeviceAdapterTagSerial
#elif VTKM_DEVICE_ADAPTER == VTKM_DEVICE_ADAPTER_ERROR
#include <vtkm/cont/internal/DeviceAdapterError.h>
#define VTKM_DEFAULT_DEVICE_ADAPTER_TAG ::vtkm::cont::DeviceAdapterTagError
#elif (VTKM_DEVICE_ADAPTER == VTKM_DEVICE_ADAPTER_UNDEFINED) || !defined(VTKM_DEVICE_ADAPTER)
#ifndef VTKM_DEFAULT_DEVICE_ADAPTER_TAG
......
......@@ -22,6 +22,6 @@
set(unit_tests
UnitTestArrayManagerExecutionShareWithControl.cxx
UnitTestArrayPortalFromIterators.cxx
# UnitTestIteratorFromArrayPortal.cxx
UnitTestIteratorFromArrayPortal.cxx
)
vtkm_unit_tests(SOURCES ${unit_tests})
......@@ -20,6 +20,7 @@
set(headers
Testing.h
TestingDeviceAdapter.h
)
vtkm_declare_headers(${headers})
......@@ -28,7 +29,11 @@ set(unit_tests
UnitTestArrayContainerControlBasic.cxx
UnitTestArrayContainerControlImplicit.cxx
UnitTestArrayHandle.cxx
UnitTestArrayHandleCounting.cxx
UnitTestContTesting.cxx
UnitTestDeviceAdapterAlgorithmDependency.cxx
UnitTestDeviceAdapterAlgorithmGeneral.cxx
UnitTestDeviceAdapterSerial.cxx
)
vtkm_unit_tests(SOURCES ${unit_tests})
......
This diff is collapsed.
//============================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//
// Copyright 2014 Sandia Corporation.
// Copyright 2014 UT-Battelle, LLC.
// Copyright 2014. Los Alamos National Security
//
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
// the U.S. Government retains certain rights in this software.
//
// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
// Laboratory (LANL), the U.S. Government retains certain rights in
// this software.
//============================================================================
#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_SERIAL
#include <vtkm/cont/ArrayHandleCounting.h>
#include <vtkm/cont/testing/Testing.h>
namespace {
const vtkm::Id ARRAY_SIZE = 10;
//increments by two instead of one wrapper
template<typename T>
struct CountByTwo
{
CountByTwo(): Value() {}
explicit CountByTwo(T t): Value(t) {}
bool operator==(const T& other) const
{ return Value == other; }
bool operator==(const CountByTwo<T>& other) const
{ return Value == other.Value; }
CountByTwo<T> operator+(vtkm::Id count) const
{ return CountByTwo<T>(Value+(count*2)); }
CountByTwo<T>& operator++()
{ ++Value; ++Value; return *this; }
friend std::ostream& operator<< (std::ostream& os, const CountByTwo<T>& obj)
{ os << obj.Value; return os; }
T Value;
};
template< typename ValueType>
struct TemplatedTests
{
typedef vtkm::cont::ArrayHandleCounting<ValueType> ArrayHandleType;
typedef vtkm::cont::ArrayHandle<ValueType,
typename vtkm::cont::internal::ArrayHandleCountingTraits<ValueType>::Tag>
ArrayHandleType2;
typedef typename ArrayHandleType::PortalConstControl PortalType;
void operator()( const ValueType startingValue )
{
ArrayHandleType arrayConst(startingValue, ARRAY_SIZE);
ArrayHandleType arrayMake = vtkm::cont::make_ArrayHandleCounting(startingValue,ARRAY_SIZE);
ArrayHandleType2 arrayHandle =
ArrayHandleType2(PortalType(startingValue, ARRAY_SIZE));
VTKM_TEST_ASSERT(arrayConst.GetNumberOfValues() == ARRAY_SIZE,
"Counting array using constructor has wrong size.");
VTKM_TEST_ASSERT(arrayMake.GetNumberOfValues() == ARRAY_SIZE,
"Counting array using make has wrong size.");
VTKM_TEST_ASSERT(arrayHandle.GetNumberOfValues() == ARRAY_SIZE,
"Counting array using raw array handle + tag has wrong size.");
ValueType properValue = startingValue;
for (vtkm::Id index = 0; index < ARRAY_SIZE; index++)
{
VTKM_TEST_ASSERT(arrayConst.GetPortalConstControl().Get(index) == properValue,
"Counting array using constructor has unexpected value.");
VTKM_TEST_ASSERT(arrayMake.GetPortalConstControl().Get(index) == properValue,
"Counting array using make has unexpected value.");
VTKM_TEST_ASSERT(arrayHandle.GetPortalConstControl().Get(index) == properValue,
"Counting array using raw array handle + tag has unexpected value.");
++properValue;
}
}
};
struct TestFunctor
{
template <typename T>
void operator()(const T t)
{
TemplatedTests<T> tests;
tests(t);
}
};
void TestArrayHandleCounting()
{
TestFunctor()(vtkm::Id(0));
TestFunctor()(vtkm::Scalar(0));
TestFunctor()( CountByTwo<vtkm::Id>(12) );
TestFunctor()( CountByTwo<vtkm::Scalar>(1.2f) );
}
} // annonymous namespace
int UnitTestArrayHandleCounting(int, char *[])
{
return vtkm::cont::testing::Testing::Run(TestArrayHandleCounting);
}
//============================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//
// Copyright 2014 Sandia Corporation.
// Copyright 2014 UT-Battelle, LLC.
// Copyright 2014. Los Alamos National Security
//
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
// the U.S. Government retains certain rights in this software.
//
// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
// Laboratory (LANL), the U.S. Government retains certain rights in
// this software.
//============================================================================
// This tests a previous problem where code templated on the device adapter and
// used one of the device adapter algorithms (for example, the dispatcher) had
// to be declared after any device adapter it was ever used with.
#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_ERROR
#include <vtkm/cont/DeviceAdapter.h>
#include <vtkm/cont/testing/Testing.h>
#include <vtkm/cont/ArrayHandle.h>
// Important for this test!
//This file must be included after ArrayHandle.h
#include <vtkm/cont/DeviceAdapterSerial.h>
namespace {
struct ExampleWorklet
{
template <typename T>
void operator()(T vtkmNotUsed(v)) const { }
};
void CheckPostDefinedDeviceAdapter()
{
// Nothing to really check. If this compiles, then the test is probably
// successful.
vtkm::cont::ArrayHandle<vtkm::Id> test;
}
} // anonymous namespace
int UnitTestDeviceAdapterAlgorithmDependency(int, char *[])
{
return vtkm::cont::testing::Testing::Run(CheckPostDefinedDeviceAdapter);
}<