Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
45 lines (34 sloc) 1.35 KB
PREAMBLE = \
"""
#include <thrust/sort.h>
#include <thrust/sequence.h>
"""
INITIALIZE = \
"""
thrust::host_vector<$KeyType> h_keys = unittest::random_integers<$KeyType>($InputSize);
thrust::device_vector<$KeyType> d_keys = h_keys;
thrust::host_vector<$ValueType> h_values($InputSize);
thrust::device_vector<$ValueType> d_values($InputSize);
thrust::sequence(h_values.begin(), h_values.end());
thrust::sequence(d_values.begin(), d_values.end());
thrust::device_vector<$KeyType> d_keys_copy = d_keys;
// test sort
thrust::stable_sort_by_key(h_keys.begin(), h_keys.end(), h_values.begin());
thrust::detail::backend::cuda::detail::stable_radix_sort_by_key(d_keys.begin(), d_keys.end(), d_values.begin());
ASSERT_EQUAL(d_keys, h_keys);
ASSERT_EQUAL(d_values, h_values);
"""
TIME = \
"""
thrust::copy(d_keys_copy.begin(), d_keys_copy.end(), d_keys.begin());
thrust::detail::backend::cuda::detail::stable_radix_sort_by_key(d_keys.begin(), d_keys.end(), d_values.begin());
"""
FINALIZE = \
"""
RECORD_TIME();
RECORD_SORTING_RATE(double($InputSize));
"""
KeyTypes = ['char', 'short', 'int', 'long long', 'float', 'double']
ValueTypes = ['unsigned int']
InputSizes = StandardSizes
TestVariables = [('KeyType', KeyTypes), ('ValueType', ValueTypes), ('InputSize', InputSizes)]