]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/compute/perf/perf_uniform_int_distribution.cpp
1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2014 Roshan <thisisroshansmail@gmail.com>
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
8 // See http://boostorg.github.com/compute for more information.
9 //---------------------------------------------------------------------------//
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>
22 namespace compute
= boost::compute
;
24 int main(int argc
, char *argv
[])
26 perf_parse_args(argc
, argv
);
27 std::cout
<< "size: " << PERF_N
<< std::endl
;
29 compute::device device
= compute::system::default_device();
30 compute::context
context(device
);
31 compute::command_queue
queue(context
, device
);
33 compute::vector
<compute::uint_
> vector(PERF_N
, context
);
35 compute::default_random_engine
rng(queue
);
36 compute::uniform_int_distribution
<compute::uint_
> dist(0, 1);
40 dist
.generate(vector
.begin(), vector
.end(), rng
, queue
);
43 std::cout
<< "time: " << t
.min_time() / 1e6
<< " ms" << std::endl
;