Stan Math Library  2.20.0
reverse mode automatic differentiation
zeros.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_OPENCL_ZEROS_HPP
2 #define STAN_MATH_OPENCL_ZEROS_HPP
3 #ifdef STAN_OPENCL
4 
11 
12 #include <CL/cl.hpp>
13 
14 namespace stan {
15 namespace math {
16 
26 template <TriangularViewCL triangular_view>
27 inline void matrix_cl::zeros() try {
28  if (size() == 0)
29  return;
30  cl::CommandQueue cmdQueue = opencl_context.queue();
31  opencl_kernels::zeros(cl::NDRange(this->rows(), this->cols()), *this,
32  this->rows(), this->cols(), triangular_view);
33 } catch (const cl::Error& e) {
34  check_opencl_error("zeros", e);
35 }
36 
37 } // namespace math
38 } // namespace stan
39 
40 #endif
41 #endif
The API to access the methods and values in opencl_context_base.
The matrix_cl class - allocates memory space on the OpenCL device, functions for transfering matrices...
void zeros()
Stores zeros in the matrix on the OpenCL device.
Definition: zeros.hpp:27
checking OpenCL error numbers
Initialization for OpenCL:
double e()
Return the base of the natural logarithm.
Definition: constants.hpp:87
const kernel_cl< out_buffer, int, int, TriangularViewCL > zeros("zeros", {indexing_helpers, zeros_kernel_code})
See the docs for zeros() .
void check_opencl_error(const char *function, const cl::Error &e)
Throws the domain error with specifying the OpenCL error that occured.
cl::CommandQueue & queue()
Returns the reference to the active OpenCL command queue for the device.

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