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

Function main

compute/perf/perf_find_end.cpp:27–65  ·  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 vector 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
42 int pattern[] = {2, 6, 6, 7, 8, 4};
43
44 // create vector on the device and copy the data
45 boost::compute::vector<int> device_vector(PERF_N, context);
46 boost::compute::copy(
47 host_vector.begin(), host_vector.end(), device_vector.begin(), queue
48 );
49
50 boost::compute::vector<int> pattern_vector(pattern, pattern + 6, queue);
51
52 perf_timer t;
53 for(size_t trial = 0; trial < PERF_TRIALS; trial++){
54 t.start();
55 boost::compute::find_end(
56 device_vector.begin(), device_vector.end(),
57 pattern_vector.begin(), pattern_vector.end(), queue
58 );
59 queue.finish();
60 t.stop();
61 }
62 std::cout << "time: " << t.min_time() / 1e6 << " ms" << std::endl;
63
64 return 0;
65}

Callers

nothing calls this directly

Calls 11

perf_parse_argsFunction · 0.85
copyFunction · 0.85
find_endFunction · 0.85
startMethod · 0.80
stopMethod · 0.80
min_timeMethod · 0.80
generateFunction · 0.50
nameMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
finishMethod · 0.45

Tested by

no test coverage detected