SkePU(integratedwithStarPU)  0.8.1
 All Classes Namespaces Files Functions Enumerations Friends Macros Groups Pages
debug.h
Go to the documentation of this file.
1 
5 #ifndef DEBUG_H
6 #define DEBUG_H
7 
8 #include <assert.h>
9 
10 #ifndef SKEPU_DEBUG
11 #define SKEPU_DEBUG 0
12 #endif
13 
14 //Currently StarPU does not support multiple threads inside OpenMP, even if you explicitly set it.
15 #ifndef STARPU_OMP_THREADS
16 #define STARPU_OMP_THREADS 1
17 #endif
18 
19 #if SKEPU_DEBUG > 0
20 #include <iostream>
21 #endif
22 
23 #if SKEPU_DEBUG > 0
24  #define DEBUG_TEXT_LEVEL1(text) std::cerr<<text; // uses it to output starpu codelet execution as well
25 #else
26  #define DEBUG_TEXT_LEVEL1(text)
27 #endif
28 
29 #if SKEPU_DEBUG > 1
30  #define DEBUG_TEXT_LEVEL2(text) std::cerr<<text;
31 #else
32  #define DEBUG_TEXT_LEVEL2(text)
33 #endif
34 
35 #if SKEPU_DEBUG > 2
36  #define DEBUG_TEXT_LEVEL3(text) std::cerr<<text;
37 #else
38  #define DEBUG_TEXT_LEVEL3(text)
39 #endif
40 
41 
42 #ifndef SKEPU_ASSERT
43 #define SKEPU_ASSERT(expr) assert(expr)
44 #endif
45 
46 
47 
48 #define SKEPU_ABORT() exit(1)
49 
50 #ifdef __GNUC__
51 #define SKEPU_UNLIKELY(expr) (__builtin_expect(!!(expr),0))
52 #define SKEPU_LIKELY(expr) (__builtin_expect(!!(expr),1))
53 #define SKEPU_ATTRIBUTE_UNUSED __attribute__((unused))
54 #define SKEPU_ATTRIBUTE_INTERNAL __attribute__ ((visibility ("internal")))
55 #else
56 #define SKEPU_UNLIKELY(expr) (expr)
57 #define SKEPU_LIKELY(expr) (expr)
58 #define SKEPU_ATTRIBUTE_UNUSED
59 #define SKEPU_ATTRIBUTE_INTERNAL
60 #endif
61 
62 #ifdef SKEPU_OPENCL
63 #define CL_CHECK_ERROR(err) if(err != CL_SUCCESS) {std::cerr<<"Error building OpenCL program!!\n" <<err <<"\n";}
64 #endif
65 
66 #endif
67