Block-Structured AMR Software Framework
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches
AMReX_GpuError.H File Reference
#include <AMReX_Config.H>
#include <AMReX_Utility.H>
#include <string>

Go to the source code of this file.

Namespaces

namespace  amrex
 
namespace  amrex::Gpu
 

Macros

#define AMREX_GPU_SAFE_CALL(call)
 
#define AMREX_CUDA_SAFE_CALL(call)
 
#define AMREX_CURAND_SAFE_CALL(call)
 
#define AMREX_CUFFT_SAFE_CALL(call)
 
#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); \
}}

◆ AMREX_CUFFT_SAFE_CALL

#define AMREX_CUFFT_SAFE_CALL (   call)
Value:
{ \
cufftResult_t amrex_i_err = call; \
if (CUFFT_SUCCESS != amrex_i_err) { \
std::string errStr(std::string("CUFFT error ")+std::to_string(amrex_i_err) \
+ std::string(" in file ") + __FILE__ \
+ " line " + std::to_string(__LINE__)); \
amrex::Abort(errStr); \
}}

◆ AMREX_CURAND_SAFE_CALL

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

◆ 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