safe_call.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "cuda_runtime_api.h"
4 
5 namespace kfusion
6 {
7  namespace cuda
8  {
9  void error(const char *error_string, const char *file, const int line, const char *func);
10  }
11 }
12 
13 #if defined(__GNUC__)
14  #define cudaSafeCall(expr) kfusion::cuda::___cudaSafeCall(expr, __FILE__, __LINE__, __func__)
15 #else /* defined(__CUDACC__) || defined(__MSVC__) */
16  #define cudaSafeCall(expr) kfusion::cuda::___cudaSafeCall(expr, __FILE__, __LINE__)
17 #endif
18 
19 namespace kfusion
20 {
21  namespace cuda
22  {
23  static inline void ___cudaSafeCall(cudaError_t err, const char *file, const int line, const char *func = "")
24  {
25  if (cudaSuccess != err)
26  error(cudaGetErrorString(err), file, line, func);
27  }
28 
29  static inline int divUp(int total, int grain) { return (total + grain - 1) / grain; }
30  }
31 
32  namespace device
33  {
35  }
36 }
kfusion
Utility.
Definition: capture.hpp:8
file
FILE * file
Definition: arithmeticencoder.cpp:77
kfusion::cuda::___cudaSafeCall
static void ___cudaSafeCall(cudaError_t err, const char *file, const int line, const char *func="")
Definition: safe_call.hpp:23
kfusion::cuda::error
KF_EXPORTS void error(const char *error_string, const char *file, const int line, const char *func="")
Error handler. All GPU functions from this subsystem call the function to report an error....
Definition: device_memory.cpp:7
kfusion::cuda::divUp
static int divUp(int total, int grain)
Definition: safe_call.hpp:29


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Wed Mar 2 2022 00:37:24