forked from NVIDIA/thrust
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinner_product.test
37 lines (28 loc) · 1.08 KB
/
inner_product.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
PREAMBLE = \
"""
#include <thrust/inner_product.h>
"""
INITIALIZE = \
"""
thrust::host_vector<$InputType> h_input1 = unittest::random_integers<$InputType>($InputSize);
thrust::host_vector<$InputType> h_input2 = unittest::random_integers<$InputType>($InputSize);
thrust::device_vector<$InputType> d_input1 = h_input1;
thrust::device_vector<$InputType> d_input2 = h_input2;
$InputType init = 13;
$InputType h_result = thrust::inner_product(h_input1.begin(), h_input1.end(), h_input2.begin(), init);
$InputType d_result = thrust::inner_product(d_input1.begin(), d_input1.end(), d_input2.begin(), init);
ASSERT_EQUAL(h_result, d_result);
"""
TIME = \
"""
thrust::inner_product(d_input1.begin(), d_input1.end(), d_input2.begin(), init);
"""
FINALIZE = \
"""
RECORD_TIME();
RECORD_THROUGHPUT(2 * double($InputSize));
RECORD_BANDWIDTH(2 * sizeof($InputType) * double($InputSize));
"""
InputTypes = SignedIntegerTypes
InputSizes = StandardSizes
TestVariables = [('InputType', InputTypes), ('InputSize', InputSizes)]