thrust_operations_dispatcher.hpp 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*
  2. [auto_generated]
  3. boost/numeric/odeint/external/thrust/thrust_operations_dispatcher.hpp
  4. [begin_description]
  5. operations_dispatcher specialization for thrust
  6. [end_description]
  7. Copyright 2013-2014 Karsten Ahnert
  8. Copyright 2013-2014 Mario Mulansky
  9. Distributed under the Boost Software License, Version 1.0.
  10. (See accompanying file LICENSE_1_0.txt or
  11. copy at http://www.boost.org/LICENSE_1_0.txt)
  12. */
  13. #ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_THRUST_THRUST_OPERATIONS_DISPATCHER_HPP_DEFINED
  14. #define BOOST_NUMERIC_ODEINT_EXTERNAL_THRUST_THRUST_OPERATIONS_DISPATCHER_HPP_DEFINED
  15. #include <thrust/host_vector.h>
  16. #include <thrust/device_vector.h>
  17. #include <boost/numeric/odeint/external/thrust/thrust_operations.hpp>
  18. #include <boost/numeric/odeint/algebra/operations_dispatcher.hpp>
  19. // support for the standard thrust containers
  20. namespace boost {
  21. namespace numeric {
  22. namespace odeint {
  23. // specialization for thrust host_vector
  24. template< class T , class A >
  25. struct operations_dispatcher< thrust::host_vector< T , A > >
  26. {
  27. typedef thrust_operations operations_type;
  28. };
  29. // specialization for thrust device_vector
  30. template< class T , class A >
  31. struct operations_dispatcher< thrust::device_vector< T , A > >
  32. {
  33. typedef thrust_operations operations_type;
  34. };
  35. } // namespace odeint
  36. } // namespace numeric
  37. } // namespace boost
  38. // add support for thrust backend vectors, if available
  39. #include <thrust/version.h>
  40. #if THRUST_VERSION >= 101000
  41. #include <thrust/detail/vector_base.h>
  42. namespace boost { namespace numeric { namespace odeint {
  43. template< class T , class A >
  44. struct operations_dispatcher< thrust::detail::vector_base< T , A > >
  45. {
  46. typedef thrust_operations operations_type;
  47. };
  48. } } }
  49. #elif THRUST_VERSION >= 100600
  50. // specialization for thrust cpp vector
  51. #include <thrust/system/cpp/vector.h>
  52. namespace boost { namespace numeric { namespace odeint {
  53. template< class T , class A >
  54. struct operations_dispatcher< thrust::cpp::vector< T , A > >
  55. {
  56. typedef thrust_operations operations_type;
  57. };
  58. } } }
  59. // specialization for thrust omp vector
  60. #ifdef _OPENMP
  61. #include <thrust/system/omp/vector.h>
  62. namespace boost { namespace numeric { namespace odeint {
  63. template< class T , class A >
  64. struct operations_dispatcher< thrust::omp::vector< T , A > >
  65. {
  66. typedef thrust_operations operations_type;
  67. };
  68. } } }
  69. #endif // _OPENMP
  70. // specialization for thrust tbb vector
  71. #ifdef TBB_VERSION_MAJOR
  72. #include <thrust/system/tbb/vector.h>
  73. namespace boost { namespace numeric { namespace odeint {
  74. template< class T , class A >
  75. struct operations_dispatcher< thrust::tbb::vector< T , A > >
  76. {
  77. typedef thrust_operations operations_type;
  78. };
  79. } } }
  80. #endif // TBB_VERSION_MAJOR
  81. // specialization for thrust cuda vector
  82. #ifdef __CUDACC__
  83. #include <thrust/system/cuda/vector.h>
  84. namespace boost { namespace numeric { namespace odeint {
  85. template< class T , class A >
  86. struct operations_dispatcher< thrust::cuda::vector< T , A > >
  87. {
  88. typedef thrust_operations operations_type;
  89. };
  90. } } }
  91. #endif // __CUDACC__
  92. #endif // THRUST_VERSION >= 100600
  93. #endif // BOOST_NUMERIC_ODEINT_EXTERNAL_THRUST_THRUST_OPERATIONS_DISPATCHER_HPP_DEFINED