]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/compute/perf/perf_uniform_int_distribution.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / compute / perf / perf_uniform_int_distribution.cpp
1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2014 Roshan <thisisroshansmail@gmail.com>
3 //
4 // Distributed under the Boost Software License, Version 1.0
5 // See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt
7 //
8 // See http://boostorg.github.com/compute for more information.
9 //---------------------------------------------------------------------------//
10
11 #include <algorithm>
12 #include <iostream>
13 #include <vector>
14
15 #include <boost/compute/system.hpp>
16 #include <boost/compute/container/vector.hpp>
17 #include <boost/compute/random/default_random_engine.hpp>
18 #include <boost/compute/random/uniform_int_distribution.hpp>
19
20 #include "perf.hpp"
21
22 namespace compute = boost::compute;
23
24 int main(int argc, char *argv[])
25 {
26 perf_parse_args(argc, argv);
27 std::cout << "size: " << PERF_N << std::endl;
28
29 compute::device device = compute::system::default_device();
30 compute::context context(device);
31 compute::command_queue queue(context, device);
32
33 compute::vector<compute::uint_> vector(PERF_N, context);
34
35 compute::default_random_engine rng(queue);
36 compute::uniform_int_distribution<compute::uint_> dist(0, 1);
37
38 perf_timer t;
39 t.start();
40 dist.generate(vector.begin(), vector.end(), rng, queue);
41 queue.finish();
42 t.stop();
43 std::cout << "time: " << t.min_time() / 1e6 << " ms" << std::endl;
44
45 return 0;
46 }