25 typedef typename boost::fusion::result_of::push_front<typename T::type, size_t>::type
E_a;
46 typedef typename boost::fusion::result_of::push_front<typename T::type, size_t>::type
V_a;
75template<
unsigned int prp>
78 template<
typename aggr_vect,
typename encap_type>
79 static void red(aggr_vect & aggr, encap_type & ec)
81 auto op1 = ec.template get<prp>();
82 auto op2 = aggr.template get<prp>();
84 aggr.template get<prp>() = (op2 < op1)?op1:op2;
87 template<
typename red_type,
typename aggr_vect,
typename BlockReduce>
88 static red_type red_final(red_type * rt, aggr_vect & aggr)
90 return BlockReduce(rt).Max(aggr.template get<prp>());
94template<
unsigned int prp>
97 template<
typename aggr_vect,
typename encap_type>
98 static void red(aggr_vect & aggr, encap_type & ec)
100 auto op1 = ec.template get<prp>();
101 auto op2 = aggr.template get<prp>();
103 aggr.template get<prp>() = (op2 > op1)?op1:op2;
107 template<
typename red_type,
typename aggr_vect,
typename BlockReduce>
108 static red_type red_final(red_type * rt, aggr_vect & aggr)
110 return BlockReduce(rt).Min(aggr.template get<prp>());
114template<
unsigned int prp>
117 template<
typename aggr_vect,
typename encap_type>
118 static void red(aggr_vect & aggr, encap_type & ec)
120 aggr.template get<prp>() += ec.template get<prp>();
124 template<
typename red_type,
typename aggr_vect,
typename BlockReduce>
125 static red_type red_final(red_type * rt, aggr_vect & aggr)
127 return BlockReduce(rt).Sum(aggr.template get<prp>());
141template<
typename aggr_vect,
typename reduction_vectors>
164 boost::mpl::at<reduction_vectors,boost::mpl::int_<T::value>>
::red(
red,
input);
178template<
typename aggr_vect,
typename red_type,
typename reduction_vectors>
187 typedef typename boost::mpl::size<reduction_vectors>::type nred;
189 red_type red_final[nred::value];
209 red_final[T::value] = boost::mpl::at<reduction_vectors,boost::mpl::int_<T::value>>::red_final(
red_space);
224template<
typename red_type,
typename encap_type ,
typename reduction_vectors>
227 typedef typename boost::mpl::size<reduction_vectors>::type nred;
229 red_type (& red_final)[nred::value];
231 encap_type & destination;
240 :red_final(red_final),destination(destination)
248 typedef typename boost::mpl::at<reduction_vectors,boost::mpl::int_<T::value>>
::prop prp;
250 destination.template get<prp::value>() = red_final[T::value];
254template<
typename vector_index_type,
typename vector_index_type2,
typename vector_data_type,
typename reduction_operation_vector,
255 typename red_type,
unsigned int blockSize>
256__global__
void reduce_data(vector_index_type v_offsets, vector_index_type2 v_ord, vector_data_type v_data, vector_data_type v_data_red)
258 int offset_start = v_offsets.template get<0>(blockIdx.x);
259 int offset_end = v_offsets.template get<0>(blockIdx.x+1);
260 int n_block_reduce = (offset_end - offset_start) / blockDim.x;
265 __shared__
typename BlockReduceT::TempStorage temp_storage;
267 typename vector_data_type::value_type red_v;
269 typedef boost::mpl::size<reduction_operation_vector> n_reductions;
272 for ( ; i < n_block_reduce ; i++)
276 boost::mpl::for_each_ref<boost::mpl::range_c<int,0,n_reductions::value>>(ro);
281 boost::mpl::for_each_ref<boost::mpl::range_c<int,0,n_reductions::value>>(rof);
283 if (threadIdx.x == 0)
Edge class that encapsulate an object T.
E_a type
type for the edge
boost::fusion::result_of::push_front< typenameT::type, size_t >::type E_a
insert a size_t property to the boost::vector
Vertex class that encapsulate an object T.
boost::fusion::result_of::push_front< typenameT::type, size_t >::type V_a
insert a size_t property to the boost::vector
V_a type
type for the vertex
The BlockReduce class provides collective methods for computing a parallel reduction of items partiti...
aggregate of properties, from a list of object if create a struct that follow the OPENFPM native stru...
Get the reference of the selected element.
this class is a functor for "for_each" algorithm
__device__ __host__ void operator()(T &t)
It call the copy function for each property.
aggr_vect & red
reduction aggregate
__device__ __host__ reduce_op_final(aggr_vect &red, red_type &red_space)
constructor
red_type * red_space
block to reduce
this class is a functor for "for_each" algorithm
__device__ __host__ reduce_op(aggr_vect &red, reduction_vectors &input)
constructor
__device__ __host__ void operator()(T &t) const
It call the copy function for each property.
aggr_vect & red
reduction aggregate
reduction_vectors & input
encapsulated input object
this class is a functor for "for_each" algorithm
__device__ __host__ void operator()(T &t)
It call the copy function for each property.
__device__ __host__ store_reduce_op_final(encap_type &destination, red_type(&red_final)[nred::value])
constructor
temporal buffer for reductions