Permalink
Browse files

2.11 2016 June 6 - Removed decltype() on device lambda

  • Loading branch information...
seanbaxter committed Jun 6, 2016
1 parent b7e5da3 commit 4c88be1e619553ecc15c43b3cb59e201997d0baf
Showing with 10 additions and 13 deletions.
  1. +2 −2 demo/bfs.cu
  2. +1 −1 src/moderngpu/kernel_join.hxx
  3. +1 −1 src/moderngpu/kernel_mergesort.hxx
  4. +4 −4 src/moderngpu/kernel_scan.hxx
  5. +2 −5 src/moderngpu/memory.hxx
@@ -36,8 +36,8 @@ int bfs(vertices_it vertices, int num_vertices, edges_it edges,
}
return count;
};
transform_scan(segment_sizes, num_vertices, segments.data(), plus_t<int>(),
count.data(), context);
transform_scan<int>(segment_sizes, num_vertices, segments.data(),
plus_t<int>(), count.data(), context);
// Read out the number of work-items and quit if there are none. That means
// we've visited all vertices connected to a source.
@@ -26,7 +26,7 @@ mem_t<int2> inner_join(a_it a, int a_count, b_it b, int b_count,
const int* upper_data = upper.data();
mem_t<int> count(1, context);
transform_scan([=]MGPU_DEVICE(int index) {
transform_scan<int>([=]MGPU_DEVICE(int index) {
return upper_data[index] - lower_data[index];
}, a_count, scanned_sizes.data(), plus_t<int>(), count.data(), context);
@@ -20,7 +20,7 @@ mem_t<int> merge_sort_partitions(keys_it keys, int count, int coop,
keys + range.b_begin, range.b_count(), diag, comp);
};
return fill_function(k, num_partitions, context);
return fill_function<int>(k, num_partitions, context);
}
// Key-value mergesort.
@@ -175,23 +175,23 @@ void scan(input_it input, int count, output_it output, context_t& context) {
discard_iterator_t<type_t>(), context);
}
template<scan_type_t scan_type = scan_type_exc,
template<typename type_t, scan_type_t scan_type = scan_type_exc,
typename launch_arg_t = empty_t, typename func_t, typename output_it,
typename op_t, typename reduction_it>
void transform_scan_event(func_t f, int count, output_it output, op_t op,
reduction_it reduction, context_t& context, cudaEvent_t event) {
scan_event<scan_type, launch_arg_t>(make_load_iterator<decltype(f(0))>(f),
scan_event<scan_type, launch_arg_t>(make_load_iterator<type_t>(f),
count, output, op, reduction, context, event);
}
template<scan_type_t scan_type = scan_type_exc,
template<typename type_t, scan_type_t scan_type = scan_type_exc,
typename launch_arg_t = empty_t, typename func_t, typename output_it,
typename op_t, typename reduction_it>
void transform_scan(func_t f, int count, output_it output, op_t op,
reduction_it reduction, context_t& context) {
transform_scan_event<scan_type, launch_arg_t>(f, count, output, op,
transform_scan_event<type_t, scan_type, launch_arg_t>(f, count, output, op,
reduction, context, 0);
}
@@ -74,11 +74,8 @@ std::vector<type_t> from_mem(const mem_t<type_t>& mem) {
return host;
}
template<typename func_t>
auto fill_function(func_t f, size_t count, context_t& context) ->
mem_t<decltype(f(0))> {
typedef decltype(f(0)) type_t;
template<typename type_t, typename func_t>
mem_t<type_t> fill_function(func_t f, size_t count, context_t& context) {
mem_t<type_t> mem(count, context);
type_t* p = mem.data();
transform([=]MGPU_DEVICE(int index) {

0 comments on commit 4c88be1

Please sign in to comment.