-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathtest2.cpp
36 lines (31 loc) · 1.18 KB
/
test2.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//
// Copyright (c) 2011 Ronaldo Carpio
//
// Permission to use, copy, modify, distribute and sell this software
// and its documentation for any purpose is hereby granted without fee,
// provided that the above copyright notice appear in all copies and
// that both that copyright notice and this permission notice appear
// in supporting documentation. The authors make no representations
// about the suitability of this software for any purpose.
// It is provided "as is" without express or implied warranty.
//
#include <cstdlib>
#include <time.h>
#include <stdio.h>
#include <algorithm>
#include <vector>
void test2() {
// generate 32M random numbers on the host
std::vector<int> h_vec(32 << 20);
std::generate(h_vec.begin(), h_vec.end(), rand);
// sort data on the device (846M keys per sec on GeForce GTX 480)
std::sort(h_vec.begin(), h_vec.end());
}
int main(void) {
time_t t1, t2, t3;
t2 = time(NULL);
test2();
t3 = time(NULL);
printf("CPU: %d\n", t3-t2);
return 0;
}