Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-27 07:23:57

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #if defined(__CUDACC__) || defined(__HIP__)
0012 #define DETRAY_DEVICE __device__
0013 #else
0014 #define DETRAY_DEVICE
0015 #endif
0016 
0017 #if defined(__CUDACC__) || defined(__HIP__)
0018 #define DETRAY_HOST __host__
0019 #else
0020 #define DETRAY_HOST
0021 #endif
0022 
0023 #if defined(__CUDACC__) || defined(__HIP__)
0024 #define DETRAY_HOST_DEVICE __host__ __device__
0025 #else
0026 #define DETRAY_HOST_DEVICE
0027 #endif
0028 
0029 #if defined(__CUDACC__) || defined(__HIP__)
0030 #define DETRAY_ALIGN(x) __align__(x)
0031 #else
0032 #define DETRAY_ALIGN(x) alignas(x)
0033 #endif
0034 
0035 #if defined(__CUDACC__) || defined(__HIP__) || defined(__GNUC__)
0036 #define DETRAY_INLINE __attribute__((always_inline))
0037 #else
0038 #define DETRAY_INLINE
0039 #endif
0040 
0041 // @see
0042 // https://stackoverflow.com/questions/78071873/gcc-preprocessor-macro-and-pragma-gcc-unroll
0043 #if defined(__clang__)
0044 #define ARG_TO_STRING(A) #A
0045 #define DETRAY_UNROLL_N(n) _Pragma(ARG_TO_STRING(clang loop unroll_count(n)))
0046 #elif defined(__GNUC__) || defined(__GNUG__)
0047 #define ARG_TO_STRING(A) #A
0048 #if __GNUC__ >= 14
0049 #define DETRAY_UNROLL_N(n) _Pragma(ARG_TO_STRING(GCC unroll n))
0050 #else
0051 // For versions below 14, template parameters apparently cannot be used
0052 #define DETRAY_UNROLL_N(n) _Pragma(ARG_TO_STRING(GCC unroll 8))
0053 #endif
0054 #else
0055 // Unknown compiler or does not support unrolling directives
0056 #define DETRAY_UNROLL_N(n)
0057 #endif
0058 
0059 #if defined(DETRAY_INTERNAL_USE_NO_UNIQUE_ADDRESS_ANNOTATION)
0060 #define DETRAY_NO_UNIQUE_ADDRESS [[no_unique_address]]
0061 #else
0062 #define DETRAY_NO_UNIQUE_ADDRESS
0063 #endif
0064 
0065 #if defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 700
0066 #define DETRAY_GRID_CONSTANT __grid_constant__
0067 #else
0068 #define DETRAY_GRID_CONSTANT
0069 #endif