| 15 | #include "perf.hpp" |
| 16 | |
| 17 | int main(int argc, char *argv[]) |
| 18 | { |
| 19 | perf_parse_args(argc, argv); |
| 20 | std::cout << "size: " << PERF_N << std::endl; |
| 21 | |
| 22 | // setup context and queue for the default device |
| 23 | boost::compute::device device = boost::compute::system::default_device(); |
| 24 | boost::compute::context context(device); |
| 25 | boost::compute::command_queue queue(context, device); |
| 26 | std::cout << "device: " << device.name() << std::endl; |
| 27 | |
| 28 | // create vector on the device (filled with zeros) |
| 29 | boost::compute::vector<int> vec(PERF_N, 0, queue); |
| 30 | |
| 31 | perf_timer t; |
| 32 | for(size_t trial = 0; trial < PERF_TRIALS; trial++){ |
| 33 | t.start(); |
| 34 | boost::compute::fill(vec.begin(), vec.end(), int(trial), queue); |
| 35 | queue.finish(); |
| 36 | t.stop(); |
| 37 | } |
| 38 | std::cout << "time: " << t.min_time() / 1e6 << " ms" << std::endl; |
| 39 | |
| 40 | return 0; |
| 41 | } |