3 boost/numeric/odeint/external/thrust/thrust_algebra_dispatcher.hpp
6 algebra_dispatcher specialization for thrust
9 Copyright 2013 Karsten Ahnert
10 Copyright 2013 Mario Mulansky
12 Distributed under the Boost Software License, Version 1.0.
13 (See accompanying file LICENSE_1_0.txt or
14 copy at http://www.boost.org/LICENSE_1_0.txt)
18 #ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_THRUST_THRUST_ALGEBRA_DISPATCHER_HPP_DEFINED
19 #define BOOST_NUMERIC_ODEINT_EXTERNAL_THRUST_THRUST_ALGEBRA_DISPATCHER_HPP_DEFINED
21 #include <thrust/host_vector.h>
22 #include <thrust/device_vector.h>
24 #include <boost/numeric/odeint/external/thrust/thrust_algebra.hpp>
25 #include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp>
27 // specializations for the standard thrust containers
33 // specialization for thrust host_vector
34 template< class T , class A >
35 struct algebra_dispatcher< thrust::host_vector< T , A > >
37 typedef thrust_algebra algebra_type;
40 // specialization for thrust device_vector
41 template< class T , class A >
42 struct algebra_dispatcher< thrust::device_vector< T , A > >
44 typedef thrust_algebra algebra_type;
48 } // namespace numeric
52 // add support for thrust backend vectors, if available
54 #include <thrust/version.h>
56 #if THRUST_VERSION >= 100600
58 // specialization for thrust cpp vector
59 #include <thrust/system/cpp/vector.h>
60 namespace boost { namespace numeric { namespace odeint {
61 template< class T , class A >
62 struct algebra_dispatcher< thrust::cpp::vector< T , A > >
64 typedef thrust_algebra algebra_type;
68 // specialization for thrust omp vector
70 #include <thrust/system/omp/vector.h>
71 namespace boost { namespace numeric { namespace odeint {
72 template< class T , class A >
73 struct algebra_dispatcher< thrust::omp::vector< T , A > >
75 typedef thrust_algebra algebra_type;
80 // specialization for thrust tbb vector
81 #ifdef TBB_VERSION_MAJOR
82 #include <thrust/system/tbb/vector.h>
83 namespace boost { namespace numeric { namespace odeint {
84 template< class T , class A >
85 struct algebra_dispatcher< thrust::tbb::vector< T , A > >
87 typedef thrust_algebra algebra_type;
90 #endif // TBB_VERSION_MAJOR
92 // specialization for thrust cuda vector
94 #include <thrust/system/cuda/vector.h>
95 namespace boost { namespace numeric { namespace odeint {
96 template< class T , class A >
97 struct algebra_dispatcher< thrust::cuda::vector< T , A > >
99 typedef thrust_algebra algebra_type;
104 #endif // THRUST_VERSION >= 100600
106 #endif // BOOST_NUMERIC_ODEINT_EXTERNAL_THRUST_THRUST_ALGEBRA_DISPATCHER_HPP_DEFINED