Created by
Venkatesh-Prasad Ranganath
| #include <algorithm>
#include <random>
int main(void) {
const int N = 32 << 20;
std::vector<int> values(N);
std::random_device rd;
for(size_t i = 0; i < values.size(); i++)
values[i] = rd();
std::sort(values.begin(), values.end());
return 0;
}
|
| #include <thrust/device_vector.h>
#include <thrust/sort.h>
#include <random>
int main(void) {
const int N = 32 << 20;
thrust::host_vector<int> h_values(N);
std::random_device rd;
for(size_t i = 0; i < h_values.size(); i++)
h_values[i] = rd();
thrust::device_vector<int> d_values(N);
d_values = h_values;
thrust::sort(d_values.begin(), d_values.end());
thrust::copy(d_values.begin(), d_values.end(), h_values.begin());
return 0;
}
|