13 #include "Vector/map_vector.hpp"
14 #include "util/cuda_launch.hpp"
21 #include <thrust/merge.h>
22 #include <thrust/execution_policy.h>
26 #include <thrust/merge.h>
27 #include <thrust/execution_policy.h>
34 template<
typename a_keys_it,
typename a_vals_it,
35 typename b_keys_it,
typename b_vals_it,
36 typename c_keys_it,
typename c_vals_it,
37 typename comp_t,
typename context_t>
38 void merge(a_keys_it a_keys, a_vals_it a_vals,
int a_count,
39 b_keys_it b_keys, b_vals_it b_vals,
int b_count,
40 c_keys_it c_keys, c_vals_it c_vals, comp_t comp, context_t& context)
48 while (a_it < a_count || b_it < b_count)
54 if (comp(b_keys[b_it],a_keys[a_it]))
56 c_keys[c_it] = b_keys[b_it];
57 c_vals[c_it] = b_vals[b_it];
63 c_keys[c_it] = a_keys[a_it];
64 c_vals[c_it] = a_vals[a_it];
71 c_keys[c_it] = a_keys[a_it];
72 c_vals[c_it] = a_vals[a_it];
79 c_keys[c_it] = b_keys[b_it];
80 c_vals[c_it] = b_vals[b_it];
90 thrust::merge_by_key(thrust::device, a_keys,a_keys + a_count,
91 b_keys,b_keys + b_count,
97 thrust::merge_by_key(thrust::device, a_keys,a_keys + a_count,
98 b_keys,b_keys + b_count,
convert a type into constant type