1 #ifndef GUARD_GGEMS_TOOLS_GGEMSTYPES_HH
2 #define GUARD_GGEMS_TOOLS_GGEMSTYPES_HH
37 #define CL_HPP_TARGET_OPENCL_VERSION 120
38 #define CL_HPP_MINIMUM_OPENCL_VERSION 120
40 #ifdef __OPENCL_C_VERSION__ // On OpenCL device
46 #define GGchar16 char16
49 #define GGuchar2 uchar2
50 #define GGuchar3 uchar3
51 #define GGuchar4 uchar4
52 #define GGuchar8 uchar8
53 #define GGuchar16 uchar16
56 #define GGshort2 short2
57 #define GGshort3 short3
58 #define GGshort4 short4
59 #define GGshort8 short8
60 #define GGshort16 short16
62 #define GGushort ushort
63 #define GGushort2 ushort2
64 #define GGushort3 ushort3
65 #define GGushort4 ushort4
66 #define GGushort8 ushort8
67 #define GGushort16 ushort16
81 #define GGuint16 uint16
88 #define GGlong16 long16
91 #define GGulong2 ulong2
92 #define GGulong3 ulong3
93 #define GGulong4 ulong4
94 #define GGulong8 ulong8
95 #define GGulong16 ulong16
97 #define GGsize GGulong
100 #define GGfloat2 float2
101 #define GGfloat3 float3
102 #define GGfloat4 float4
103 #define GGfloat8 float8
104 #define GGfloat16 float16
106 #if defined(cl_khr_fp64) // Khronos extension available?
107 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
108 #elif defined(cl_amd_fp64) // AMD extension available?
109 #pragma OPENCL EXTENSION cl_amd_fp64 : enable
112 #define GGdouble double
113 #define GGdouble2 double2
114 #define GGdouble3 double3
115 #define GGdouble4 double4
116 #define GGdouble8 double8
117 #define GGdouble16 double16
119 #ifdef DOSIMETRY_DOUBLE_PRECISION
120 #define GGDosiType GGdouble
122 #if defined(cl_khr_int64_base_atomics)
123 #pragma OPENCL EXTENSION cl_khr_int64_base_atomics : enable
125 #error "Int64 atomic operation not available on your OpenCL device!!! Please recompile GGEMS setting DOSIMETRY_DOUBLE_PRECISION to OFF."
129 #define GGDosiType GGfloat
147 } next, expected, current;
149 current.f32 = *address;
152 expected.f32 = current.f32;
153 next.f32 = expected.f32 + val;
154 current.u32 = atomic_cmpxchg((
volatile global
GGuint*)address, expected.u32, next.u32);
155 }
while(current.u32 != expected.u32);
168 #ifdef DOSIMETRY_DOUBLE_PRECISION
174 } next, expected, current;
176 current.f64 = *address;
179 expected.f64 = current.f64;
180 next.f64 = expected.f64 + val;
181 current.u64 = atom_cmpxchg((
volatile global
GGulong*)address, expected.u64, next.u64);
182 }
while(current.u64 != expected.u64);
189 #include <OpenCL/opencl.hpp>
194 #define GGbool cl_bool
196 #define GGchar cl_char
197 #define GGchar2 cl_char2
198 #define GGchar3 cl_char3
199 #define GGchar4 cl_char4
200 #define GGchar8 cl_char8
201 #define GGchar16 cl_char16
203 #define GGuchar cl_uchar
204 #define GGuchar2 cl_uchar2
205 #define GGuchar3 cl_uchar3
206 #define GGuchar4 cl_uchar4
207 #define GGuchar8 cl_uchar8
208 #define GGuchar16 cl_uchar16
210 #define GGshort cl_short
211 #define GGshort2 cl_short2
212 #define GGshort3 cl_short3
213 #define GGshort4 cl_short4
214 #define GGshort8 cl_short8
215 #define GGshort16 cl_short16
217 #define GGushort cl_ushort
218 #define GGushort2 cl_ushort2
219 #define GGushort3 cl_ushort3
220 #define GGushort4 cl_ushort4
221 #define GGushort8 cl_ushort8
222 #define GGushort16 cl_ushort16
225 #define GGint2 cl_int2
226 #define GGint3 cl_int3
227 #define GGint4 cl_int4
228 #define GGint8 cl_int8
229 #define GGint16 cl_int16
231 #define GGuint cl_uint
232 #define GGuint2 cl_uint2
233 #define GGuint3 cl_uint3
234 #define GGuint4 cl_uint4
235 #define GGuint8 cl_uint8
236 #define GGuint16 cl_uint16
238 #define GGlong cl_long
239 #define GGlong2 cl_long2
240 #define GGlong3 cl_long3
241 #define GGlong4 cl_long4
242 #define GGlong8 cl_long8
243 #define GGlong16 cl_long16
245 #define GGulong cl_ulong
246 #define GGulong2 cl_ulong2
247 #define GGulong3 cl_ulong3
248 #define GGulong4 cl_ulong4
249 #define GGulong8 cl_ulong8
250 #define GGulong16 cl_ulong16
252 #define GGsize std::size_t
258 typedef struct GGsize2_t {
273 #define GGfloat cl_float
274 #define GGfloat2 cl_float2
275 #define GGfloat3 cl_float3
276 #define GGfloat4 cl_float4
277 #define GGfloat8 cl_float8
278 #define GGfloat16 cl_float16
280 #define GGdouble cl_double
281 #define GGdouble2 cl_double2
282 #define GGdouble3 cl_double3
283 #define GGdouble4 cl_double4
284 #define GGdouble8 cl_double8
285 #define GGdouble16 cl_double16
287 #ifdef DOSIMETRY_DOUBLE_PRECISION
288 #define GGDosiType GGdouble
290 #define GGDosiType GGfloat
295 #endif // End of GUARD_GGEMS_TOOLS_GGEMSTYPES_HH