Stan Math Library  2.20.0
reverse mode automatic differentiation
buffer_types.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_OPENCL_BUFFER_TYPES_HPP
2 #define STAN_MATH_OPENCL_BUFFER_TYPES_HPP
3 #ifdef STAN_OPENCL
4 
6 #include <CL/cl.hpp>
7 
8 namespace stan {
9 namespace math {
10 class matrix_cl;
11 namespace opencl_kernels {
12 
13 // An in_buffer signifies a cl::Buffer argument used as input.
14 struct in_buffer {};
15 
16 // An out_buffer signifies a cl::Buffer argument used as output.
17 struct out_buffer {};
18 
19 // An in_out_buffer signifies a cl::Buffer argument used as both input and
20 // output.
21 struct in_out_buffer {};
22 
23 namespace internal {
24 
32 template <typename T = cl::Buffer>
33 struct to_buffer {
34  using type = T;
35 };
36 
37 template <>
39  using type = cl::Buffer;
40 };
41 
42 template <>
44  using type = cl::Buffer;
45 };
46 
47 template <>
49  using type = cl::Buffer;
50 };
51 
58 template <typename T = cl::Buffer>
59 struct to_matrix_cl {
60  typedef T type;
61 };
62 
63 template <>
64 struct to_matrix_cl<cl::Buffer> {
65  typedef matrix_cl type;
66 };
67 
73 template <>
75  typedef matrix_cl type;
76 };
77 
78 template <>
80  typedef matrix_cl type;
81 };
82 
83 template <>
85  typedef matrix_cl type;
86 };
87 
88 // Alias for making const matrix_cl argument types
89 template <typename T>
91 
92 // Alias for making const cl::Buffer argument types
93 template <typename T>
95 
96 } // namespace internal
97 } // namespace opencl_kernels
98 } // namespace math
99 } // namespace stan
100 
101 #endif
102 #endif
const typename internal::to_buffer< T >::type to_const_buffer_t
meta template struct for changing read/write buffer argument types to cl::Buffer types.
const typename internal::to_matrix_cl< T >::type to_const_matrix_cl_t
Represents a matrix on the OpenCL device.
Definition: matrix_cl.hpp:29
meta template struct for changing cl::Buffer argument types to matrix_cl.

     [ Stan Home Page ] © 2011–2018, Stan Development Team.