| 58 | |
| 59 | |
| 60 | void run_binary_transform_test(std::size_t problem_size) { |
| 61 | std::vector<int> data1(problem_size); |
| 62 | for(int i = 0; i < data1.size(); ++i) { |
| 63 | data1[i] = i; |
| 64 | } |
| 65 | |
| 66 | std::vector<int> data2(problem_size); |
| 67 | for(int i = 0; i < data2.size(); ++i) { |
| 68 | data2[i] = -i+10; |
| 69 | } |
| 70 | |
| 71 | |
| 72 | std::vector<int> device_out(problem_size); |
| 73 | std::vector<int> host_out(problem_size); |
| 74 | |
| 75 | auto transformation = [](auto x, auto y) { |
| 76 | return x * y + y; |
| 77 | }; |
| 78 | |
| 79 | auto ret = |
| 80 | std::transform(std::execution::par_unseq, data1.begin(), data1.end(), |
| 81 | data2.begin(), device_out.begin(), transformation); |
| 82 | auto host_ret = std::transform(data1.begin(), data1.end(), data2.begin(), |
| 83 | host_out.begin(), transformation); |
| 84 | |
| 85 | BOOST_CHECK(device_out == host_out); |
| 86 | BOOST_CHECK(ret == device_out.begin() + problem_size); |
| 87 | } |
| 88 | |
| 89 | BOOST_AUTO_TEST_CASE(par_unseq_binary_zero_size) { |
| 90 | run_binary_transform_test(0); |
no test coverage detected