ISAAC
Overview :: Library Doc :: Server Doc :: JSON Commands

In Situ Animation of Accelerated Computations

isaac_defines.hpp
Go to the documentation of this file.
1 /* This file is part of ISAAC.
2  *
3  * ISAAC is free software: you can redistribute it and/or modify
4  * it under the terms of the GNU Lesser General Public License as
5  * published by the Free Software Foundation, either version 3 of the
6  * License, or (at your option) any later version.
7  *
8  * ISAAC is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with ISAAC. If not, see <www.gnu.org/licenses/>. */
15 
16 #pragma once
17 
18 #include <boost/preprocessor.hpp>
19 
20 #ifndef ISAAC_VECTOR_ELEM
21  #define ISAAC_VECTOR_ELEM 2
22 #endif
23 
24 #ifndef ISAAC_MAX_DIFFERENCE
25  #define ISAAC_MAX_DIFFERENCE 4
26 #endif
27 
28 #ifndef ISAAC_MAX_FUNCTORS
29  #define ISAAC_MAX_FUNCTORS 3
30 #endif
31 
32 // ISAAC_FUNCTOR_COUNT ^ ISAAC_MAX_FUNCTORS
33 #define ISAAC_FUNCTOR_COMPLEX_SUBDEF(Z,I,U) * ISAAC_FUNCTOR_COUNT
34 #define ISAAC_FUNCTOR_COMPLEX ( ISAAC_FUNCTOR_COUNT BOOST_PP_REPEAT( BOOST_PP_DEC( ISAAC_MAX_FUNCTORS ), ISAAC_FUNCTOR_COMPLEX_SUBDEF, ~) )
35 
36 #ifndef ISAAC_MAX_SOURCES
37  #define ISAAC_MAX_SOURCES 16
38 #endif
39 
40 #ifndef ISAAC_GUARD_SIZE
41  #define ISAAC_GUARD_SIZE 2
42 #endif
43 
44 #ifndef ISAAC_DEFAULT_STEP
45  #define ISAAC_DEFAULT_STEP 0.5
46 #endif
47 
48 #ifndef ISAAC_MAX_CLIPPING
49  #define ISAAC_MAX_CLIPPING 16
50 #endif
51 
52 #ifndef ISAAC_DEFAULT_WEIGHT
53  #define ISAAC_DEFAULT_WEIGHT isaac_float( 2 )
54 #endif
55 
56 #define ISAAC_MAX_RECEIVE 262144 //256kb
57 #define ISAAC_Z_NEAR 1.0f
58 #define ISAAC_Z_FAR 100.0f
59 
60 #if ISAAC_ALPAKA == 1
61  #ifdef __CUDACC__
62  #define ISAAC_HOST_DEVICE_INLINE ALPAKA_FN_ACC __forceinline__
63  #else
64  #define ISAAC_HOST_DEVICE_INLINE ALPAKA_FN_ACC inline
65  #endif
66 #else
67  #define ISAAC_HOST_DEVICE_INLINE __device__ __host__ __forceinline__
68 #endif
69 
70 #if ISAAC_ALPAKA == 1
71  #define ISAAC_HOST_INLINE ALPAKA_FN_HOST inline
72 #else
73  #define ISAAC_HOST_INLINE __host__ __forceinline__
74 #endif
75 
76 #if ISAAC_ALPAKA == 1
77  #define ISAAC_DEVICE_INLINE ISAAC_HOST_DEVICE_INLINE
78 #else
79  #define ISAAC_DEVICE_INLINE __device__ __forceinline__
80 #endif
81 
82 #ifdef __CUDACC__
83  #define ISAAC_DEVICE __device__ __host__
84 #else
85  #define ISAAC_DEVICE
86 #endif
87 
88 #ifdef __CUDACC__
89  #define ISAAC_NO_HOST_DEVICE_WARNING _Pragma("hd_warning_disable")
90 #else
91  #define ISAAC_NO_HOST_DEVICE_WARNING
92 #endif
93 
94 #define ISAAC_ELEM_ITERATE( NAME ) for (isaac_uint NAME = 0; NAME < isaac_uint(ISAAC_VECTOR_ELEM); NAME++)
95 
96 #define ISAAC_ELEM_ALL_TRUE_RETURN( NAME ) \
97 { \
98  bool all_true = true; \
99  for (isaac_uint e = 0; e < isaac_uint(ISAAC_VECTOR_ELEM); e++) \
100  if (NAME[e] == false) \
101  all_true = false; \
102  if (all_true) \
103  return; \
104 }
105 
106 #if ISAAC_ALPAKA == 1
107  #define ISAAC_CONSTANT ALPAKA_STATIC_DEV_MEM_CONSTANT
108 #else
109  #define ISAAC_CONSTANT __constant__
110 #endif
111 
112 #ifdef __CUDACC__
113  #define ISAAC_MAX max
114  #define ISAAC_MIN min
115 #else
116  #define ISAAC_MAX std::max
117  #define ISAAC_MIN std::min
118 #endif