Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <device_functions.h>
- #include "cuda_runtime.h"
- #include "device_launch_parameters.h"
- #include <stdio.h>
- #include <stdlib.h>
- #include <cstring>
- #include <vector>
- #include <thrust/host_vector.h>
- #include <thrust/device_vector.h>
- #include <thrust/generate.h>
- #include <thrust/copy.h>
- #include <thrust/sort.h>
- #include <iostream>
- #include <fstream>
- #include <ctime>
- using namespace std;
- int main()
- {
- std::clock_t start;
- double duration;
- start = std::clock();
- thrust::host_vector<int> h_vec(50000);
- thrust::generate_n(h_vec.begin(), h_vec.end(), rand);
- thrust::device_vector<int> d_vec = h_vec;
- thrust::sort(d_vec.begin(), d_vec.end());
- thrust::copy(d_vec.begin(), d_vec.end(), h_vec.begin());
- duration = (std::clock() - start) / (double)CLOCKS_PER_SEC;
- std::cout << "printf: " << duration << '\n';
- cout << "labas";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement