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 }
FILE * file
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...
Utility.
Definition: capture.hpp:8
static int divUp(int total, int grain)
Definition: safe_call.hpp:29
static void ___cudaSafeCall(cudaError_t err, const char *file, const int line, const char *func="")
Definition: safe_call.hpp:23


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 Mon Feb 28 2022 22:46:09