Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
38 lines (28 sloc) 1.08 KB
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)]