MCPcopy Create free account
hub / github.com/boostorg/compute / main

Function main

perf/perf_bolt_partial_sum.cpp:21–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19#include "perf.hpp"
20
21int main(int argc, char *argv[])
22{
23 perf_parse_args(argc, argv);
24
25 std::cout << "size: " << PERF_N << std::endl;
26
27 bolt::cl::control ctrl = bolt::cl::control::getDefault();
28 ::cl::Device device = ctrl.getDevice();
29 std::cout << "device: " << device.getInfo<CL_DEVICE_NAME>() << std::endl;
30
31 // create vector of random numbers on the host
32 std::vector<int> h_vec = generate_random_vector<int>(PERF_N);
33
34 // create device vector
35 bolt::cl::device_vector<int> d_vec(PERF_N);
36
37 perf_timer t;
38 for(size_t trial = 0; trial < PERF_TRIALS; trial++){
39 // transfer data to the device
40 bolt::cl::copy(h_vec.begin(), h_vec.end(), d_vec.begin());
41
42 t.start();
43 bolt::cl::inclusive_scan(d_vec.begin(), d_vec.end(), d_vec.begin());
44 t.stop();
45 }
46 std::cout << "time: " << t.min_time() / 1e6 << " ms" << std::endl;
47
48 // transfer data back to host
49 bolt::cl::copy(d_vec.begin(), d_vec.end(), h_vec.begin());
50
51 return 0;
52}
53

Callers

nothing calls this directly

Calls 8

perf_parse_argsFunction · 0.85
copyFunction · 0.85
inclusive_scanFunction · 0.85
startMethod · 0.80
stopMethod · 0.80
min_timeMethod · 0.80
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected