Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
Add unit test for inclusive_scan with User Defined Type
Browse files Browse the repository at this point in the history
  • Loading branch information
codereport authored and alliepiper committed Mar 20, 2020
1 parent c7fc0eb commit 30230b8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dependencies/cub
Submodule cub updated 81 files
+1 −1 cub/agent/agent_histogram.cuh
+1 −1 cub/agent/agent_radix_sort_downsweep.cuh
+1 −1 cub/agent/agent_radix_sort_upsweep.cuh
+1 −1 cub/agent/agent_reduce.cuh
+1 −1 cub/agent/agent_reduce_by_key.cuh
+1 −1 cub/agent/agent_rle.cuh
+1 −1 cub/agent/agent_scan.cuh
+1 −1 cub/agent/agent_segment_fixup.cuh
+1 −1 cub/agent/agent_select_if.cuh
+1 −1 cub/agent/agent_spmv_orig.cuh
+1 −2 cub/agent/single_pass_scan_operators.cuh
+1 −1 cub/block/block_adjacent_difference.cuh
+1 −1 cub/block/block_discontinuity.cuh
+1 −3 cub/block/block_exchange.cuh
+1 −2 cub/block/block_histogram.cuh
+1 −2 cub/block/block_load.cuh
+1 −2 cub/block/block_radix_rank.cuh
+1 −2 cub/block/block_radix_sort.cuh
+1 −3 cub/block/block_raking_layout.cuh
+1 −1 cub/block/block_reduce.cuh
+17 −2 cub/block/block_scan.cuh
+1 −3 cub/block/block_shuffle.cuh
+1 −2 cub/block/block_store.cuh
+1 −1 cub/block/specializations/block_histogram_atomic.cuh
+1 −1 cub/block/specializations/block_histogram_sort.cuh
+1 −1 cub/block/specializations/block_reduce_raking.cuh
+1 −1 cub/block/specializations/block_reduce_raking_commutative_only.cuh
+1 −2 cub/block/specializations/block_reduce_warp_reductions.cuh
+1 −2 cub/block/specializations/block_scan_raking.cuh
+1 −2 cub/block/specializations/block_scan_warp_scans.cuh
+1 −2 cub/block/specializations/block_scan_warp_scans2.cuh
+1 −2 cub/block/specializations/block_scan_warp_scans3.cuh
+40 −0 cub/config.cuh
+2 −0 cub/cub.cuh
+1 −1 cub/device/device_histogram.cuh
+1 −1 cub/device/device_partition.cuh
+1 −2 cub/device/device_radix_sort.cuh
+1 −1 cub/device/device_reduce.cuh
+1 −1 cub/device/device_run_length_encode.cuh
+1 −1 cub/device/device_scan.cuh
+1 −2 cub/device/device_segmented_radix_sort.cuh
+1 −1 cub/device/device_segmented_reduce.cuh
+1 −1 cub/device/device_select.cuh
+1 −1 cub/device/device_spmv.cuh
+1 −1 cub/device/dispatch/dispatch_histogram.cuh
+1 −1 cub/device/dispatch/dispatch_radix_sort.cuh
+1 −1 cub/device/dispatch/dispatch_reduce.cuh
+1 −1 cub/device/dispatch/dispatch_reduce_by_key.cuh
+1 −1 cub/device/dispatch/dispatch_rle.cuh
+1 −2 cub/device/dispatch/dispatch_scan.cuh
+1 −1 cub/device/dispatch/dispatch_select_if.cuh
+1 −1 cub/device/dispatch/dispatch_spmv_orig.cuh
+1 −1 cub/grid/grid_barrier.cuh
+1 −2 cub/grid/grid_even_share.cuh
+1 −1 cub/grid/grid_mapping.cuh
+1 −1 cub/grid/grid_queue.cuh
+1 −1 cub/host/mutex.cuh
+1 −1 cub/iterator/arg_index_input_iterator.cuh
+1 −1 cub/iterator/cache_modified_input_iterator.cuh
+1 −1 cub/iterator/cache_modified_output_iterator.cuh
+1 −1 cub/iterator/constant_input_iterator.cuh
+1 −1 cub/iterator/counting_input_iterator.cuh
+1 −2 cub/iterator/discard_output_iterator.cuh
+1 −1 cub/iterator/tex_obj_input_iterator.cuh
+1 −1 cub/iterator/tex_ref_input_iterator.cuh
+1 −1 cub/iterator/transform_input_iterator.cuh
+1 −1 cub/thread/thread_load.cuh
+1 −2 cub/thread/thread_operators.cuh
+1 −1 cub/thread/thread_reduce.cuh
+1 −1 cub/thread/thread_scan.cuh
+1 −1 cub/thread/thread_search.cuh
+1 −1 cub/thread/thread_store.cuh
+79 −0 cub/util_compiler.cuh
+62 −0 cub/util_cpp_dialect.cuh
+46 −0 cub/util_deprecated.cuh
+1 −2 cub/warp/specializations/warp_reduce_shfl.cuh
+1 −1 cub/warp/specializations/warp_reduce_smem.cuh
+1 −1 cub/warp/specializations/warp_scan_shfl.cuh
+1 −1 cub/warp/specializations/warp_scan_smem.cuh
+1 −2 cub/warp/warp_reduce.cuh
+1 −2 cub/warp/warp_scan.cuh
24 changes: 24 additions & 0 deletions testing/scan.cu
Original file line number Diff line number Diff line change
Expand Up @@ -648,3 +648,27 @@ void TestExclusiveScanWithBigIndexes()

DECLARE_UNITTEST(TestExclusiveScanWithBigIndexes);

#if THRUST_CPP_DIALECT >= 2011

struct Int {
int i{};
__host__ __device__ explicit Int(int num) : i(num) {}
__host__ __device__ Int() : i{} {}
__host__ __device__ Int operator+(Int const& o) const { return Int{this->i + o.i}; }
};

void TestInclusiveScanWithUserDefinedType()
{
thrust::device_vector<Int> vec(5, Int{1});

thrust::inclusive_scan(
thrust::device,
vec.cbegin(),
vec.cend(),
vec.begin());

ASSERT_EQUAL(static_cast<Int>(vec.back()).i, 5);
}
DECLARE_UNITTEST(TestInclusiveScanWithUserDefinedType);

#endif // c++11

0 comments on commit 30230b8

Please sign in to comment.