common.h
Go to the documentation of this file.
1 /*
2 * ECVL - European Computer Vision Library
3 * Version: 0.3.4
4 * copyright (c) 2021, Università degli Studi di Modena e Reggio Emilia (UNIMORE), AImageLab
5 * Authors:
6 * Costantino Grana (costantino.grana@unimore.it)
7 * Federico Bolelli (federico.bolelli@unimore.it)
8 * Michele Cancilla (michele.cancilla@unimore.it)
9 * Laura Canalini (laura.canalini@unimore.it)
10 * Stefano Allegretti (stefano.allegretti@unimore.it)
11 * All rights reserved.
12 */
13 
14 #ifndef ECVL_CUDA_COMMON_H_
15 #define ECVL_CUDA_COMMON_H_
16 
17 #include <string>
18 
20 
21 #include <cuda_runtime.h>
22 
23 namespace ecvl
24 {
25 
26 static inline void checkCudaError(cudaError_t err)
27 {
28  if (cudaSuccess != err)
29  throw std::runtime_error(std::string(ECVL_ERROR_MSG) + std::string(cudaGetErrorString(err)));
30 }
31 
32 
33 #ifndef ecvlCudaSafeCall
34 #define ecvlCudaSafeCall(expr) ecvl::checkCudaError(expr)
35 #endif
36 
37 }
38 
39 #endif // ECVL_CUDA_COMMON_H_
#define ECVL_ERROR_MSG