Stan Math Library  2.20.0
reverse mode automatic differentiation
copy.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_OPENCL_KERNELS_COPY_HPP
2 #define STAN_MATH_OPENCL_KERNELS_COPY_HPP
3 #ifdef STAN_OPENCL
4 
7 #include <algorithm>
8 
9 namespace stan {
10 namespace math {
11 namespace opencl_kernels {
12 // \cond
13 static const char *copy_kernel_code = STRINGIFY(
14  // \endcond
26  __kernel void copy(__global double *A, __global double *B,
27  unsigned int rows, unsigned int cols) {
28  int i = get_global_id(0);
29  int j = get_global_id(1);
30  if (i < rows && j < cols) {
31  B(i, j) = A(i, j);
32  }
33  }
34  // \cond
35 );
36 // \endcond
37 
43  copy_kernel_code});
44 
45 } // namespace opencl_kernels
46 } // namespace math
47 } // namespace stan
48 #endif
49 #endif
int rows(const Eigen::Matrix< T, R, C > &m)
Return the number of rows in the specified matrix, vector, or row vector.
Definition: rows.hpp:20
#define STRINGIFY(src)
Definition: kernel_cl.hpp:22
static const char * indexing_helpers
Definition: helpers.hpp:14
int cols(const Eigen::Matrix< T, R, C > &m)
Return the number of columns in the specified matrix, vector, or row vector.
Definition: cols.hpp:20
Creates functor for kernels.
Definition: kernel_cl.hpp:201
const kernel_cl< in_buffer, out_buffer, int, int > copy("copy", {indexing_helpers, copy_kernel_code})
See the docs for copy() .

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