Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:48:05

0001 /*
0002 Copyright Benjamin Worpitz 2018
0003 Distributed under the Boost Software License, Version 1.0.
0004 (See accompanying file LICENSE_1_0.txt or copy at
0005 http://www.boost.org/LICENSE_1_0.txt)
0006 */
0007 
0008 #ifndef BOOST_PREDEF_COMPILER_NVCC_H
0009 #define BOOST_PREDEF_COMPILER_NVCC_H
0010 
0011 #include <boost/predef/version_number.h>
0012 #include <boost/predef/make.h>
0013 
0014 /* tag::reference[]
0015 = `BOOST_COMP_NVCC`
0016 
0017 https://en.wikipedia.org/wiki/NVIDIA_CUDA_Compiler[NVCC] compiler.
0018 Version number available as major, minor, and patch beginning with version 7.5.
0019 
0020 [options="header"]
0021 |===
0022 | {predef_symbol} | {predef_version}
0023 
0024 | `+__NVCC__+` | {predef_detection}
0025 
0026 | `+__CUDACC_VER_MAJOR__+`, `+__CUDACC_VER_MINOR__+`, `+__CUDACC_VER_BUILD__+` | V.R.P
0027 |===
0028 */ // end::reference[]
0029 
0030 #define BOOST_COMP_NVCC BOOST_VERSION_NUMBER_NOT_AVAILABLE
0031 
0032 #if defined(__NVCC__)
0033 #   if !defined(__CUDACC_VER_MAJOR__) || !defined(__CUDACC_VER_MINOR__) || !defined(__CUDACC_VER_BUILD__)
0034 #       define BOOST_COMP_NVCC_DETECTION BOOST_VERSION_NUMBER_AVAILABLE
0035 #   else
0036 #       define BOOST_COMP_NVCC_DETECTION BOOST_VERSION_NUMBER(__CUDACC_VER_MAJOR__, __CUDACC_VER_MINOR__, __CUDACC_VER_BUILD__)
0037 #   endif
0038 #endif
0039 
0040 #ifdef BOOST_COMP_NVCC_DETECTION
0041 /*
0042 Always define BOOST_COMP_NVCC instead of BOOST_COMP_NVCC_EMULATED
0043 The nvcc compilation process is somewhat special as can be read here:
0044 https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#cuda-compilation-trajectory
0045 The nvcc compiler precompiles the input two times. Once for the device code
0046 being compiled by the cicc device compiler and once for the host code
0047 compiled by the real host compiler. NVCC uses gcc/clang/msvc/...
0048 depending on the host compiler being set on the command line.
0049 
0050 Predef (as a preprocessor only lib) detects the one doing the preprocessing
0051 as compiler and expects it to be the one doing the real compilation.
0052 This is not true for NVCC which is only doing the preprocessing and which
0053 is using another compiler for parts of its work. So for NVCC it should be
0054 allowed to set BOOST_COMP_NVCC additionally to the already detected host
0055 compiler because both is true: It is gcc/clang/... compiling the code, but it
0056 is also NVCC doing the preprocessing and adding some other quirks you may
0057 want to detect.
0058 
0059 This behavior is similar to what boost config is doing in `select_compiler_config.hpp`.
0060 There the NVCC detection is not handled as a real compiler (part of the
0061 #if-#elif) but as additional option before the real compiler.
0062 */
0063 #   undef BOOST_COMP_NVCC
0064 #   define BOOST_COMP_NVCC BOOST_COMP_NVCC_DETECTION
0065 #   define BOOST_COMP_NVCC_AVAILABLE
0066 #   include <boost/predef/detail/comp_detected.h>
0067 #endif
0068 
0069 #define BOOST_COMP_NVCC_NAME "NVCC"
0070 
0071 #endif
0072 
0073 #include <boost/predef/detail/test.h>
0074 BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_NVCC,BOOST_COMP_NVCC_NAME)