Automatic Differentiation
 
Loading...
Searching...
No Matches
helpers.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_OPENCL_KERNELS_HELPERS_HPP
2#define STAN_MATH_OPENCL_KERNELS_HELPERS_HPP
3#ifdef STAN_OPENCL
4
5#include <string>
6
7namespace stan {
8namespace math {
9namespace opencl_kernels {
10
14static const std::string indexing_helpers =
15 R"(
16 // Matrix access helpers
17 #ifndef A_batch
18 #define A_batch(i,j,k) A[(k) * cols * rows + (j) * rows + (i)]
19 #endif
20 #ifndef A
21 #define A(i,j) A[(j) * rows + (i)]
22 #endif
23 #ifndef B
24 #define B(i,j) B[(j) * rows + (i)]
25 #endif
26 #ifndef C
27 #define C(i,j) C[(j) * rows + (i)]
28 #endif
29 // Transpose
30 #ifndef BT
31 #define BT(i,j) B[(j) * cols + (i)]
32 #endif
33 #ifndef AT
34 #define AT(i,j) A[(j) * cols + (i)]
35 #endif
36 // Moving between two buffers
37 #ifndef src
38 #define src(i,j) src[(j) * src_rows + (i)]
39 #endif
40 #ifndef dst
41 #define dst(i,j) dst[(j) * dst_rows + (i)]
42 #endif
43 )";
44
48static const std::string thread_block_helpers =
49 R"(
50 // The local memory column for each thread block
51 #define THREAD_BLOCK_SIZE_COL (THREAD_BLOCK_SIZE/WORK_PER_THREAD)
52 )";
53} // namespace opencl_kernels
54} // namespace math
55} // namespace stan
56#endif
57#endif
static const std::string indexing_helpers
Defines helper macros for common matrix indexing operations.
Definition helpers.hpp:14
static const std::string thread_block_helpers
Defines a helper macro for kernels with 2D local size.
Definition helpers.hpp:24
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...