Permalink
Fetching contributors…
Cannot retrieve contributors at this time
43 lines (31 sloc) 1.18 KB
PREAMBLE = \
"""
#include <thrust/unique.h>
"""
INITIALIZE = \
"""
thrust::host_vector<$InputType> h_input = unittest::random_integers<$InputType>($InputSize);
// increase likelihood of equal consecutive elements
for(size_t i = 0; i < $InputSize; i++)
h_input[i] %= 4;
thrust::device_vector<$InputType> d_input = h_input;
thrust::device_vector<$InputType> d_copy = d_input;
thrust::host_vector<$InputType>::iterator h_end = thrust::unique(h_input.begin(), h_input.end());
thrust::device_vector<$InputType>::iterator d_end = thrust::unique(d_input.begin(), d_input.end());
thrust::host_vector<$InputType> h_result(h_input.begin(), h_end);
thrust::device_vector<$InputType> d_result(d_input.begin(), d_end);
ASSERT_EQUAL(h_result, d_result);
"""
TIME = \
"""
thrust::copy(d_copy.begin(), d_copy.end(), d_input.begin());
thrust::unique(d_input.begin(), d_input.end());
"""
FINALIZE = \
"""
RECORD_TIME();
RECORD_THROUGHPUT(double($InputSize));
"""
InputTypes = SignedIntegerTypes
InputSizes = StandardSizes
TestVariables = [('InputType', InputTypes), ('InputSize', InputSizes)]