Commit d8cc067c authored by Robert Maynard's avatar Robert Maynard

Remove DeviceAdapterError as it isn't needed any more.

Fixes #277

DeviceAdapterError existed to make sure that the default device adapter
template was being handled properly. Since the default device adapter doesn't
exist, and nothing is templated over it we can now remove DeviceAdapterError.
parent ab1f7b04
......@@ -32,7 +32,6 @@
#error The VTKM_DEFAULT_DEVICE_ADAPTER_TAG define is no longer required and needs to be removed
#endif
#define VTKM_DEVICE_ADAPTER_ERROR -2
#define VTKM_DEVICE_ADAPTER_UNDEFINED -1
#define VTKM_DEVICE_ADAPTER_SERIAL 1
#define VTKM_DEVICE_ADAPTER_CUDA 2
......
......@@ -16,7 +16,6 @@
//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>
......@@ -105,10 +104,6 @@ DeviceAdapterNameType RuntimeDeviceInformation::GetName(DeviceAdapterId device)
{
return detail::RuntimeNames.DeviceNames[id];
}
else if (id == VTKM_DEVICE_ADAPTER_ERROR)
{
return vtkm::cont::DeviceAdapterTraits<vtkm::cont::DeviceAdapterTagError>::GetName();
}
else if (id == VTKM_DEVICE_ADAPTER_UNDEFINED)
{
return vtkm::cont::DeviceAdapterTraits<vtkm::cont::DeviceAdapterTagUndefined>::GetName();
......@@ -137,10 +132,6 @@ DeviceAdapterId RuntimeDeviceInformation::GetId(DeviceAdapterNameType name) cons
{
return vtkm::cont::DeviceAdapterTagAny{};
}
else if (name == "error")
{
return vtkm::cont::DeviceAdapterTagError{};
}
else if (name == "undefined")
{
return vtkm::cont::DeviceAdapterTagUndefined{};
......
......@@ -11,7 +11,6 @@
#include <vtkm/cont/RuntimeDeviceTracker.h>
#include <vtkm/cont/ErrorBadValue.h>
#include <vtkm/cont/internal/DeviceAdapterError.h>
#include <algorithm>
#include <map>
......
......@@ -10,8 +10,6 @@
#define vtk_m_cont_StorageVirtual_cxx
#include <vtkm/cont/StorageVirtual.h>
#include <vtkm/cont/internal/DeviceAdapterError.h>
namespace vtkm
{
namespace cont
......@@ -90,10 +88,6 @@ const vtkm::internal::PortalVirtualBase* StorageVirtual::PrepareForInput(
{
throw vtkm::cont::ErrorBadValue("device should not be VTKM_DEVICE_ADAPTER_UNDEFINED");
}
if (devId == vtkm::cont::DeviceAdapterTagError())
{
throw vtkm::cont::ErrorBadValue("device should not be VTKM_DEVICE_ADAPTER_ERROR");
}
const bool needsUpload = !(this->DeviceTransferState->valid(devId) && this->DeviceUpToDate);
......@@ -117,10 +111,6 @@ const vtkm::internal::PortalVirtualBase* StorageVirtual::PrepareForOutput(
{
throw vtkm::cont::ErrorBadValue("device should not be VTKM_DEVICE_ADAPTER_UNDEFINED");
}
if (devId == vtkm::cont::DeviceAdapterTagError())
{
throw vtkm::cont::ErrorBadValue("device should not be VTKM_DEVICE_ADAPTER_ERROR");
}
const bool needsUpload = !(this->DeviceTransferState->valid(devId) && this->DeviceUpToDate);
if (needsUpload)
......@@ -141,10 +131,6 @@ const vtkm::internal::PortalVirtualBase* StorageVirtual::PrepareForInPlace(
{
throw vtkm::cont::ErrorBadValue("device should not be VTKM_DEVICE_ADAPTER_UNDEFINED");
}
if (devId == vtkm::cont::DeviceAdapterTagError())
{
throw vtkm::cont::ErrorBadValue("device should not be VTKM_DEVICE_ADAPTER_ERROR");
}
const bool needsUpload = !(this->DeviceTransferState->valid(devId) && this->DeviceUpToDate);
if (needsUpload)
......
......@@ -23,7 +23,6 @@ set(headers
ConnectivityExplicitInternals.h
DeviceAdapterAlgorithmGeneral.h
DeviceAdapterAtomicArrayImplementation.h
DeviceAdapterError.h
DeviceAdapterListHelpers.h
DynamicTransform.h
FunctorsGeneral.h
......
......@@ -16,7 +16,6 @@
#include <vtkm/cont/ArrayHandleCast.h>
#include <vtkm/cont/ArrayHandleConstant.h>
#include <vtkm/cont/ArrayHandleCounting.h>
#include <vtkm/cont/internal/DeviceAdapterError.h>
#include <vtkm/cont/internal/ReverseConnectivityBuilder.h>
#include <vtkm/exec/ExecutionWholeArray.h>
......@@ -115,10 +114,6 @@ struct ConnectivityExplicitInternals
{
throw vtkm::cont::ErrorBadValue("Cannot build indices using DeviceAdapterTagUndefined");
}
if (deviceId == vtkm::cont::DeviceAdapterTagError())
{
throw vtkm::cont::ErrorBadValue("Cannot build indices using DeviceAdapterTagError");
}
VTKM_ASSERT(this->ElementsValid);
......
//============================================================================
// 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_cont_internal_DeviceAdapterError_h
#define vtk_m_cont_internal_DeviceAdapterError_h
#include <vtkm/cont/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_INVALID_DEVICE_ADAPTER(Error, VTKM_DEVICE_ADAPTER_ERROR);
namespace vtkm
{
namespace cont
{
/// \brief Class providing a Error runtime support detector.
///
/// The class provide the actual implementation used by
/// vtkm::cont::RuntimeDeviceInformation for the Error backend.
///
/// We will always state that the current machine doesn't support
/// the error backend.
///
template <class DeviceAdapterTag>
class DeviceAdapterRuntimeDetector;
template <>
class DeviceAdapterRuntimeDetector<vtkm::cont::DeviceAdapterTagError>
{
public:
/// Returns false as the Error Device can never be run on.
VTKM_CONT bool Exists() const { return false; }
};
}
}
#endif //vtk_m_cont_internal_DeviceAdapterError_h
......@@ -27,7 +27,6 @@
#include <vtkm/cont/StorageBasic.h>
#include <vtkm/cont/Timer.h>
#include <vtkm/cont/internal/DeviceAdapterError.h>
#include <vtkm/cont/internal/VirtualObjectTransfer.h>
#include <vtkm/cont/testing/Testing.h>
......@@ -492,20 +491,16 @@ private:
std::cout << "Testing device adapter tag" << std::endl;
constexpr DeviceAdapterTag deviceTag;
constexpr vtkm::cont::DeviceAdapterTagError errorTag;
constexpr vtkm::cont::DeviceAdapterTagUndefined undefinedTag;
VTKM_TEST_ASSERT(deviceTag.GetValue() == deviceTag.GetValue(),
"Device adapter Id does not equal itself.");
VTKM_TEST_ASSERT(deviceTag.GetValue() != errorTag.GetValue(),
VTKM_TEST_ASSERT(deviceTag.GetValue() != undefinedTag.GetValue(),
"Device adapter Id not distinguishable from others.");
using Traits = vtkm::cont::DeviceAdapterTraits<DeviceAdapterTag>;
using ErrorTraits = vtkm::cont::DeviceAdapterTraits<vtkm::cont::DeviceAdapterTagError>;
VTKM_TEST_ASSERT(Traits::GetName() == Traits::GetName(),
"Device adapter Name does not equal itself.");
VTKM_TEST_ASSERT(Traits::GetName() != ErrorTraits::GetName(),
"Device adapter Name not distinguishable from others.");
}
// Note: this test does not actually test to make sure the data is available
......
......@@ -11,7 +11,6 @@
#include <vtkm/cont/RuntimeDeviceInformation.h>
#include <vtkm/cont/cuda/DeviceAdapterCuda.h>
#include <vtkm/cont/internal/DeviceAdapterError.h>
#include <vtkm/cont/openmp/DeviceAdapterOpenMP.h>
#include <vtkm/cont/serial/DeviceAdapterSerial.h>
#include <vtkm/cont/tbb/DeviceAdapterTBB.h>
......@@ -64,14 +63,12 @@ void TestName(const std::string& name, Tag tag, vtkm::cont::DeviceAdapterId id)
void TestNames()
{
vtkm::cont::DeviceAdapterTagError errorTag;
vtkm::cont::DeviceAdapterTagUndefined undefinedTag;
vtkm::cont::DeviceAdapterTagSerial serialTag;
vtkm::cont::DeviceAdapterTagTBB tbbTag;
vtkm::cont::DeviceAdapterTagOpenMP openmpTag;
vtkm::cont::DeviceAdapterTagCuda cudaTag;
TestName("Error", errorTag, errorTag);
TestName("Undefined", undefinedTag, undefinedTag);
TestName("Serial", serialTag, serialTag);
TestName("TBB", tbbTag, tbbTag);
......
......@@ -12,8 +12,6 @@
#include <vtkm/cont/RuntimeDeviceTracker.h>
#include <vtkm/cont/Timer.h>
#include <vtkm/cont/internal/DeviceAdapterError.h>
#include <vtkm/cont/testing/Testing.h>
#include <chrono>
......
......@@ -16,8 +16,6 @@
#include <vtkm/cont/TryExecute.h>
#include <vtkm/cont/serial/DeviceAdapterSerial.h>
#include <vtkm/cont/internal/DeviceAdapterError.h>
#include <vtkm/cont/testing/Testing.h>
#include <exception>
......@@ -216,7 +214,7 @@ void TryExecuteErrorTests()
static void Run()
{
using ValidDevice = vtkm::cont::DeviceAdapterTagSerial;
using InvalidDevice = vtkm::cont::DeviceAdapterTagError;
using InvalidDevice = vtkm::cont::DeviceAdapterTagUndefined;
TryExecuteAllEdgeCases();
......
......@@ -14,8 +14,6 @@
#include <vtkm/cont/RuntimeDeviceInformation.h>
#include <vtkm/cont/RuntimeDeviceTracker.h>
#include <vtkm/cont/internal/DeviceAdapterError.h>
//------------------------------------------------------------------------------
// This test ensures that exceptions thrown internally by the vtkm_cont library
// can be correctly caught across library boundaries.
......@@ -28,7 +26,7 @@ int UnitTestExceptions(int argc, char* argv[])
{
// This throws a ErrorBadValue from RuntimeDeviceTracker::CheckDevice,
// which is compiled into the vtkm_cont library:
tracker.ResetDevice(vtkm::cont::DeviceAdapterTagError());
tracker.ResetDevice(vtkm::cont::DeviceAdapterTagUndefined());
}
catch (vtkm::cont::ErrorBadValue&)
{
......
......@@ -12,8 +12,6 @@
#include <vtkm/cont/DataSetBuilderUniform.h>
#include <vtkm/cont/DeviceAdapter.h>
#include <vtkm/cont/internal/DeviceAdapterError.h>
#include <vtkm/cont/testing/MakeTestDataSet.h>
#include <vtkm/cont/testing/Testing.h>
#include <vtkm/io/writer/VTKDataSetWriter.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment