25 lines
596 B
C
25 lines
596 B
C
|
|
#ifndef HANDLE_ERROR_H_
|
||
|
|
#define HANDLE_ERROR_H_
|
||
|
|
#include <stdexcept>
|
||
|
|
#include <string>
|
||
|
|
#include <sstream>
|
||
|
|
#include "cuda_runtime.h"
|
||
|
|
#include "cublas.h"
|
||
|
|
#include "cusparse.h"
|
||
|
|
|
||
|
|
class cuda_exception: public std::runtime_error {
|
||
|
|
public:
|
||
|
|
cuda_exception(const std::string& message);
|
||
|
|
};
|
||
|
|
|
||
|
|
void handle_error(cudaError_t error, const char *file, int line );
|
||
|
|
|
||
|
|
void handle_error(cublasStatus_t error, const char *file, int line );
|
||
|
|
|
||
|
|
void handle_error(cusparseStatus_t error, const char *file, int line );
|
||
|
|
|
||
|
|
#define HANDLE_ERROR(error) ::handle_error(error, __FILE__, __LINE__ )
|
||
|
|
|
||
|
|
|
||
|
|
#endif /* HANDLE_ERROR_H_ */
|