Block-Structured AMR Software Framework
AMReX_GpuError.H File Reference
#include <AMReX_Config.H>
#include <AMReX_Utility.H>
#include <string>

Go to the source code of this file.

Namespaces

 amrex
 
 amrex::Gpu
 

Macros

#define AMREX_GPU_SAFE_CALL(call)
 
#define AMREX_CUDA_SAFE_CALL(call)
 
#define AMREX_CURAND_SAFE_CALL(x)
 
#define AMREX_GPU_ERROR_CHECK()   amrex::Gpu::ErrorCheck(__FILE__, __LINE__)
 

Typedefs

using amrex::gpuError_t = cudaError_t
 

Functions

gpuError_t amrex::gpuGetLastError ()
 
const char * amrex::gpuGetErrorString (gpuError_t error)
 
void amrex::Gpu::ErrorCheck (const char *file, int line) noexcept
 

Variables

constexpr gpuError_t amrex::gpuSuccess = cudaSuccess
 

Macro Definition Documentation

◆ AMREX_CUDA_SAFE_CALL

#define AMREX_CUDA_SAFE_CALL (   call)
Value:
{ \
cudaError_t amrex_i_err = call; \
if (cudaSuccess != amrex_i_err) { \
std::string errStr(std::string("CUDA error ") + std::to_string(amrex_i_err) \
+ std::string(" in file ") + __FILE__ \
+ " line " + std::to_string(__LINE__) \
+ ": " + cudaGetErrorString(amrex_i_err)); \
amrex::Abort(errStr); \
}}
void Abort(const std::string &msg)
Print out message to cerr and exit via abort().
Definition: AMReX.cpp:221

◆ AMREX_CURAND_SAFE_CALL

#define AMREX_CURAND_SAFE_CALL (   x)
Value:
do { if((x)!=CURAND_STATUS_SUCCESS) { \
std::string errStr(std::string("CURAND error in file ") + __FILE__ \
+ " line " + std::to_string(__LINE__)); \
amrex::Abort(errStr); }} while(0)

◆ AMREX_GPU_ERROR_CHECK

#define AMREX_GPU_ERROR_CHECK ( )    amrex::Gpu::ErrorCheck(__FILE__, __LINE__)

◆ AMREX_GPU_SAFE_CALL

#define AMREX_GPU_SAFE_CALL (   call)
Value:
{ \
amrex::gpuError_t amrex_i_err = call; \
if (amrex::gpuSuccess != amrex_i_err) { \
std::string errStr(std::string("GPU error in file ") + __FILE__ \
+ " line " + std::to_string(__LINE__) \
+ " " + amrex::gpuGetErrorString(amrex_i_err)); \
amrex::Abort(errStr); \
}}
const char * gpuGetErrorString(gpuError_t error)
Definition: AMReX_GpuError.H:42
cudaError_t gpuError_t
Definition: AMReX_GpuError.H:33
constexpr gpuError_t gpuSuccess
Definition: AMReX_GpuError.H:34