SpikeGPU  1.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
common.h
Go to the documentation of this file.
1 #ifndef SPIKE_COMMON_H
2 #define SPIKE_COMMON_H
3 
4 
5 
6 #define ALWAYS_ASSERT
7 
8 #ifdef WIN32
9 typedef long long int64_t;
10 #endif
11 
12 
13 
14 // ----------------------------------------------------------------------------
15 // If ALWAYS_ASSERT is defined, we make sure that assertions are triggered
16 // even if NDEBUG is defined.
17 // ----------------------------------------------------------------------------
18 #ifdef ALWAYS_ASSERT
19 // If NDEBUG is actually defined, remember this so
20 // we can restore it.
21 # ifdef NDEBUG
22 # define NDEBUG_ACTIVE
23 # undef NDEBUG
24 # endif
25 // Include the assert.h header file here so that it can
26 // do its stuff while NDEBUG is guaranteed to be disabled.
27 # include <assert.h>
28 // Restore NDEBUG mode if it was active.
29 # ifdef NDEBUG_ACTIVE
30 # define NDEBUG
31 # undef NDEBUG_ACTIVE
32 # endif
33 #else
34 // Include the assert.h header file using whatever the
35 // current definition of NDEBUG is.
36 # include <assert.h>
37 #endif
38 
39 
40 // ----------------------------------------------------------------------------
41 
42 
43 #define BURST_VALUE (1e-7)
44 #define BURST_NEW_VALUE (1e-4)
45 
46 
47 namespace spike {
48 
49 const unsigned int BLOCK_SIZE = 512;
50 
51 const unsigned int MAX_GRID_DIMENSION = 32768;
52 
53 const unsigned int CRITICAL_THRESHOLD = 70;
54 
58 };
59 
63 };
64 
68 };
69 
70 inline
71 void kernelConfigAdjust(int &numThreads, int &numBlockX, const int numThreadsMax) {
72  if (numThreads > numThreadsMax) {
73  numBlockX = (numThreads + numThreadsMax - 1) / numThreadsMax;
74  numThreads = numThreadsMax;
75  }
76 }
77 
78 inline
79 void kernelConfigAdjust(int &numThreads, int &numBlockX, int &numBlockY, const int numThreadsMax, const int numBlockXMax) {
80  kernelConfigAdjust(numThreads, numBlockX, numThreadsMax);
81  if (numBlockX > numBlockXMax) {
82  numBlockY = (numBlockX + numBlockXMax - 1) / numBlockXMax;
83  numBlockX = numBlockXMax;
84  }
85 }
86 
87 
88 } // namespace spike
89 
90 
91 #endif
Definition: common.h:67
const unsigned int MAX_GRID_DIMENSION
Definition: common.h:51
Definition: common.h:62
KrylovSolverType
Definition: common.h:55
Definition: common.h:61
FactorizationMethod
Definition: common.h:60
PreconditionerType
Definition: common.h:65
const unsigned int CRITICAL_THRESHOLD
Definition: common.h:53
Definition: common.h:57
Definition: common.h:66
void kernelConfigAdjust(int &numThreads, int &numBlockX, const int numThreadsMax)
Definition: common.h:71
const unsigned int BLOCK_SIZE
Definition: common.h:49
Definition: common.h:56