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