MCPcopy Create free account
hub / github.com/antmachineintelligence/mtgbmcode / main

Function main

compute/perf/perf_bolt_count.cpp:26–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 9

perf_parse_argsFunction · 0.85
copyFunction · 0.85
countFunction · 0.85
startMethod · 0.80
stopMethod · 0.80
min_timeMethod · 0.80
generateFunction · 0.50
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected