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

Function main

perf/perf_includes.cpp:27–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25}
26
27int main(int argc, char *argv[])
28{
29 perf_parse_args(argc, argv);
30 std::cout << "size: " << PERF_N << std::endl;
31
32 // setup context and queue for the default device
33 boost::compute::device device = boost::compute::system::default_device();
34 boost::compute::context context(device);
35 boost::compute::command_queue queue(context, device);
36 std::cout << "device: " << device.name() << std::endl;
37
38 // create vectors of random numbers on the host
39 std::vector<int> host_vector(PERF_N);
40 std::generate(host_vector.begin(), host_vector.end(), rand_int);
41 std::sort(host_vector.begin(), host_vector.end());
42
43 // create vectors on the device and copy the data
44 boost::compute::vector<int> device_vector(PERF_N, context);
45 boost::compute::copy(
46 host_vector.begin(), host_vector.end(), device_vector.begin(), queue
47 );
48
49 boost::compute::vector<int> device_vector2(PERF_N, context);
50 boost::compute::copy(
51 host_vector.begin(), host_vector.end(), device_vector2.begin(), queue
52 );
53
54 perf_timer t;
55 for(size_t trial = 0; trial < PERF_TRIALS; trial++){
56 t.start();
57 boost::compute::includes(
58 device_vector.begin(), device_vector.end(),
59 device_vector2.begin(), device_vector2.end(),
60 queue
61 );
62 queue.finish();
63 t.stop();
64 }
65 std::cout << "time: " << t.min_time() / 1e6 << " ms" << std::endl;
66
67 return 0;
68}

Callers

nothing calls this directly

Calls 12

perf_parse_argsFunction · 0.85
generateFunction · 0.85
sortFunction · 0.85
copyFunction · 0.85
includesFunction · 0.85
startMethod · 0.80
stopMethod · 0.80
min_timeMethod · 0.80
nameMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
finishMethod · 0.45

Tested by

no test coverage detected