Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
43 lines (31 sloc) 1.03 KB
PREAMBLE = \
"""
#include <thrust/sort.h>
"""
INITIALIZE = \
"""
const size_t InputSize = 1 << 24;
thrust::host_vector<$KeyType> h_keys = unittest::random_integers<$KeyType>(InputSize);
// set upper bits to zero
for(size_t i = 0; i < InputSize; i++)
h_keys[i] >>= (32 - $KeyBits);
thrust::device_vector<$KeyType> d_keys = h_keys;
thrust::device_vector<$KeyType> d_keys_copy = d_keys;
// test sort
thrust::stable_sort(h_keys.begin(), h_keys.end());
thrust::detail::backend::cuda::detail::stable_radix_sort(d_keys.begin(), d_keys.end());
ASSERT_EQUAL(d_keys, h_keys);
"""
TIME = \
"""
thrust::copy(d_keys_copy.begin(), d_keys_copy.end(), d_keys.begin());
thrust::detail::backend::cuda::detail::stable_radix_sort(d_keys.begin(), d_keys.end());
"""
FINALIZE = \
"""
RECORD_TIME();
RECORD_SORTING_RATE(double(InputSize));
"""
KeyTypes = ['unsigned int']
KeyBits = range(1, 33)
TestVariables = [('KeyType', KeyTypes), ('KeyBits',KeyBits)]
Jump to Line
Something went wrong with that request. Please try again.