Kokkos Core Kernels Package  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Kokkos_Macros.hpp
1 /*
2 //@HEADER
3 // ************************************************************************
4 //
5 // Kokkos v. 2.0
6 // Copyright (2014) Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact Christian R. Trott (crtrott@sandia.gov)
39 //
40 // ************************************************************************
41 //@HEADER
42 */
43 
44 #ifndef KOKKOS_MACROS_HPP
45 #define KOKKOS_MACROS_HPP
46 
47 //----------------------------------------------------------------------------
62 #ifndef KOKKOS_DONT_INCLUDE_CORE_CONFIG_H
63  #include <KokkosCore_config.h>
64 #endif
65 
66 #include <impl/Kokkos_OldMacros.hpp>
67 
68 //----------------------------------------------------------------------------
98 //----------------------------------------------------------------------------
99 
100 #if defined(KOKKOS_ENABLE_SERIAL) || defined(KOKKOS_ENABLE_THREADS) || \
101  defined(KOKKOS_ENABLE_OPENMP) || defined(KOKKOS_ENABLE_QTHREADS) || \
102  defined(KOKKOS_ENABLE_HPX) || \
103  defined(KOKKOS_ENABLE_ROCM) || defined(KOKKOS_ENABLE_OPENMPTARGET)
104  #define KOKKOS_INTERNAL_ENABLE_NON_CUDA_BACKEND
105 #endif
106 
107 #if !defined(KOKKOS_ENABLE_THREADS) && !defined(KOKKOS_ENABLE_CUDA) && \
108  !defined(KOKKOS_ENABLE_OPENMP) && !defined(KOKKOS_ENABLE_QTHREADS) && \
109  !defined(KOKKOS_ENABLE_HPX) && \
110  !defined(KOKKOS_ENABLE_ROCM) && !defined(KOKKOS_ENABLE_OPENMPTARGET)
111  #define KOKKOS_INTERNAL_NOT_PARALLEL
112 #endif
113 
114 #define KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA
115 
116 #if defined( KOKKOS_ENABLE_CUDA ) && defined( __CUDACC__ )
117  // Compiling with a CUDA compiler.
118  //
119  // Include <cuda.h> to pick up the CUDA_VERSION macro defined as:
120  // CUDA_VERSION = ( MAJOR_VERSION * 1000 ) + ( MINOR_VERSION * 10 )
121  //
122  // When generating device code the __CUDA_ARCH__ macro is defined as:
123  // __CUDA_ARCH__ = ( MAJOR_CAPABILITY * 100 ) + ( MINOR_CAPABILITY * 10 )
124 
125  #include <cuda_runtime.h>
126  #include <cuda.h>
127 
128  #if !defined( CUDA_VERSION )
129  #error "#include <cuda.h> did not define CUDA_VERSION."
130  #endif
131 
132  #if ( CUDA_VERSION < 7000 )
133  // CUDA supports C++11 in device code starting with version 7.0.
134  // This includes auto type and device code internal lambdas.
135  #error "Cuda version 7.0 or greater required."
136  #endif
137 
138  #if defined( __CUDA_ARCH__ ) && ( __CUDA_ARCH__ < 300 )
139  // Compiling with CUDA compiler for device code.
140  #error "Cuda device capability >= 3.0 is required."
141  #endif
142 
143  #ifdef KOKKOS_ENABLE_CUDA_LAMBDA
144  #if ( CUDA_VERSION < 7050 )
145  // CUDA supports C++11 lambdas generated in host code to be given
146  // to the device starting with version 7.5. But the release candidate (7.5.6)
147  // still identifies as 7.0.
148  #error "Cuda version 7.5 or greater required for host-to-device Lambda support."
149  #endif
150 
151  #if ( CUDA_VERSION < 8000 ) && defined( __NVCC__ )
152  #define KOKKOS_LAMBDA [=]__device__
153  #if defined( KOKKOS_INTERNAL_ENABLE_NON_CUDA_BACKEND )
154  #undef KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA
155  #endif
156  #else
157  #define KOKKOS_LAMBDA [=]__host__ __device__
158 
159  #if defined( KOKKOS_ENABLE_CXX17 ) || defined( KOKKOS_ENABLE_CXX20 )
160  #define KOKKOS_CLASS_LAMBDA [=,*this] __host__ __device__
161  #endif
162  #endif
163 
164  #if defined( __NVCC__ )
165  #define KOKKOS_IMPL_NEED_FUNCTOR_WRAPPER
166  #endif
167  #else // !defined(KOKKOS_ENABLE_CUDA_LAMBDA)
168  #undef KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA
169  #endif // !defined(KOKKOS_ENABLE_CUDA_LAMBDA)
170 
171  #if ( 9000 <= CUDA_VERSION ) && ( CUDA_VERSION < 10000 )
172  // CUDA 9 introduced an incorrect warning,
173  // see https://github.com/kokkos/kokkos/issues/1470
174  #define KOKKOS_CUDA_9_DEFAULTED_BUG_WORKAROUND
175  #endif
176 
177  #if ( 10000 > CUDA_VERSION )
178  #define KOKKOS_ENABLE_PRE_CUDA_10_DEPRECATION_API
179  #endif
180 
181  #if defined(__CUDA_ARCH__) && (__CUDA_ARCH__ >= 700)
182  // PTX atomics with memory order semantics are only available on volta and later
183  #if !defined(KOKKOS_DISABLE_CUDA_ASM)
184  #if !defined(KOKKOS_ENABLE_CUDA_ASM)
185  #define KOKKOS_ENABLE_CUDA_ASM
186  #if !defined(KOKKOS_DISABLE_CUDA_ASM_ATOMICS)
187  #define KOKKOS_ENABLE_CUDA_ASM_ATOMICS
188  #endif
189  #endif
190  #endif
191  #endif
192 
193 
194 #endif // #if defined( KOKKOS_ENABLE_CUDA ) && defined( __CUDACC__ )
195 
196 
197 //----------------------------------------------------------------------------
198 // Mapping compiler built-ins to KOKKOS_COMPILER_*** macros
199 
200 #if defined( __NVCC__ )
201  // NVIDIA compiler is being used.
202  // Code is parsed and separated into host and device code.
203  // Host code is compiled again with another compiler.
204  // Device code is compile to 'ptx'.
205  #define KOKKOS_COMPILER_NVCC __NVCC__
206 #endif // #if defined( __NVCC__ )
207 
208 #if !defined( KOKKOS_LAMBDA )
209  #define KOKKOS_LAMBDA [=]
210 #endif
211 
212 #if (defined( KOKKOS_ENABLE_CXX17 ) || defined( KOKKOS_ENABLE_CXX20) )&& !defined( KOKKOS_CLASS_LAMBDA )
213  #define KOKKOS_CLASS_LAMBDA [=,*this]
214 #endif
215 
216 //#if !defined( __CUDA_ARCH__ ) // Not compiling Cuda code to 'ptx'.
217 
218 // Intel compiler for host code.
219 
220 #if defined( __INTEL_COMPILER )
221  #define KOKKOS_COMPILER_INTEL __INTEL_COMPILER
222 #elif defined( __ICC )
223  // Old define
224  #define KOKKOS_COMPILER_INTEL __ICC
225 #elif defined( __ECC )
226  // Very old define
227  #define KOKKOS_COMPILER_INTEL __ECC
228 #endif
229 
230 // CRAY compiler for host code
231 #if defined( _CRAYC )
232  #define KOKKOS_COMPILER_CRAYC _CRAYC
233 #endif
234 
235 #if defined( __IBMCPP__ )
236  // IBM C++
237  #define KOKKOS_COMPILER_IBM __IBMCPP__
238 #elif defined( __IBMC__ )
239  #define KOKKOS_COMPILER_IBM __IBMC__
240 #endif
241 
242 #if defined( __APPLE_CC__ )
243  #define KOKKOS_COMPILER_APPLECC __APPLE_CC__
244 #endif
245 
246 #if defined( __clang__ ) && !defined( KOKKOS_COMPILER_INTEL )
247  #define KOKKOS_COMPILER_CLANG __clang_major__*100+__clang_minor__*10+__clang_patchlevel__
248 #endif
249 
250 #if !defined( __clang__ ) && !defined( KOKKOS_COMPILER_INTEL ) &&defined( __GNUC__ )
251  #define KOKKOS_COMPILER_GNU __GNUC__*100+__GNUC_MINOR__*10+__GNUC_PATCHLEVEL__
252 
253  #if ( 472 > KOKKOS_COMPILER_GNU )
254  #error "Compiling with GCC version earlier than 4.7.2 is not supported."
255  #endif
256 #endif
257 
258 #if defined( __PGIC__ )
259  #define KOKKOS_COMPILER_PGI __PGIC__*100+__PGIC_MINOR__*10+__PGIC_PATCHLEVEL__
260 
261  #if ( 1540 > KOKKOS_COMPILER_PGI )
262  #error "Compiling with PGI version earlier than 15.4 is not supported."
263  #endif
264 #endif
265 
266 //#endif // #if !defined( __CUDA_ARCH__ )
267 //----------------------------------------------------------------------------
268 // Language info: C++, CUDA, OPENMP
269 
270 #if defined( KOKKOS_ENABLE_CUDA )
271  // Compiling Cuda code to 'ptx'
272 
273  #define KOKKOS_FORCEINLINE_FUNCTION __device__ __host__ __forceinline__
274  #define KOKKOS_INLINE_FUNCTION __device__ __host__ inline
275  #define KOKKOS_FUNCTION __device__ __host__
276  #if defined( KOKKOS_COMPILER_NVCC )
277  #define KOKKOS_INLINE_FUNCTION_DELETED inline
278  #else
279  #define KOKKOS_INLINE_FUNCTION_DELETED __device__ __host__ inline
280  #endif
281 #endif // #if defined( __CUDA_ARCH__ )
282 
283 #if defined( KOKKOS_ENABLE_ROCM ) && defined( __HCC__ )
284 
285  #define KOKKOS_FORCEINLINE_FUNCTION __attribute__((amp,cpu)) inline
286  #define KOKKOS_INLINE_FUNCTION __attribute__((amp,cpu)) inline
287  #define KOKKOS_FUNCTION __attribute__((amp,cpu))
288  #define KOKKOS_LAMBDA [=] __attribute__((amp,cpu))
289 #endif
290 
291 #if defined( _OPENMP )
292  // Compiling with OpenMP.
293  // The value of _OPENMP is an integer value YYYYMM
294  // where YYYY and MM are the year and month designation
295  // of the supported OpenMP API version.
296 #endif // #if defined( _OPENMP )
297 
298 //----------------------------------------------------------------------------
299 // Intel compiler macros
300 
301 #if defined( KOKKOS_COMPILER_INTEL )
302  #define KOKKOS_ENABLE_PRAGMA_UNROLL 1
303  #define KOKKOS_ENABLE_PRAGMA_LOOPCOUNT 1
304  #define KOKKOS_ENABLE_PRAGMA_VECTOR 1
305  #if ( 1800 > KOKKOS_COMPILER_INTEL )
306  #define KOKKOS_ENABLE_PRAGMA_SIMD 1
307  #endif
308 
309  #if ( __INTEL_COMPILER > 1400 )
310  #define KOKKOS_ENABLE_PRAGMA_IVDEP 1
311  #endif
312 
313  #if ! defined( KOKKOS_MEMORY_ALIGNMENT )
314  #define KOKKOS_MEMORY_ALIGNMENT 64
315  #endif
316 
317  #define KOKKOS_RESTRICT __restrict__
318 
319  #ifndef KOKKOS_IMPL_ALIGN_PTR
320  #define KOKKOS_IMPL_ALIGN_PTR(size) __attribute__((align_value(size)))
321  #endif
322 
323  #if ( 1400 > KOKKOS_COMPILER_INTEL )
324  #if ( 1300 > KOKKOS_COMPILER_INTEL )
325  #error "Compiling with Intel version earlier than 13.0 is not supported. Official minimal version is 14.0."
326  #else
327  #warning "Compiling with Intel version 13.x probably works but is not officially supported. Official minimal version is 14.0."
328  #endif
329  #endif
330 
331  #if !defined( KOKKOS_ENABLE_ASM ) && !defined( _WIN32 )
332  #define KOKKOS_ENABLE_ASM 1
333  #endif
334 
335  #if !defined( KOKKOS_FORCEINLINE_FUNCTION )
336  #if !defined( _WIN32 )
337  #define KOKKOS_FORCEINLINE_FUNCTION inline __attribute__((always_inline))
338  #else
339  #define KOKKOS_FORCEINLINE_FUNCTION inline
340  #endif
341  #endif
342 
343  #if defined( KOKKOS_ARCH_AVX512MIC )
344  #define KOKKOS_ENABLE_RFO_PREFETCH 1
345  #if (KOKKOS_COMPILER_INTEL < 1800) && !defined(KOKKOS_KNL_USE_ASM_WORKAROUND)
346  #define KOKKOS_KNL_USE_ASM_WORKAROUND 1
347  #endif
348  #endif
349 
350  #if defined( __MIC__ )
351  // Compiling for Xeon Phi
352  #endif
353 #endif
354 
355 //----------------------------------------------------------------------------
356 // Cray compiler macros
357 
358 #if defined( KOKKOS_COMPILER_CRAYC )
359 #endif
360 
361 //----------------------------------------------------------------------------
362 // IBM Compiler macros
363 
364 #if defined( KOKKOS_COMPILER_IBM )
365  #define KOKKOS_ENABLE_PRAGMA_UNROLL 1
366  //#define KOKKOS_ENABLE_PRAGMA_IVDEP 1
367  //#define KOKKOS_ENABLE_PRAGMA_LOOPCOUNT 1
368  //#define KOKKOS_ENABLE_PRAGMA_VECTOR 1
369  //#define KOKKOS_ENABLE_PRAGMA_SIMD 1
370 
371  #if ! defined( KOKKOS_ENABLE_ASM )
372  #define KOKKOS_ENABLE_ASM 1
373  #endif
374 #endif
375 
376 //----------------------------------------------------------------------------
377 // CLANG compiler macros
378 
379 #if defined( KOKKOS_COMPILER_CLANG )
380  //#define KOKKOS_ENABLE_PRAGMA_UNROLL 1
381  //#define KOKKOS_ENABLE_PRAGMA_IVDEP 1
382  //#define KOKKOS_ENABLE_PRAGMA_LOOPCOUNT 1
383  //#define KOKKOS_ENABLE_PRAGMA_VECTOR 1
384  //#define KOKKOS_ENABLE_PRAGMA_SIMD 1
385 
386  #if !defined( KOKKOS_FORCEINLINE_FUNCTION )
387  #define KOKKOS_FORCEINLINE_FUNCTION inline __attribute__((always_inline))
388  #endif
389 
390  #if !defined( KOKKOS_IMPL_ALIGN_PTR )
391  #define KOKKOS_IMPL_ALIGN_PTR(size) __attribute__((aligned(size)))
392  #endif
393 
394 #endif
395 
396 //----------------------------------------------------------------------------
397 // GNU Compiler macros
398 
399 #if defined( KOKKOS_COMPILER_GNU )
400  //#define KOKKOS_ENABLE_PRAGMA_UNROLL 1
401  //#define KOKKOS_ENABLE_PRAGMA_IVDEP 1
402  //#define KOKKOS_ENABLE_PRAGMA_LOOPCOUNT 1
403  //#define KOKKOS_ENABLE_PRAGMA_VECTOR 1
404  //#define KOKKOS_ENABLE_PRAGMA_SIMD 1
405 
406  #if defined( KOKKOS_ARCH_AVX512MIC )
407  #define KOKKOS_ENABLE_RFO_PREFETCH 1
408  #endif
409 
410  #if !defined( KOKKOS_FORCEINLINE_FUNCTION )
411  #define KOKKOS_FORCEINLINE_FUNCTION inline __attribute__((always_inline))
412  #endif
413 
414  #define KOKKOS_RESTRICT __restrict__
415 
416  #if !defined( KOKKOS_ENABLE_ASM ) && !defined( __PGIC__ ) && \
417  ( defined( __amd64 ) || defined( __amd64__ ) || \
418  defined( __x86_64 ) || defined( __x86_64__ ) || \
419  defined(__PPC64__) )
420  #define KOKKOS_ENABLE_ASM 1
421  #endif
422 #endif
423 
424 //----------------------------------------------------------------------------
425 
426 #if defined( KOKKOS_COMPILER_PGI )
427  #define KOKKOS_ENABLE_PRAGMA_UNROLL 1
428  #define KOKKOS_ENABLE_PRAGMA_IVDEP 1
429  //#define KOKKOS_ENABLE_PRAGMA_LOOPCOUNT 1
430  #define KOKKOS_ENABLE_PRAGMA_VECTOR 1
431  //#define KOKKOS_ENABLE_PRAGMA_SIMD 1
432 #endif
433 
434 //----------------------------------------------------------------------------
435 
436 #if defined( KOKKOS_COMPILER_NVCC )
437  #if defined( __CUDA_ARCH__ )
438  #define KOKKOS_ENABLE_PRAGMA_UNROLL 1
439  #endif
440 #endif
441 
442 //----------------------------------------------------------------------------
443 // Define function marking macros if compiler specific macros are undefined:
444 
445 #if !defined( KOKKOS_FORCEINLINE_FUNCTION )
446  define KOKKOS_FORCEINLINE_FUNCTION inline
447 #endif
448 
449 #if !defined( KOKKOS_INLINE_FUNCTION )
450  #define KOKKOS_INLINE_FUNCTION inline
451 #endif
452 
453 #if !defined( KOKKOS_FUNCTION )
454  #define KOKKOS_FUNCTION
455 #endif
456 
457 #if !defined( KOKKOS_INLINE_FUNCTION_DELETED )
458  #define KOKKOS_INLINE_FUNCTION_DELETED inline
459 #endif
460 //----------------------------------------------------------------------------
461 // Define empty macro for restrict if necessary:
462 
463 #if !defined( KOKKOS_RESTRICT )
464  #define KOKKOS_RESTRICT
465 #endif
466 
467 //----------------------------------------------------------------------------
468 // Define Macro for alignment:
469 
470 #if ! defined( KOKKOS_MEMORY_ALIGNMENT )
471  #define KOKKOS_MEMORY_ALIGNMENT 64
472 #endif
473 
474 #if ! defined( KOKKOS_MEMORY_ALIGNMENT_THRESHOLD )
475  #define KOKKOS_MEMORY_ALIGNMENT_THRESHOLD 1
476 #endif
477 
478 #if !defined( KOKKOS_IMPL_ALIGN_PTR )
479  #define KOKKOS_IMPL_ALIGN_PTR(size) /* */
480 #endif
481 
482 //----------------------------------------------------------------------------
483 // Determine the default execution space for parallel dispatch.
484 // There is zero or one default execution space specified.
485 
486 #if 1 < ( ( defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_CUDA ) ? 1 : 0 ) + \
487  ( defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_ROCM ) ? 1 : 0 ) + \
488  ( defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMPTARGET ) ? 1 : 0 ) + \
489  ( defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMP ) ? 1 : 0 ) + \
490  ( defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_THREADS ) ? 1 : 0 ) + \
491  ( defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_QTHREADS ) ? 1 : 0 ) + \
492  ( defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_HPX ) ? 1 : 0 ) + \
493  ( defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SERIAL ) ? 1 : 0 ) )
494  #error "More than one KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_* specified."
495 #endif
496 
497 // If default is not specified then chose from enabled execution spaces.
498 // Priority: CUDA, OPENMP, THREADS, QTHREADS, HPX, SERIAL
499 #if defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_CUDA )
500 #elif defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_ROCM )
501 #elif defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMPTARGET )
502 #elif defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMP )
503 #elif defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_THREADS )
504 //#elif defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_QTHREADS )
505 #elif defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_HPX )
506 #elif defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SERIAL )
507 #elif defined( KOKKOS_ENABLE_CUDA )
508  #define KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_CUDA
509 #elif defined( KOKKOS_ENABLE_ROCM )
510  #define KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_ROCM
511 #elif defined( KOKKOS_ENABLE_OPENMPTARGET )
512  #define KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMPTARGET
513 #elif defined( KOKKOS_ENABLE_OPENMP )
514  #define KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMP
515 #elif defined( KOKKOS_ENABLE_THREADS )
516  #define KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_THREADS
517 //#elif defined( KOKKOS_ENABLE_QTHREADS )
518 // #define KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_QTHREADS
519 #elif defined( KOKKOS_ENABLE_HPX )
520  #define KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_HPX
521 #else
522  #define KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SERIAL
523 #endif
524 
525 //----------------------------------------------------------------------------
526 // Determine for what space the code is being compiled:
527 
528 #if defined( __CUDACC__ ) && defined( __CUDA_ARCH__ ) && defined( KOKKOS_ENABLE_CUDA )
529  #define KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_CUDA
530 #elif defined( __HCC__ ) && defined( __HCC_ACCELERATOR__ ) && defined( KOKKOS_ENABLE_ROCM )
531  #define KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_ROCM_GPU
532 #else
533  #define KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST
534 #endif
535 
536 //----------------------------------------------------------------------------
537 
538 #if ( defined( _POSIX_C_SOURCE ) && _POSIX_C_SOURCE >= 200112L ) || \
539  ( defined( _XOPEN_SOURCE ) && _XOPEN_SOURCE >= 600 )
540  #if defined( KOKKOS_ENABLE_PERFORMANCE_POSIX_MEMALIGN )
541  #define KOKKOS_ENABLE_POSIX_MEMALIGN 1
542  #endif
543 #endif
544 
545 //----------------------------------------------------------------------------
546 // If compiling with CUDA then must be using CUDA 8 or better
547 // and use relocateable device code to enable the task policy.
548 // nvcc relocatable device code option: --relocatable-device-code=true
549 
550 #if ( defined( KOKKOS_ENABLE_CUDA ) )
551  #if ( 8000 <= CUDA_VERSION ) && defined( KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE )
552  #define KOKKOS_ENABLE_TASKDAG
553  #endif
554 #else
555  #define KOKKOS_ENABLE_TASKDAG
556 #endif
557 
558 
559 #if defined ( KOKKOS_ENABLE_CUDA )
560  #if ( 9000 <= CUDA_VERSION )
561  #define KOKKOS_IMPL_CUDA_VERSION_9_WORKAROUND
562  #if ( __CUDA_ARCH__ )
563  #define KOKKOS_IMPL_CUDA_SYNCWARP_NEEDS_MASK
564  #endif
565  #endif
566 #endif
567 
568 #define KOKKOS_INVALID_INDEX (~std::size_t(0))
569 
570 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE
571  #define KOKKOS_IMPL_CTOR_DEFAULT_ARG 0
572 #else
573  #define KOKKOS_IMPL_CTOR_DEFAULT_ARG KOKKOS_INVALID_INDEX
574 #endif
575 
576 #if (defined(KOKKOS_ENABLE_CXX14) || defined(KOKKOS_ENABLE_CXX17) || defined(KOKKOS_ENABLE_CXX20))
577  #define KOKKOS_CONSTEXPR_14 constexpr
578  #define KOKKOS_DEPRECATED [[deprecated]]
579  #define KOKKOS_DEPRECATED_TRAILING_ATTRIBUTE
580 #else
581  #define KOKKOS_CONSTEXPR_14
582  #if defined(KOKKOS_COMPILER_GNU) || defined(KOKKOS_COMPILER_CLANG)
583  #define KOKKOS_DEPRECATED
584  #define KOKKOS_DEPRECATED_TRAILING_ATTRIBUTE __attribute__ ((deprecated))
585  #else
586  #define KOKKOS_DEPRECATED
587  #define KOKKOS_DEPRECATED_TRAILING_ATTRIBUTE
588  #endif
589 #endif
590 
591 
592 // DJS 05/28/2019: Bugfix: Issue 2155
593 // Use KOKKOS_ENABLE_CUDA_LDG_INTRINSIC to avoid memory leak in RandomAccess View
594 #if defined(KOKKOS_ENABLE_CUDA) && !defined(KOKKOS_ENABLE_CUDA_LDG_INTRINSIC)
595  #define KOKKOS_ENABLE_CUDA_LDG_INTRINSIC
596 #endif
597 
598 #endif // #ifndef KOKKOS_MACROS_HPP
599