cuda.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. Copyright Benjamin Worpitz 2018
  3. Distributed under the Boost Software License, Version 1.0.
  4. (See accompanying file LICENSE_1_0.txt or copy at
  5. http://www.boost.org/LICENSE_1_0.txt)
  6. */
  7. #ifndef BOOST_PREDEF_LANGUAGE_CUDA_H
  8. #define BOOST_PREDEF_LANGUAGE_CUDA_H
  9. #include <boost/predef/version_number.h>
  10. #include <boost/predef/make.h>
  11. /* tag::reference[]
  12. = `BOOST_LANG_CUDA`
  13. https://en.wikipedia.org/wiki/CUDA[CUDA C/{CPP}] language.
  14. If available, the version is detected as VV.RR.P.
  15. [options="header"]
  16. |===
  17. | {predef_symbol} | {predef_version}
  18. | `+__CUDACC__+` | {predef_detection}
  19. | `+__CUDA__+` | {predef_detection}
  20. | `CUDA_VERSION` | VV.RR.P
  21. |===
  22. */ // end::reference[]
  23. #define BOOST_LANG_CUDA BOOST_VERSION_NUMBER_NOT_AVAILABLE
  24. #if defined(__CUDACC__) || defined(__CUDA__)
  25. # undef BOOST_LANG_CUDA
  26. # include <cuda.h>
  27. # if defined(CUDA_VERSION)
  28. # define BOOST_LANG_CUDA BOOST_PREDEF_MAKE_10_VVRRP(CUDA_VERSION)
  29. # else
  30. # define BOOST_LANG_CUDA BOOST_VERSION_NUMBER_AVAILABLE
  31. # endif
  32. #endif
  33. #if BOOST_LANG_CUDA
  34. # define BOOST_LANG_CUDA_AVAILABLE
  35. #endif
  36. #define BOOST_LANG_CUDA_NAME "CUDA C/C++"
  37. #endif
  38. #include <boost/predef/detail/test.h>
  39. BOOST_PREDEF_DECLARE_TEST(BOOST_LANG_CUDA,BOOST_LANG_CUDA_NAME)