nvcc.hpp 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // (C) Copyright Eric Jourdanneau, Joel Falcou 2010
  2. // Use, modification and distribution are subject to the
  3. // Boost Software License, Version 1.0. (See accompanying file
  4. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. // See http://www.boost.org for most recent version.
  6. // NVIDIA CUDA C++ compiler setup
  7. #ifndef BOOST_COMPILER
  8. # define BOOST_COMPILER "NVIDIA CUDA C++ Compiler"
  9. #endif
  10. #if defined(__CUDACC_VER_MAJOR__) && defined(__CUDACC_VER_MINOR__) && defined(__CUDACC_VER_BUILD__)
  11. # define BOOST_CUDA_VERSION (__CUDACC_VER_MAJOR__ * 1000000 + __CUDACC_VER_MINOR__ * 10000 + __CUDACC_VER_BUILD__)
  12. #else
  13. // We don't really know what the CUDA version is, but it's definitely before 7.5:
  14. # define BOOST_CUDA_VERSION 7000000
  15. #endif
  16. // NVIDIA Specific support
  17. // BOOST_GPU_ENABLED : Flag a function or a method as being enabled on the host and device
  18. #define BOOST_GPU_ENABLED __host__ __device__
  19. #if !defined(__clang__) || defined(__NVCC__)
  20. // A bug in version 7.0 of CUDA prevents use of variadic templates in some occasions
  21. // https://svn.boost.org/trac/boost/ticket/11897
  22. // This is fixed in 7.5. As the following version macro was introduced in 7.5 an existance
  23. // check is enough to detect versions < 7.5
  24. #if BOOST_CUDA_VERSION < 7050000
  25. # define BOOST_NO_CXX11_VARIADIC_TEMPLATES
  26. #endif
  27. // The same bug is back again in 8.0:
  28. #if (BOOST_CUDA_VERSION > 8000000) && (BOOST_CUDA_VERSION < 8010000)
  29. # define BOOST_NO_CXX11_VARIADIC_TEMPLATES
  30. #endif
  31. // CUDA (8.0) has no constexpr support in msvc mode:
  32. #if defined(_MSC_VER) && (BOOST_CUDA_VERSION < 9000000)
  33. # define BOOST_NO_CXX11_CONSTEXPR
  34. #endif
  35. #endif
  36. #ifdef __CUDACC__
  37. //
  38. // When compiing .cu files, there's a bunch of stuff that doesn't work with msvc:
  39. //
  40. #if defined(_MSC_VER)
  41. # define BOOST_NO_CXX14_DIGIT_SEPARATORS
  42. # define BOOST_NO_CXX11_UNICODE_LITERALS
  43. #endif
  44. //
  45. // And this one effects the NVCC front end,
  46. // See https://svn.boost.org/trac/boost/ticket/13049
  47. //
  48. #if (BOOST_CUDA_VERSION >= 8000000) && (BOOST_CUDA_VERSION < 8010000)
  49. # define BOOST_NO_CXX11_NOEXCEPT
  50. #endif
  51. #if !defined(__cpp_nontype_template_parameter_auto) || (__cpp_nontype_template_parameter_auto < 201606)
  52. # define BOOST_NO_CXX17_AUTO_NONTYPE_TEMPLATE_PARAMS
  53. #endif
  54. #endif