33 #ifndef GKO_CORE_EXCEPTION_HPP_ 34 #define GKO_CORE_EXCEPTION_HPP_ 37 #include <ginkgo/core/base/types.hpp> 86 class Error :
public std::exception {
94 Error(
const std::string &file,
int line,
const std::string &
what)
95 : what_(file +
":" +
std::to_string(line) +
": " + what)
102 virtual const char *
what() const noexcept
override {
return what_.c_str(); }
105 const std::string what_;
122 :
Error(file, line, func +
" is not implemented")
140 NotCompiled(
const std::string &file,
int line,
const std::string &func,
141 const std::string &module)
143 "feature " + func +
" is part of the " + module +
144 " module, which is not compiled on this system")
163 NotSupported(
const std::string &file,
int line,
const std::string &func,
164 const std::string &obj_type)
166 "Operation " + func +
" does not support parameters of type " +
184 CudaError(
const std::string &file,
int line,
const std::string &func,
186 :
Error(file, line, func +
": " + get_error(error_code))
190 static std::string get_error(
int64 error_code);
206 CublasError(
const std::string &file,
int line,
const std::string &func,
208 :
Error(file, line, func +
": " + get_error(error_code))
212 static std::string get_error(
int64 error_code);
230 :
Error(file, line, func +
": " + get_error(error_code))
234 static std::string get_error(
int64 error_code);
258 const std::string &func,
const std::string &first_name,
260 const std::string &second_name,
size_type second_rows,
261 size_type second_cols,
const std::string &clarification)
263 func +
": attempting to combine operators " + first_name +
264 " [" +
std::to_string(first_rows) +
" x " +
265 std::to_string(first_cols) +
"] and " + second_name +
" [" +
266 std::to_string(second_rows) +
" x " +
267 std::to_string(second_cols) +
"]: " + clarification)
285 const std::string &device,
size_type bytes)
287 device +
": failed to allocate memory block of " +
288 std::to_string(bytes) +
"B")
309 "trying to access index " +
std::to_string(index) +
310 " in a memory block of " +
std::to_string(bound) +
328 StreamError(
const std::string &file,
int line,
const std::string &func,
329 const std::string &message)
330 :
Error(file, line, func +
": " + message)
348 :
Error(file, line, func +
": unable to find an eligible kernel")
356 #endif // GKO_CORE_EXCEPTION_HPP_ NotImplemented is thrown in case an operation has not yet been implemented (but will be implemented i...
Definition: exception.hpp:113
The Error class is used to report exceptional behaviour in library functions.
Definition: exception.hpp:86
OutOfBoundsError(const std::string &file, int line, size_type index, size_type bound)
Initializes an OutOfBoundsError.
Definition: exception.hpp:306
std::size_t size_type
Integral type used for allocation quantities.
Definition: types.hpp:94
KernelNotFound is thrown if Ginkgo cannot find a kernel which satisfies the criteria imposed by the i...
Definition: exception.hpp:339
NotCompiled is thrown when attempting to call an operation which is a part of a module that was not c...
Definition: exception.hpp:131
CublasError is thrown when a cuBLAS routine throws a non-zero error code.
Definition: exception.hpp:197
The Ginkgo namespace.
Definition: abstract_factory.hpp:45
StreamError(const std::string &file, int line, const std::string &func, const std::string &message)
Initializes a file access error.
Definition: exception.hpp:328
KernelNotFound(const std::string &file, int line, const std::string &func)
Initializes a KernelNotFound error.
Definition: exception.hpp:347
CudaError is thrown when a CUDA routine throws a non-zero error code.
Definition: exception.hpp:175
OutOfBoundsError is thrown if a memory access is detected to be out-of-bounds.
Definition: exception.hpp:297
CusparseError(const std::string &file, int line, const std::string &func, int64 error_code)
Initializes a cuSPARSE error.
Definition: exception.hpp:228
DimensionMismatch(const std::string &file, int line, const std::string &func, const std::string &first_name, size_type first_rows, size_type first_cols, const std::string &second_name, size_type second_rows, size_type second_cols, const std::string &clarification)
Initializes a dimension mismatch error.
Definition: exception.hpp:257
std::int64_t int64
64-bit signed integral type.
Definition: types.hpp:117
CusparseError is thrown when a cuSPARSE routine throws a non-zero error code.
Definition: exception.hpp:219
CublasError(const std::string &file, int line, const std::string &func, int64 error_code)
Initializes a cuBLAS error.
Definition: exception.hpp:206
NotSupported(const std::string &file, int line, const std::string &func, const std::string &obj_type)
Initializes a NotSupported error.
Definition: exception.hpp:163
StreamError is thrown if accessing a stream failed.
Definition: exception.hpp:319
CudaError(const std::string &file, int line, const std::string &func, int64 error_code)
Initializes a CUDA error.
Definition: exception.hpp:184
DimensionMismatch is thrown if an operation is being applied to LinOps of incompatible size...
Definition: exception.hpp:242
virtual const char * what() const noexcept override
Returns a human-readable string with a more detailed description of the error.
Definition: exception.hpp:102
NotImplemented(const std::string &file, int line, const std::string &func)
Initializes a NotImplemented error.
Definition: exception.hpp:121
NotSupported is thrown in case it is not possible to perform the requested operation on the given obj...
Definition: exception.hpp:153
AllocationError is thrown if a memory allocation fails.
Definition: exception.hpp:275
AllocationError(const std::string &file, int line, const std::string &device, size_type bytes)
Initializes an allocation error.
Definition: exception.hpp:284
Error(const std::string &file, int line, const std::string &what)
Initializes an error.
Definition: exception.hpp:94
NotCompiled(const std::string &file, int line, const std::string &func, const std::string &module)
Initializes a NotCompiled error.
Definition: exception.hpp:140