nvcc.hpp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. // A bug in version 7.0 of CUDA prevents use of variadic templates in some occasions
  20. // https://svn.boost.org/trac/boost/ticket/11897
  21. // This is fixed in 7.5. As the following version macro was introduced in 7.5 an existance
  22. // check is enough to detect versions < 7.5
  23. #if BOOST_CUDA_VERSION < 7050000
  24. # define BOOST_NO_CXX11_VARIADIC_TEMPLATES
  25. #endif
  26. // The same bug is back again in 8.0:
  27. #if (BOOST_CUDA_VERSION > 8000000) && (BOOST_CUDA_VERSION < 8010000)
  28. # define BOOST_NO_CXX11_VARIADIC_TEMPLATES
  29. #endif
  30. // CUDA (8.0) has no constexpr support in msvc mode:
  31. #if defined(_MSC_VER) && (BOOST_CUDA_VERSION < 9000000)
  32. # define BOOST_NO_CXX11_CONSTEXPR
  33. #endif
  34. #ifdef __CUDACC__
  35. //
  36. // When compiing .cu files, there's a bunch of stuff that doesn't work with msvc:
  37. //
  38. #if defined(_MSC_VER)
  39. # define BOOST_NO_CXX14_DIGIT_SEPARATORS
  40. # define BOOST_NO_CXX11_UNICODE_LITERALS
  41. #endif
  42. //
  43. // And this one effects the NVCC front end,
  44. // See https://svn.boost.org/trac/boost/ticket/13049
  45. //
  46. #if (BOOST_CUDA_VERSION >= 8000000) && (BOOST_CUDA_VERSION < 8010000)
  47. # define BOOST_NO_CXX11_NOEXCEPT
  48. #endif
  49. #endif