1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2013-2014 Kyle Lutz <kyle.r.lutz@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 <thrust/copy.h>
16 #include <thrust/device_vector.h>
17 #include <thrust/generate.h>
18 #include <thrust/host_vector.h>
19 #include <thrust/reverse.h>
23 int main(int argc, char *argv[])
25 perf_parse_args(argc, argv);
27 std::cout << "size: " << PERF_N << std::endl;
28 thrust::host_vector<int> h_vec = generate_random_vector<int>(PERF_N);
30 // transfer data to the device
31 thrust::device_vector<int> d_vec;
34 for(size_t trial = 0; trial < PERF_TRIALS; trial++){
38 thrust::reverse(d_vec.begin(), d_vec.end());
39 cudaDeviceSynchronize();
42 std::cout << "time: " << t.min_time() / 1e6 << " ms" << std::endl;
44 // transfer data back to host
45 thrust::copy(d_vec.begin(), d_vec.end(), h_vec.begin());