FZGPUModules 2.0
GPU-accelerated modular compression pipelines
Loading...
Searching...
No Matches
cuda_check.h
Go to the documentation of this file.
1#pragma once
2
3#include <cuda_runtime.h>
4#include <stdexcept>
5#include <string>
6
7#include "log.h"
8
34#define FZ_CUDA_CHECK(call) \
35 do { \
36 cudaError_t _fz_cuda_err_ = (call); \
37 if (_fz_cuda_err_ != cudaSuccess) { \
38 throw std::runtime_error( \
39 std::string("[fzgmod] CUDA error at " __FILE__ ":") + \
40 std::to_string(__LINE__) + \
41 " — " #call " → " + \
42 cudaGetErrorString(_fz_cuda_err_)); \
43 } \
44 } while (0)
45
46#define FZ_CUDA_CHECK_WARN(call) \
47 do { \
48 cudaError_t _fz_cuda_err_ = (call); \
49 if (_fz_cuda_err_ != cudaSuccess) { \
50 FZ_LOG(WARN, \
51 "CUDA error at %s:%d — " #call " → %s", \
52 __FILE__, __LINE__, \
53 cudaGetErrorString(_fz_cuda_err_)); \
54 } \
55 } while (0)
Logging infrastructure and macros.