1 #ifndef TEST_INNER_PROD_HH
2 #define TEST_INNER_PROD_HH
3 #include "test_opencl.hpp"
6 template <class T, int number_of_tests, int max_dimension>
11 typedef test_opencl<T> test;
16 int passedOperations = 0;
17 // get default device and setup context
18 compute::device device = compute::system::default_device();
19 compute::context context(device);
20 compute::command_queue queue(context, device);
26 T result_inner_prod_ublas;
27 T result_inner_prod_opencl;
30 for (int i = 0; i<number_of_tests; i++)
32 int size = std::rand() % max_dimension + 1;
37 test::init_vector(va, 200);
38 test::init_vector(vb, 200);
40 result_inner_prod_ublas = ublas::inner_prod(va, vb);
42 result_inner_prod_opencl = opencl::inner_prod(va, vb, queue);
45 if (( result_inner_prod_ublas != result_inner_prod_opencl ))
47 std::cout << "Error in calculations" << std::endl;
49 std::cout << "passed: " << passedOperations << std::endl;
56 std::cout << "All is well (matrix opencl inner prod) of " << typeid(T).name() << std::endl;