8 #ifndef CUB_GPU_TESTS_CU_ 9 #define CUB_GPU_TESTS_CU_ 12 #define BOOST_TEST_DYN_LINK 13 #include <boost/test/unit_test.hpp> 14 #include "cub/cub.cuh" 15 #include "Vector/map_vector.hpp" 17 BOOST_AUTO_TEST_SUITE( cub_gpu_tests )
19 BOOST_AUTO_TEST_CASE( cub_gpu_scan_test )
31 for (
size_t i = 0 ; i < 10000; i++)
33 input.template get<0>(i) = 10.0*(float)rand() / RAND_MAX;
36 input.template hostToDevice<0>();
38 void *d_temp_storage = NULL;
39 size_t temp_storage_bytes = 0;
41 (
unsigned int *)output.template getDeviceBuffer<0>(),
44 temporal.resize(temp_storage_bytes);
48 (
unsigned int *)output.template getDeviceBuffer<0>(),
53 output.template deviceToHost<0>();
56 for (
size_t i = 0 ; i < input.
size() ; i++)
58 BOOST_REQUIRE_EQUAL(cnt,output.template get<0>(i));
59 cnt += input.template get<0>(i);
64 BOOST_AUTO_TEST_SUITE_END()
static CUB_RUNTIME_FUNCTION cudaError_t ExclusiveSum(void *d_temp_storage, size_t &temp_storage_bytes, InputIteratorT d_in, OutputIteratorT d_out, int num_items, cudaStream_t stream=0, bool debug_synchronous=false)
Computes a device-wide exclusive prefix sum. The value of 0 is applied as the initial value,...
Implementation of 1-D std::vector like structure.