 |
Ginkgo
Generated from pipelines/3136675824 branch based on develop. Ginkgo version 2.0.0
A numerical linear algebra library targeting many-core architectures
|
5 #ifndef GKO_PUBLIC_CORE_BASE_EXCEPTION_HPP_
6 #define GKO_PUBLIC_CORE_BASE_EXCEPTION_HPP_
13 #include <ginkgo/core/base/name_demangling.hpp>
14 #include <ginkgo/core/base/precision.hpp>
15 #include <ginkgo/core/base/types.hpp>
59 class Error :
public std::runtime_error {
68 Error(
const std::string& file,
int line,
const std::string& what)
69 : std::runtime_error(file +
":" + std::to_string(line) +
": " + what)
88 :
Error(file, line, func +
" is not implemented")
107 NotCompiled(
const std::string& file,
int line,
const std::string& func,
108 const std::string& module_name)
110 "feature " + func +
" is part of the " + module_name +
111 " module, which is not compiled on this system")
131 NotSupported(
const std::string& file,
int line,
const std::string& func,
132 const std::string& obj_type)
134 "Operation " + func +
" does not support parameters of type " +
152 MpiError(
const std::string& file,
int line,
const std::string& func,
154 :
Error(file, line, func +
": " + get_error(error_code))
158 static std::string get_error(
int64 error_code);
175 CudaError(
const std::string& file,
int line,
const std::string& func,
177 :
Error(file, line, func +
": " + get_error(error_code))
181 static std::string get_error(
int64 error_code);
198 CublasError(
const std::string& file,
int line,
const std::string& func,
200 :
Error(file, line, func +
": " + get_error(error_code))
204 static std::string get_error(
int64 error_code);
221 CurandError(
const std::string& file,
int line,
const std::string& func,
223 :
Error(file, line, func +
": " + get_error(error_code))
227 static std::string get_error(
int64 error_code);
246 :
Error(file, line, func +
": " + get_error(error_code))
250 static std::string get_error(
int64 error_code);
267 CufftError(
const std::string& file,
int line,
const std::string& func,
269 :
Error(file, line, func +
": " + get_error(error_code))
273 static std::string get_error(
int64 error_code);
290 HipError(
const std::string& file,
int line,
const std::string& func,
292 :
Error(file, line, func +
": " + get_error(error_code))
296 static std::string get_error(
int64 error_code);
313 HipblasError(
const std::string& file,
int line,
const std::string& func,
315 :
Error(file, line, func +
": " + get_error(error_code))
319 static std::string get_error(
int64 error_code);
336 HiprandError(
const std::string& file,
int line,
const std::string& func,
338 :
Error(file, line, func +
": " + get_error(error_code))
342 static std::string get_error(
int64 error_code);
362 :
Error(file, line, func +
": " + get_error(error_code))
366 static std::string get_error(
int64 error_code);
383 HipfftError(
const std::string& file,
int line,
const std::string& func,
385 :
Error(file, line, func +
": " + get_error(error_code))
389 static std::string get_error(
int64 error_code);
406 MetisError(
const std::string& file,
int line,
const std::string& func,
407 const std::string& error)
408 :
Error(file, line, func +
": " + error)
434 const std::string& func,
const std::string& first_name,
436 const std::string& second_name,
size_type second_rows,
437 size_type second_cols,
const std::string& clarification)
439 func +
": attempting to combine operators " + first_name +
440 " [" + std::to_string(first_rows) +
" x " +
441 std::to_string(first_cols) +
"] and " + second_name +
" [" +
442 std::to_string(second_rows) +
" x " +
443 std::to_string(second_cols) +
"]: " + clarification)
465 BadDimension(
const std::string& file,
int line,
const std::string& func,
466 const std::string& op_name,
size_type op_num_rows,
467 size_type op_num_cols,
const std::string& clarification)
469 func +
": Object " + op_name +
" has dimensions [" +
470 std::to_string(op_num_rows) +
" x " +
471 std::to_string(op_num_cols) +
"]: " + clarification)
482 template <
typename IndexType>
492 const int block_size,
const IndexType size)
494 "block size = " + std::to_string(block_size) +
495 ", size = " + std::to_string(size))
517 const std::string& clarification)
519 func +
": Value mismatch : " + std::to_string(val1) +
" and " +
520 std::to_string(val2) +
" : " + clarification)
539 const std::string& device,
size_type bytes)
541 device +
": failed to allocate memory block of " +
542 std::to_string(bytes) +
"B")
564 "trying to access index " + std::to_string(index) +
565 " in a memory block of " + std::to_string(bound) +
583 const std::string& index_type)
584 :
Error(file, line,
"Overflowing " + index_type)
602 StreamError(
const std::string& file,
int line,
const std::string& func,
603 const std::string& message)
604 :
Error(file, line, func +
": " + message)
623 :
Error(file, line, func +
": unable to find an eligible kernel")
644 const std::string& msg)
645 :
Error(file, line, msg)
662 const std::string& func,
const std::string& clarification)
664 func +
": Invalid state encountered : " + clarification)
684 InvalidData(
const std::string& file,
int line,
const std::type_info& type,
685 const std::string& invariant)
687 "Invariant violated in " +
688 name_demangling::get_type_name(type) +
": " + invariant)
710 func +
": expected precision " + to_string(expected) +
711 " but object " + op +
" has precision " + to_string(p) +
720 #endif // GKO_PUBLIC_CORE_BASE_EXCEPTION_HPP_
CudaError is thrown when a CUDA routine throws a non-zero error code.
Definition: exception.hpp:165
ValueMismatch is thrown if two values are not equal.
Definition: exception.hpp:503
Error that denotes issues between block sizes and matrix dimensions.
Definition: exception.hpp:483
KernelNotFound(const std::string &file, int line, const std::string &func)
Initializes a KernelNotFound error.
Definition: exception.hpp:622
KernelNotFound is thrown if Ginkgo cannot find a kernel which satisfies the criteria imposed by the i...
Definition: exception.hpp:613
HipblasError is thrown when a hipBLAS routine throws a non-zero error code.
Definition: exception.hpp:303
OutOfBoundsError is thrown if a memory access is detected to be out-of-bounds.
Definition: exception.hpp:551
NotImplemented is thrown in case an operation has not yet been implemented (but will be implemented i...
Definition: exception.hpp:78
AllocationError(const std::string &file, int line, const std::string &device, size_type bytes)
Initializes an allocation error.
Definition: exception.hpp:538
std::size_t size_type
Integral type used for allocation quantities.
Definition: types.hpp:102
OutOfBoundsError(const std::string &file, int line, size_type index, size_type bound)
Initializes an OutOfBoundsError.
Definition: exception.hpp:561
Exception thrown if an object is in an invalid state.
Definition: exception.hpp:651
Exception throws if a matrix does not have a property required by a numerical method.
Definition: exception.hpp:634
NotCompiled is thrown when attempting to call an operation which is a part of a module that was not c...
Definition: exception.hpp:97
NotSupported(const std::string &file, int line, const std::string &func, const std::string &obj_type)
Initializes a NotSupported error.
Definition: exception.hpp:131
HiprandError(const std::string &file, int line, const std::string &func, int64 error_code)
Initializes a hipRAND error.
Definition: exception.hpp:336
precision
An enum to specify the precision of stored data.
Definition: precision.hpp:19
NotSupported is thrown in case it is not possible to perform the requested operation on the given obj...
Definition: exception.hpp:120
InvalidData(const std::string &file, int line, const std::type_info &type, const std::string &invariant)
Initializes an InvalidData error.
Definition: exception.hpp:684
CublasError is thrown when a cuBLAS routine throws a non-zero error code.
Definition: exception.hpp:188
MetisError(const std::string &file, int line, const std::string &func, const std::string &error)
Initializes a METIS error.
Definition: exception.hpp:406
CublasError(const std::string &file, int line, const std::string &func, int64 error_code)
Initializes a cuBLAS error.
Definition: exception.hpp:198
MpiError is thrown when a MPI routine throws a non-zero error code.
Definition: exception.hpp:143
The Ginkgo namespace.
Definition: abstract_factory.hpp:19
UnsupportedMatrixProperty(const std::string &file, const int line, const std::string &msg)
Initializes the UnsupportedMatrixProperty error.
Definition: exception.hpp:643
PrecisionError(const std::string &file, int line, const std::string &func, precision expected, const std::string &op, precision p)
Definition: exception.hpp:707
CudaError(const std::string &file, int line, const std::string &func, int64 error_code)
Initializes a CUDA error.
Definition: exception.hpp:175
StreamError(const std::string &file, int line, const std::string &func, const std::string &message)
Initializes a file access error.
Definition: exception.hpp:602
AllocationError is thrown if a memory allocation fails.
Definition: exception.hpp:528
CurandError(const std::string &file, int line, const std::string &func, int64 error_code)
Initializes a cuRAND error.
Definition: exception.hpp:221
HipfftError(const std::string &file, int line, const std::string &func, int64 error_code)
Initializes a hipFFT error.
Definition: exception.hpp:383
BadDimension(const std::string &file, int line, const std::string &func, const std::string &op_name, size_type op_num_rows, size_type op_num_cols, const std::string &clarification)
Initializes a bad dimension error.
Definition: exception.hpp:465
MpiError(const std::string &file, int line, const std::string &func, int64 error_code)
Initializes a MPI error.
Definition: exception.hpp:152
OverflowError(const std::string &file, const int line, const std::string &index_type)
Definition: exception.hpp:582
InvalidStateError(const std::string &file, int line, const std::string &func, const std::string &clarification)
Initializes an invalid state error.
Definition: exception.hpp:661
StreamError is thrown if accessing a stream failed.
Definition: exception.hpp:592
CufftError(const std::string &file, int line, const std::string &func, int64 error_code)
Initializes a cuFFT error.
Definition: exception.hpp:267
DimensionMismatch is thrown if an operation is being applied to LinOps of incompatible size.
Definition: exception.hpp:417
CusparseError(const std::string &file, int line, const std::string &func, int64 error_code)
Initializes a cuSPARSE error.
Definition: exception.hpp:244
HipError is thrown when a HIP routine throws a non-zero error code.
Definition: exception.hpp:280
BadDimension is thrown if an operation is being applied to a LinOp with bad dimensions.
Definition: exception.hpp:452
CufftError is thrown when a cuFFT routine throws a non-zero error code.
Definition: exception.hpp:257
OverflowError is thrown when an index calculation for storage requirements overflows.
Definition: exception.hpp:575
Error(const std::string &file, int line, const std::string &what)
Initializes an error.
Definition: exception.hpp:68
std::int64_t int64
64-bit signed integral type.
Definition: types.hpp:125
HipblasError(const std::string &file, int line, const std::string &func, int64 error_code)
Initializes a hipBLAS error.
Definition: exception.hpp:313
HipError(const std::string &file, int line, const std::string &func, int64 error_code)
Initializes a HIP error.
Definition: exception.hpp:290
CurandError is thrown when a cuRAND routine throws a non-zero error code.
Definition: exception.hpp:211
HiprandError is thrown when a hipRAND routine throws a non-zero error code.
Definition: exception.hpp:326
BlockSizeError(const std::string &file, const int line, const int block_size, const IndexType size)
Definition: exception.hpp:491
HipsparseError is thrown when a hipSPARSE routine throws a non-zero error code.
Definition: exception.hpp:350
NotCompiled(const std::string &file, int line, const std::string &func, const std::string &module_name)
Initializes a NotCompiled error.
Definition: exception.hpp:107
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:433
HipfftError is thrown when a hipFFT routine throws a non-zero error code.
Definition: exception.hpp:373
ValueMismatch(const std::string &file, int line, const std::string &func, size_type val1, size_type val2, const std::string &clarification)
Initializes a value mismatch error.
Definition: exception.hpp:515
InvalidData is thrown in case an object in Ginkgo contains invalid data, either because the data was ...
Definition: exception.hpp:674
CusparseError is thrown when a cuSPARSE routine throws a non-zero error code.
Definition: exception.hpp:234
HipsparseError(const std::string &file, int line, const std::string &func, int64 error_code)
Initializes a hipSPARSE error.
Definition: exception.hpp:360
MetisError is thrown when METIS routine throws an error code.
Definition: exception.hpp:396
The Error class is used to report exceptional behaviour in library functions.
Definition: exception.hpp:59
NotImplemented(const std::string &file, int line, const std::string &func)
Initializes a NotImplemented error.
Definition: exception.hpp:87
Exception thrown if an object with mismatched precision is used.
Definition: exception.hpp:696