forked from NVIDIA/thrust
-
Notifications
You must be signed in to change notification settings - Fork 1
/
reduce.test
34 lines (26 loc) · 850 Bytes
/
reduce.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
PREAMBLE = \
"""
#include <thrust/reduce.h>
"""
INITIALIZE = \
"""
thrust::host_vector<$InputType> h_input = unittest::random_integers<$InputType>($InputSize);
thrust::device_vector<$InputType> d_input = h_input;
$InputType init = 13;
$InputType h_result = thrust::reduce(h_input.begin(), h_input.end(), init);
$InputType d_result = thrust::reduce(d_input.begin(), d_input.end(), init);
ASSERT_EQUAL(h_result, d_result);
"""
TIME = \
"""
thrust::reduce(d_input.begin(), d_input.end(), init);
"""
FINALIZE = \
"""
RECORD_TIME();
RECORD_THROUGHPUT(double($InputSize));
RECORD_BANDWIDTH(sizeof($InputType) * double($InputSize));
"""
InputTypes = SignedIntegerTypes
InputSizes = StandardSizes
TestVariables = [('InputType', InputTypes), ('InputSize', InputSizes)]