From d8cc067caae0183afb0939d1467a1a5f8b02829d Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Thu, 18 Apr 2019 15:09:57 -0400 Subject: [PATCH] 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. --- vtkm/cont/DeviceAdapterTag.h | 1 - vtkm/cont/RuntimeDeviceInformation.cxx | 9 ---- vtkm/cont/RuntimeDeviceTracker.cxx | 1 - vtkm/cont/StorageVirtual.cxx | 14 ------ vtkm/cont/internal/CMakeLists.txt | 1 - .../internal/ConnectivityExplicitInternals.h | 5 -- vtkm/cont/internal/DeviceAdapterError.h | 48 ------------------- vtkm/cont/testing/TestingDeviceAdapter.h | 9 +--- .../testing/UnitTestRuntimeDeviceNames.cxx | 3 -- vtkm/cont/testing/UnitTestTimer.cxx | 2 - vtkm/cont/testing/UnitTestTryExecute.cxx | 4 +- vtkm/testing/UnitTestExceptions.cxx | 4 +- .../worklet/testing/UnitTestExternalFaces.cxx | 2 - 13 files changed, 4 insertions(+), 99 deletions(-) delete mode 100644 vtkm/cont/internal/DeviceAdapterError.h diff --git a/vtkm/cont/DeviceAdapterTag.h b/vtkm/cont/DeviceAdapterTag.h index d80006346..0c310f76b 100644 --- a/vtkm/cont/DeviceAdapterTag.h +++ b/vtkm/cont/DeviceAdapterTag.h @@ -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 diff --git a/vtkm/cont/RuntimeDeviceInformation.cxx b/vtkm/cont/RuntimeDeviceInformation.cxx index 6f7936d31..ad0d22230 100644 --- a/vtkm/cont/RuntimeDeviceInformation.cxx +++ b/vtkm/cont/RuntimeDeviceInformation.cxx @@ -16,7 +16,6 @@ //Bring in each device adapters runtime class #include -#include #include #include #include @@ -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::GetName(); - } else if (id == VTKM_DEVICE_ADAPTER_UNDEFINED) { return vtkm::cont::DeviceAdapterTraits::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{}; diff --git a/vtkm/cont/RuntimeDeviceTracker.cxx b/vtkm/cont/RuntimeDeviceTracker.cxx index 81bef9f09..6ea07624c 100644 --- a/vtkm/cont/RuntimeDeviceTracker.cxx +++ b/vtkm/cont/RuntimeDeviceTracker.cxx @@ -11,7 +11,6 @@ #include #include -#include #include #include diff --git a/vtkm/cont/StorageVirtual.cxx b/vtkm/cont/StorageVirtual.cxx index 41c44072f..3babf23c1 100644 --- a/vtkm/cont/StorageVirtual.cxx +++ b/vtkm/cont/StorageVirtual.cxx @@ -10,8 +10,6 @@ #define vtk_m_cont_StorageVirtual_cxx #include -#include - 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) diff --git a/vtkm/cont/internal/CMakeLists.txt b/vtkm/cont/internal/CMakeLists.txt index e8951d104..37f08dbfe 100644 --- a/vtkm/cont/internal/CMakeLists.txt +++ b/vtkm/cont/internal/CMakeLists.txt @@ -23,7 +23,6 @@ set(headers ConnectivityExplicitInternals.h DeviceAdapterAlgorithmGeneral.h DeviceAdapterAtomicArrayImplementation.h - DeviceAdapterError.h DeviceAdapterListHelpers.h DynamicTransform.h FunctorsGeneral.h diff --git a/vtkm/cont/internal/ConnectivityExplicitInternals.h b/vtkm/cont/internal/ConnectivityExplicitInternals.h index 6f7e4013d..6e43d7631 100644 --- a/vtkm/cont/internal/ConnectivityExplicitInternals.h +++ b/vtkm/cont/internal/ConnectivityExplicitInternals.h @@ -16,7 +16,6 @@ #include #include #include -#include #include #include @@ -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); diff --git a/vtkm/cont/internal/DeviceAdapterError.h b/vtkm/cont/internal/DeviceAdapterError.h deleted file mode 100644 index b94b570c1..000000000 --- a/vtkm/cont/internal/DeviceAdapterError.h +++ /dev/null @@ -1,48 +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_cont_internal_DeviceAdapterError_h -#define vtk_m_cont_internal_DeviceAdapterError_h - -#include - -/// 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 DeviceAdapterRuntimeDetector; - -template <> -class DeviceAdapterRuntimeDetector -{ -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 diff --git a/vtkm/cont/testing/TestingDeviceAdapter.h b/vtkm/cont/testing/TestingDeviceAdapter.h index 50173c736..ed74b2ee5 100644 --- a/vtkm/cont/testing/TestingDeviceAdapter.h +++ b/vtkm/cont/testing/TestingDeviceAdapter.h @@ -27,7 +27,6 @@ #include #include -#include #include #include @@ -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; - using ErrorTraits = vtkm::cont::DeviceAdapterTraits; - 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 diff --git a/vtkm/cont/testing/UnitTestRuntimeDeviceNames.cxx b/vtkm/cont/testing/UnitTestRuntimeDeviceNames.cxx index e8ba7e60c..40e326ac6 100644 --- a/vtkm/cont/testing/UnitTestRuntimeDeviceNames.cxx +++ b/vtkm/cont/testing/UnitTestRuntimeDeviceNames.cxx @@ -11,7 +11,6 @@ #include #include -#include #include #include #include @@ -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); diff --git a/vtkm/cont/testing/UnitTestTimer.cxx b/vtkm/cont/testing/UnitTestTimer.cxx index ce6cdc650..ae8aaffb2 100644 --- a/vtkm/cont/testing/UnitTestTimer.cxx +++ b/vtkm/cont/testing/UnitTestTimer.cxx @@ -12,8 +12,6 @@ #include #include -#include - #include #include diff --git a/vtkm/cont/testing/UnitTestTryExecute.cxx b/vtkm/cont/testing/UnitTestTryExecute.cxx index f85d2d4dd..9c8bbf865 100644 --- a/vtkm/cont/testing/UnitTestTryExecute.cxx +++ b/vtkm/cont/testing/UnitTestTryExecute.cxx @@ -16,8 +16,6 @@ #include #include -#include - #include #include @@ -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(); diff --git a/vtkm/testing/UnitTestExceptions.cxx b/vtkm/testing/UnitTestExceptions.cxx index 89e60d687..e9a1944ec 100644 --- a/vtkm/testing/UnitTestExceptions.cxx +++ b/vtkm/testing/UnitTestExceptions.cxx @@ -14,8 +14,6 @@ #include #include -#include - //------------------------------------------------------------------------------ // 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&) { diff --git a/vtkm/worklet/testing/UnitTestExternalFaces.cxx b/vtkm/worklet/testing/UnitTestExternalFaces.cxx index 8d176e6a4..6d9790844 100644 --- a/vtkm/worklet/testing/UnitTestExternalFaces.cxx +++ b/vtkm/worklet/testing/UnitTestExternalFaces.cxx @@ -12,8 +12,6 @@ #include #include -#include - #include #include #include