33#ifndef GKO_PUBLIC_CORE_BASE_EXCEPTION_HPP_
34#define GKO_PUBLIC_CORE_BASE_EXCEPTION_HPP_
41#include <ginkgo/core/base/types.hpp>
86class Error :
public std::exception {
106 const std::string what_;
144 const std::string&
module)
146 "feature " +
func +
" is part of the " +
module +
147 " module, which is not compiled on this system")
170 "Operation " +
func +
" does not support parameters of type " +
194 static std::string get_error(
int64 error_code);
217 static std::string get_error(
int64 error_code);
240 static std::string get_error(
int64 error_code);
263 static std::string get_error(
int64 error_code);
286 static std::string get_error(
int64 error_code);
309 static std::string get_error(
int64 error_code);
332 static std::string get_error(
int64 error_code);
355 static std::string get_error(
int64 error_code);
378 static std::string get_error(
int64 error_code);
402 static std::string get_error(
int64 error_code);
425 static std::string get_error(
int64 error_code);
443 const std::string&
error)
505 func +
": Object " +
op_name +
" has dimensions [" +
518template <
typename IndexType>
577 device +
": failed to allocate memory block of " +
600 "trying to access index " + std::
to_string(index) +
619 const std::string& index_type)
680 const std::string&
msg)
AllocationError is thrown if a memory allocation fails.
Definition exception.hpp:564
AllocationError(const std::string &file, int line, const std::string &device, size_type bytes)
Initializes an allocation error.
Definition exception.hpp:574
BadDimension is thrown if an operation is being applied to a LinOp with bad dimensions.
Definition exception.hpp:488
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:501
Error that denotes issues between block sizes and matrix dimensions.
Definition exception.hpp:519
BlockSizeError(const std::string &file, const int line, const int block_size, const IndexType size)
Definition exception.hpp:527
CublasError is thrown when a cuBLAS routine throws a non-zero error code.
Definition exception.hpp:224
CublasError(const std::string &file, int line, const std::string &func, int64 error_code)
Initializes a cuBLAS error.
Definition exception.hpp:234
CudaError is thrown when a CUDA routine throws a non-zero error code.
Definition exception.hpp:201
CudaError(const std::string &file, int line, const std::string &func, int64 error_code)
Initializes a CUDA error.
Definition exception.hpp:211
CufftError is thrown when a cuFFT routine throws a non-zero error code.
Definition exception.hpp:293
CufftError(const std::string &file, int line, const std::string &func, int64 error_code)
Initializes a cuFFT error.
Definition exception.hpp:303
CurandError is thrown when a cuRAND routine throws a non-zero error code.
Definition exception.hpp:247
CurandError(const std::string &file, int line, const std::string &func, int64 error_code)
Initializes a cuRAND error.
Definition exception.hpp:257
CusparseError is thrown when a cuSPARSE routine throws a non-zero error code.
Definition exception.hpp:270
CusparseError(const std::string &file, int line, const std::string &func, int64 error_code)
Initializes a cuSPARSE error.
Definition exception.hpp:280
DimensionMismatch is thrown if an operation is being applied to LinOps of incompatible size.
Definition exception.hpp:453
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:469
The Error class is used to report exceptional behaviour in library functions.
Definition exception.hpp:86
Error(const std::string &file, int line, const std::string &what)
Initializes an error.
Definition exception.hpp:95
virtual const char * what() const noexcept override
Returns a human-readable string with a more detailed description of the error.
Definition exception.hpp:103
HipError is thrown when a HIP routine throws a non-zero error code.
Definition exception.hpp:316
HipError(const std::string &file, int line, const std::string &func, int64 error_code)
Initializes a HIP error.
Definition exception.hpp:326
HipblasError is thrown when a hipBLAS routine throws a non-zero error code.
Definition exception.hpp:339
HipblasError(const std::string &file, int line, const std::string &func, int64 error_code)
Initializes a hipBLAS error.
Definition exception.hpp:349
HipfftError is thrown when a hipFFT routine throws a non-zero error code.
Definition exception.hpp:409
HipfftError(const std::string &file, int line, const std::string &func, int64 error_code)
Initializes a hipFFT error.
Definition exception.hpp:419
HiprandError is thrown when a hipRAND routine throws a non-zero error code.
Definition exception.hpp:362
HiprandError(const std::string &file, int line, const std::string &func, int64 error_code)
Initializes a hipRAND error.
Definition exception.hpp:372
HipsparseError is thrown when a hipSPARSE routine throws a non-zero error code.
Definition exception.hpp:386
HipsparseError(const std::string &file, int line, const std::string &func, int64 error_code)
Initializes a hipSPARSE error.
Definition exception.hpp:396
Exception thrown if an object is in an invalid state.
Definition exception.hpp:687
InvalidStateError(const std::string &file, int line, const std::string &func, const std::string &clarification)
Initializes an invalid state error.
Definition exception.hpp:697
KernelNotFound is thrown if Ginkgo cannot find a kernel which satisfies the criteria imposed by the i...
Definition exception.hpp:649
KernelNotFound(const std::string &file, int line, const std::string &func)
Initializes a KernelNotFound error.
Definition exception.hpp:658
MetisError is thrown when METIS routine throws an error code.
Definition exception.hpp:432
MetisError(const std::string &file, int line, const std::string &func, const std::string &error)
Initializes a METIS error.
Definition exception.hpp:442
MpiError is thrown when a MPI routine throws a non-zero error code.
Definition exception.hpp:179
MpiError(const std::string &file, int line, const std::string &func, int64 error_code)
Initializes a MPI error.
Definition exception.hpp:188
NotCompiled is thrown when attempting to call an operation which is a part of a module that was not c...
Definition exception.hpp:133
NotCompiled(const std::string &file, int line, const std::string &func, const std::string &module)
Initializes a NotCompiled error.
Definition exception.hpp:143
NotImplemented is thrown in case an operation has not yet been implemented (but will be implemented i...
Definition exception.hpp:114
NotImplemented(const std::string &file, int line, const std::string &func)
Initializes a NotImplemented error.
Definition exception.hpp:123
NotSupported is thrown in case it is not possible to perform the requested operation on the given obj...
Definition exception.hpp:156
NotSupported(const std::string &file, int line, const std::string &func, const std::string &obj_type)
Initializes a NotSupported error.
Definition exception.hpp:167
OutOfBoundsError is thrown if a memory access is detected to be out-of-bounds.
Definition exception.hpp:587
OutOfBoundsError(const std::string &file, int line, size_type index, size_type bound)
Initializes an OutOfBoundsError.
Definition exception.hpp:597
OverflowError is thrown when an index calculation for storage requirements overflows.
Definition exception.hpp:611
OverflowError(const std::string &file, const int line, const std::string &index_type)
Definition exception.hpp:618
StreamError is thrown if accessing a stream failed.
Definition exception.hpp:628
StreamError(const std::string &file, int line, const std::string &func, const std::string &message)
Initializes a file access error.
Definition exception.hpp:638
Exception throws if a matrix does not have a property required by a numerical method.
Definition exception.hpp:670
UnsupportedMatrixProperty(const std::string &file, const int line, const std::string &msg)
Initializes the UnsupportedMatrixProperty error.
Definition exception.hpp:679
ValueMismatch is thrown if two values are not equal.
Definition exception.hpp:539
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:551
The Ginkgo namespace.
Definition abstract_factory.hpp:48
constexpr T one()
Returns the multiplicative identity for T.
Definition math.hpp:803
std::int64_t int64
64-bit signed integral type.
Definition types.hpp:143
std::size_t size_type
Integral type used for allocation quantities.
Definition types.hpp:120