KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gpu_cudart.h
Go to the documentation of this file.
1 /* $Id$ */
2 /* {{{=========================================================================== *
3  |
4  | Copyright (c) 1994-2011 by Kobus Barnard (author)
5  |
6  | Personal and educational use of this code is granted, provided that this
7  | header is kept intact, and that the authorship is not misrepresented, that
8  | its use is acknowledged in publications, and relevant papers are cited.
9  |
10  | For other use contact the author (kobus AT cs DOT arizona DOT edu).
11  |
12  | Please note that the code in this file has not necessarily been adequately
13  | tested. Naturally, there is no guarantee of performance, support, or fitness
14  | for any particular task. Nonetheless, I am interested in hearing about
15  | problems that you encounter.
16  |
17  | Author: Kyle Simek
18  * =========================================================================== }}}*/
19 
20 // vim: tabstop=4 shiftwidth=4 foldmethod=marker
21 
22 #ifndef KJB_CUDA_RUNTIME_H
23 #define KJB_CUDA_RUNTIME_H
24 
25 #ifdef KJB_HAVE_CUDART
26 #include <cuda_runtime.h>
27 
28 #define CUDA_ETX(x) \
29 { \
30  cudaError_t err = (x); \
31  if(err) \
32  { \
33  std::cerr << "cuda_error: " << err << std::endl; \
34  KJB_THROW_2(kjb::Exception, cudaGetErrorString(err)); \
35  } \
36 }
37 
38 #define CUDA_EPETE(x) \
39  cudaError_t err = (x); \
40  if(err) \
41  { \
42  std::cerr << "cuda_error: " << err << std::endl; \
43  exit(err); \
44  }
45 
46 #endif /* KJB_HAVE_CUDART */
47 
48 #endif