Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-13 11:00:02

0001 //------------------------------- -*- C++ -*- -------------------------------//
0002 // Copyright VecGeom contributors: see top-level LICENSE file for details
0003 // SPDX-License-Identifier: Apache-2.0
0004 //---------------------------------------------------------------------------//
0005 //! \file VecGeom/base/Macros.h
0006 //! \brief Macro function definitions used throughout VecGeom
0007 /*!
0008  * \note The  \c __CLANGD__ and \c __DOXYGEN__ macros are not defined by the
0009  *tools but must be set by the build system. For clang, add to your \c .clangd file:
0010   <code>
0011   CompileFlags:
0012    Add: [-D__CLANGD__]
0013   </code>
0014  * and for Doxygen,
0015   <code>
0016   PREDEFINED = __DOXYGEN__=0x011100
0017   </code>
0018  * (where the version number is encoded as a hexadecimal).
0019  */
0020 //---------------------------------------------------------------------------//
0021 #pragma once
0022 
0023 #include <VecCore/CUDA.h>
0024 
0025 //! Enable a function's use in device code as well as host
0026 #define VECGEOM_FUNCTION VECCORE_ATT_HOST_DEVICE
0027 
0028 /*!
0029  * \def VECGEOM_DEVICE_SOURCE
0030  *
0031  * Defined and true if building a HIP or CUDA source file. This is a generic
0032  * replacement for \c __CUDACC__ .
0033  */
0034 /*!
0035  * \def VECGEOM_DEVICE_COMPILE
0036  *
0037  * Defined and true if building device code in HIP or CUDA. This is a generic
0038  * replacement for \c __CUDA_ARCH__ .
0039  */
0040 #if defined(__CUDACC__) || defined(__HIP__)
0041 #define VECGEOM_DEVICE_SOURCE 1
0042 #elif defined(__DOXYGEN__) || defined(__CLANGD__)
0043 #define VECGEOM_DEVICE_SOURCE 0
0044 #endif
0045 
0046 #if defined(__CUDA_ARCH__) || defined(__HIP_DEVICE_COMPILE__)
0047 #define VECGEOM_DEVICE_COMPILE 1
0048 #elif defined(__DOXYGEN__) || defined(__CLANGD__)
0049 #define VECGEOM_DEVICE_COMPILE 0
0050 #endif
0051 
0052 /*!
0053  * \def VECGEOM_DISCARD
0054  *
0055  * The argument is an unevaluated operand which will generate no code but force
0056  * the expression to be used. This can be used in place of the \code
0057  * [[maybe_unused]] \endcode attribute, which actually generates warnings in
0058  * older versions of GCC.
0059  */
0060 #define VECGEOM_DISCARD(CODE) static_cast<void>(sizeof(CODE));