forked from NVIDIA/thrust
-
Notifications
You must be signed in to change notification settings - Fork 1
/
adjacent_difference.test
36 lines (27 loc) · 975 Bytes
/
adjacent_difference.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/adjacent_difference.h>
"""
INITIALIZE = \
"""
thrust::host_vector<$InputType> h_input = unittest::random_integers<$InputType>($InputSize);
thrust::device_vector<$InputType> d_input = h_input;
thrust::host_vector<$InputType> h_output($InputSize);
thrust::device_vector<$InputType> d_output($InputSize);
thrust::adjacent_difference(h_input.begin(), h_input.end(), h_output.begin());
thrust::adjacent_difference(d_input.begin(), d_input.end(), d_output.begin());
ASSERT_EQUAL(h_output, d_output);
"""
TIME = \
"""
thrust::adjacent_difference(d_input.begin(), d_input.end(), d_output.begin());
"""
FINALIZE = \
"""
RECORD_TIME();
RECORD_THROUGHPUT(double($InputSize));
RECORD_BANDWIDTH(2*sizeof($InputType) * double($InputSize));
"""
InputTypes = ['int']
InputSizes = [2**24]
TestVariables = [('InputType', InputTypes), ('InputSize', InputSizes)]