Alsvinn  0.5.3
The fast FVM simulator with UQ support
Macros
cuda_safe_call.hpp File Reference
#include <iostream>
#include "alsutils/error/Exception.hpp"

Go to the source code of this file.

Macros

#define CUDA_SAFE_CALL(x)
 Executes the given code and checks for cuda error. More...
 
#define CUDA_SAFE_CALL_SILENT(x)
 Does the same as CUDA_SAFE_CALL, but doesn't print an error message. More...
 

Macro Definition Documentation

◆ CUDA_SAFE_CALL

#define CUDA_SAFE_CALL (   x)
Value:
{ \
cudaError_t error = x; \
if (error != cudaSuccess) { \
std::cerr << "Noticed CUDA error in " << __FILE__ << ":" << __LINE__ << std::endl; \
std::cerr << "\tLine was:\"" << #x << "\"" << std::endl; \
std::cerr << "\tError: " << cudaGetErrorString(error) << std::endl; \
THROW("CUDA error" << std::endl << "Line was: " << std::endl <<"\t" << #x << "\nError code: " << error); \
} \
}
Definition: log.hpp:49

Executes the given code and checks for cuda error.

◆ CUDA_SAFE_CALL_SILENT

#define CUDA_SAFE_CALL_SILENT (   x)
Value:
{ \
cudaError_t error = x; \
if (error != cudaSuccess) { \
THROW("CUDA error" << std::endl << "Line was: " << std::endl <<"\t" << #x << "\nError code: " << error); \
} \
}
Definition: log.hpp:49

Does the same as CUDA_SAFE_CALL, but doesn't print an error message.