1 #ifdef STAN_OPENCL
2
3 #include <stan/math/opencl/prim.hpp>
4 #include <stan/math/opencl/kernel_cl.hpp>
5 #include <gtest/gtest.h>
6
7 using stan::math::matrix_cl;
8 using stan::math::opencl_kernels::in_buffer;
9 using stan::math::opencl_kernels::in_out_buffer;
10 using stan::math::opencl_kernels::out_buffer;
11 using stan::math::opencl_kernels::internal::assign_events;
12
TEST(assign_event,correct_vectors)13 TEST(assign_event, correct_vectors) {
14 matrix_cl<double> m;
15 // pointers not set up to work yet; TBD if needed
16 // matrix_cl *mp = &m;
17 cl::Event e;
18 assign_events<in_buffer>(e, m);
19 EXPECT_EQ(m.read_events().size(), 1);
20 EXPECT_EQ(m.write_events().size(), 0);
21
22 assign_events<out_buffer>(e, m);
23 EXPECT_EQ(m.read_events().size(), 1);
24 EXPECT_EQ(m.write_events().size(), 1);
25
26 assign_events<in_out_buffer>(e, m);
27 EXPECT_EQ(m.read_events().size(), 2);
28 EXPECT_EQ(m.write_events().size(), 2);
29
30 m.clear_read_write_events();
31 }
32 #endif
33