forked from NVIDIA/thrust
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsort_large.test
47 lines (37 loc) · 1.07 KB
/
sort_large.test
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
37
38
39
40
41
42
43
44
45
46
47
PREAMBLE = \
"""
#include <thrust/sort.h>
template <typename T>
struct my_less : public thrust::binary_function<T,T,bool>
{
__host__ __device__
bool operator()(const T& a, const T& b) const
{
return a < b;
}
};
"""
INITIALIZE = \
"""
thrust::host_vector<$KeyType> h_keys = unittest::random_integers<$KeyType>($InputSize);
thrust::device_vector<$KeyType> d_keys = h_keys;
thrust::device_vector<$KeyType> d_keys_copy = d_keys;
typedef my_less<$KeyType> Comp;
// test sort
thrust::sort(h_keys.begin(), h_keys.end(), Comp());
thrust::sort(d_keys.begin(), d_keys.end(), Comp());
ASSERT_EQUAL(d_keys, h_keys);
"""
TIME = \
"""
thrust::copy(d_keys_copy.begin(), d_keys_copy.end(), d_keys.begin());
thrust::sort(d_keys.begin(), d_keys.end(), Comp());
"""
FINALIZE = \
"""
RECORD_TIME();
RECORD_SORTING_RATE(double($InputSize));
"""
KeyTypes = ['int']
InputSizes = [2**24]
TestVariables = [('KeyType', KeyTypes), ('InputSize', InputSizes)]