From f38673f618266e08e9b15f37d9cac228384c3bf3 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Thu, 1 Oct 2015 14:25:28 -0400 Subject: [PATCH] Replace ErrorControlOutOfMemory with ErrorControlBadAllocation. --- vtkm/benchmarking/BenchmarkDeviceAdapter.h | 1 - vtkm/cont/ArrayHandle.h | 2 +- vtkm/cont/CMakeLists.txt | 1 - vtkm/cont/ErrorControlOutOfMemory.h | 41 ------------------- vtkm/cont/Storage.h | 2 +- vtkm/cont/StorageBasic.h | 4 +- .../cuda/internal/ArrayManagerExecutionCuda.h | 6 +-- .../ArrayManagerExecutionThrustDevice.h | 4 +- .../cuda/internal/ThrustExceptionHandler.h | 4 +- vtkm/cont/internal/ArrayPortalFromIterators.h | 4 +- vtkm/cont/testing/TestingDeviceAdapter.h | 4 +- vtkm/opengl/cuda/internal/TransferToOpenGL.h | 4 +- vtkm/opengl/testing/TestingOpenGLInterop.h | 4 +- 13 files changed, 19 insertions(+), 62 deletions(-) delete mode 100644 vtkm/cont/ErrorControlOutOfMemory.h diff --git a/vtkm/benchmarking/BenchmarkDeviceAdapter.h b/vtkm/benchmarking/BenchmarkDeviceAdapter.h index 3f1d5b5e7..a00cc5e13 100644 --- a/vtkm/benchmarking/BenchmarkDeviceAdapter.h +++ b/vtkm/benchmarking/BenchmarkDeviceAdapter.h @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include diff --git a/vtkm/cont/ArrayHandle.h b/vtkm/cont/ArrayHandle.h index 4812e086f..0296f5f5e 100644 --- a/vtkm/cont/ArrayHandle.h +++ b/vtkm/cont/ArrayHandle.h @@ -258,7 +258,7 @@ public: /// /// The allocation may be done on an already existing array, but can wipe out /// any data already in the array. This method can throw - /// ErrorControlOutOfMemory if the array cannot be allocated or + /// ErrorControlBadAllocation if the array cannot be allocated or /// ErrorControlBadValue if the allocation is not feasible (for example, the /// array storage is read-only). /// diff --git a/vtkm/cont/CMakeLists.txt b/vtkm/cont/CMakeLists.txt index fa8af8b6e..a537a7f55 100644 --- a/vtkm/cont/CMakeLists.txt +++ b/vtkm/cont/CMakeLists.txt @@ -55,7 +55,6 @@ set(headers ErrorControlBadType.h ErrorControlBadValue.h ErrorControlInternal.h - ErrorControlOutOfMemory.h ErrorExecution.h Field.h LogicalStructure.h diff --git a/vtkm/cont/ErrorControlOutOfMemory.h b/vtkm/cont/ErrorControlOutOfMemory.h deleted file mode 100644 index 2f558edae..000000000 --- a/vtkm/cont/ErrorControlOutOfMemory.h +++ /dev/null @@ -1,41 +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. -// -// 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 vtk_m_cont_ErrorControlOutOfMemory_h -#define vtk_m_cont_ErrorControlOutOfMemory_h - -#include - -namespace vtkm { -namespace cont { - -/// This class is thrown when a vtkm function or method tries to allocate an -/// array and fails. -/// -class ErrorControlOutOfMemory : public ErrorControl -{ -public: - ErrorControlOutOfMemory(const std::string &message) - : ErrorControl(message) { } -}; - -} -} // namespace vtkm::cont - -#endif //vtk_m_cont_ErrorControlOutOfMemory_h diff --git a/vtkm/cont/Storage.h b/vtkm/cont/Storage.h index 538871a1d..b2d197cef 100644 --- a/vtkm/cont/Storage.h +++ b/vtkm/cont/Storage.h @@ -131,7 +131,7 @@ public: /// /// The allocation may be done on an already existing array, but can wipe out /// any data already in the array. This method can throw - /// ErrorControlOutOfMemory if the array cannot be allocated or + /// ErrorControlBadAllocation if the array cannot be allocated or /// ErrorControlBadValue if the allocation is not feasible (for example, the /// array storage is read-only). /// diff --git a/vtkm/cont/StorageBasic.h b/vtkm/cont/StorageBasic.h index 5a2dce507..fcfd1c936 100644 --- a/vtkm/cont/StorageBasic.h +++ b/vtkm/cont/StorageBasic.h @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include @@ -284,7 +284,7 @@ public: this->Array = NULL; this->NumberOfValues = 0; this->AllocatedSize = 0; - throw vtkm::cont::ErrorControlOutOfMemory( + throw vtkm::cont::ErrorControlBadAllocation( "Could not allocate basic control array."); } diff --git a/vtkm/cont/cuda/internal/ArrayManagerExecutionCuda.h b/vtkm/cont/cuda/internal/ArrayManagerExecutionCuda.h index 9803b703a..2393d5886 100644 --- a/vtkm/cont/cuda/internal/ArrayManagerExecutionCuda.h +++ b/vtkm/cont/cuda/internal/ArrayManagerExecutionCuda.h @@ -58,7 +58,7 @@ public: { return this->Superclass::PrepareForInput(updateData); } - catch (vtkm::cont::ErrorControlOutOfMemory error) + catch (vtkm::cont::ErrorControlBadAllocation error) { // Thrust does not seem to be clearing the CUDA error, so do it here. cudaError_t cudaError = cudaPeekAtLastError(); @@ -77,7 +77,7 @@ public: { return this->Superclass::PrepareForInPlace(updateData); } - catch (vtkm::cont::ErrorControlOutOfMemory error) + catch (vtkm::cont::ErrorControlBadAllocation error) { // Thrust does not seem to be clearing the CUDA error, so do it here. cudaError_t cudaError = cudaPeekAtLastError(); @@ -96,7 +96,7 @@ public: { return this->Superclass::PrepareForOutput(numberOfValues); } - catch (vtkm::cont::ErrorControlOutOfMemory error) + catch (vtkm::cont::ErrorControlBadAllocation error) { // Thrust does not seem to be clearing the CUDA error, so do it here. cudaError_t cudaError = cudaPeekAtLastError(); diff --git a/vtkm/cont/cuda/internal/ArrayManagerExecutionThrustDevice.h b/vtkm/cont/cuda/internal/ArrayManagerExecutionThrustDevice.h index b11503a05..0f0b5de99 100644 --- a/vtkm/cont/cuda/internal/ArrayManagerExecutionThrustDevice.h +++ b/vtkm/cont/cuda/internal/ArrayManagerExecutionThrustDevice.h @@ -21,7 +21,7 @@ #define vtk_m_cont_cuda_internal_ArrayManagerExecutionThrustDevice_h #include -#include +#include #include // Disable warnings we check vtkm for but Thrust does not. @@ -153,7 +153,7 @@ public: } catch (std::bad_alloc error) { - throw vtkm::cont::ErrorControlOutOfMemory(error.what()); + throw vtkm::cont::ErrorControlBadAllocation(error.what()); } return PortalType(this->Array.data(), diff --git a/vtkm/cont/cuda/internal/ThrustExceptionHandler.h b/vtkm/cont/cuda/internal/ThrustExceptionHandler.h index c0906a813..68f9bc8e7 100644 --- a/vtkm/cont/cuda/internal/ThrustExceptionHandler.h +++ b/vtkm/cont/cuda/internal/ThrustExceptionHandler.h @@ -21,7 +21,7 @@ #define vtk_m_cont_cuda_interal_ThrustExecptionHandler_h #include -#include +#include #include VTKM_THIRDPARTY_PRE_INCLUDE @@ -43,7 +43,7 @@ static inline void throwAsVTKmException() } catch(std::bad_alloc &error) { - throw vtkm::cont::ErrorControlOutOfMemory(error.what()); + throw vtkm::cont::ErrorControlBadAllocation(error.what()); } catch(thrust::system_error &error) { diff --git a/vtkm/cont/internal/ArrayPortalFromIterators.h b/vtkm/cont/internal/ArrayPortalFromIterators.h index b391d047e..460571927 100644 --- a/vtkm/cont/internal/ArrayPortalFromIterators.h +++ b/vtkm/cont/internal/ArrayPortalFromIterators.h @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include @@ -55,7 +55,7 @@ public: #ifndef VTKM_USE_64BIT_IDS if (numberOfValues > std::numeric_limits::max()) { - throw vtkm::cont::ErrorControlOutOfMemory( + throw vtkm::cont::ErrorControlBadAllocation( "Distance of iterators larger than maximum array size. " "To support larger arrays, try turning on VTKM_USE_64BIT_IDS."); } diff --git a/vtkm/cont/testing/TestingDeviceAdapter.h b/vtkm/cont/testing/TestingDeviceAdapter.h index b3790536a..ce814a91c 100644 --- a/vtkm/cont/testing/TestingDeviceAdapter.h +++ b/vtkm/cont/testing/TestingDeviceAdapter.h @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include @@ -355,7 +355,7 @@ private: "or the width of vtkm::Id is not large enough to express all " "array sizes."); } - catch (vtkm::cont::ErrorControlOutOfMemory error) + catch (vtkm::cont::ErrorControlBadAllocation error) { std::cout << "Got the expected error: " << error.GetMessage() << std::endl; } diff --git a/vtkm/opengl/cuda/internal/TransferToOpenGL.h b/vtkm/opengl/cuda/internal/TransferToOpenGL.h index c779a68d7..2508c1801 100644 --- a/vtkm/opengl/cuda/internal/TransferToOpenGL.h +++ b/vtkm/opengl/cuda/internal/TransferToOpenGL.h @@ -21,7 +21,7 @@ #define vtkm_opengl_cuda_internal_TransferToOpenGL_h #include -#include +#include #include #include @@ -96,7 +96,7 @@ public: cError =cudaGraphicsMapResources(1,&cudaResource); if(cError != cudaSuccess) { - throw vtkm::cont::ErrorControlOutOfMemory( + throw vtkm::cont::ErrorControlBadAllocation( "Could not allocate enough memory in CUDA for OpenGL interop."); } diff --git a/vtkm/opengl/testing/TestingOpenGLInterop.h b/vtkm/opengl/testing/TestingOpenGLInterop.h index b34991771..c960a511a 100644 --- a/vtkm/opengl/testing/TestingOpenGLInterop.h +++ b/vtkm/opengl/testing/TestingOpenGLInterop.h @@ -77,7 +77,7 @@ private: { vtkm::opengl::TransferToOpenGL(array,handle, DeviceAdapterTag()); } - catch (vtkm::cont::ErrorControlOutOfMemory error) + catch (vtkm::cont::ErrorControlBadAllocation error) { std::cout << error.GetMessage() << std::endl; VTKM_TEST_ASSERT(true==false, @@ -99,7 +99,7 @@ private: { vtkm::opengl::TransferToOpenGL(array,handle,type, DeviceAdapterTag()); } - catch (vtkm::cont::ErrorControlOutOfMemory error) + catch (vtkm::cont::ErrorControlBadAllocation error) { std::cout << error.GetMessage() << std::endl; VTKM_TEST_ASSERT(true==false,