-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #333 from ahehn-nv/ahehn/device_memory_allocation_…
…exception [common] Added a device_memory_allocation_exception
- Loading branch information
Showing
2 changed files
with
65 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. | ||
* | ||
* NVIDIA CORPORATION and its licensors retain all intellectual property | ||
* and proprietary rights in and to this software, related documentation | ||
* and any modifications thereto. Any use, reproduction, disclosure or | ||
* distribution of this software and related documentation without an express | ||
* license agreement from NVIDIA CORPORATION is strictly prohibited. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <exception> | ||
|
||
namespace claragenomics | ||
{ | ||
|
||
/// @brief Exception class for out-of-(device-)memory errors. | ||
/// | ||
/// Exceptions of this class are thrown if a memory allocation fails on the device. | ||
class device_memory_allocation_exception : public std::exception | ||
{ | ||
public: | ||
device_memory_allocation_exception() = default; | ||
/// Copy constructor | ||
device_memory_allocation_exception(device_memory_allocation_exception const&) = default; | ||
/// Move constructor | ||
device_memory_allocation_exception(device_memory_allocation_exception&&) = default; | ||
/// Assignment | ||
device_memory_allocation_exception& operator=(device_memory_allocation_exception const&) = default; | ||
/// Move-Assignment | ||
device_memory_allocation_exception& operator=(device_memory_allocation_exception&&) = default; | ||
/// Destructor | ||
virtual ~device_memory_allocation_exception() = default; | ||
|
||
/// Returns the error message of the exception | ||
virtual const char* what() const noexcept | ||
{ | ||
return "Could not allocate device memory!"; | ||
} | ||
}; | ||
|
||
} // namespace claragenomics |