| 23 | #include "context_setup.hpp" |
| 24 | |
| 25 | BOOST_AUTO_TEST_CASE(sum_int) |
| 26 | { |
| 27 | if(is_apple_cpu_device(device)) { |
| 28 | std::cerr |
| 29 | << "skipping all inplace_reduce tests due to Apple platform" |
| 30 | << " behavior when local memory is used on a CPU device" |
| 31 | << std::endl; |
| 32 | return; |
| 33 | } |
| 34 | |
| 35 | int data[] = { 1, 5, 3, 4, 9, 3, 5, 3 }; |
| 36 | boost::compute::vector<int> vector(data, data + 8, queue); |
| 37 | |
| 38 | boost::compute::detail::inplace_reduce(vector.begin(), |
| 39 | vector.end(), |
| 40 | boost::compute::plus<int>(), |
| 41 | queue); |
| 42 | queue.finish(); |
| 43 | BOOST_CHECK_EQUAL(int(vector[0]), int(33)); |
| 44 | |
| 45 | vector.assign(data, data + 8); |
| 46 | vector.push_back(3); |
| 47 | boost::compute::detail::inplace_reduce(vector.begin(), |
| 48 | vector.end(), |
| 49 | boost::compute::plus<int>(), |
| 50 | queue); |
| 51 | queue.finish(); |
| 52 | BOOST_CHECK_EQUAL(int(vector[0]), int(36)); |
| 53 | } |
| 54 | |
| 55 | BOOST_AUTO_TEST_CASE(multiply_int) |
| 56 | { |
nothing calls this directly
no test coverage detected