1#ifndef HOSTDEVICE_UTIL_FUNCS_HPP_
2#define HOSTDEVICE_UTIL_FUNCS_HPP_
14template<
typename T_type,
template<
typename>
class layout_base,
unsigned int ... prp>
18 typename layout_base<T_type>::type &
dst;
45 typedef typename boost::mpl::at<v_prp,boost::mpl::int_<T::value>>::type prp_id;
47 typedef typename boost::mpl::at<typename T_type::type,prp_id>::type p_type;
49 boost::fusion::at_c<prp_id::value>(
dst).mem->deviceToHost(
start*
sizeof(p_type),(
stop+1)*
sizeof(p_type));
63template<
typename T_type,
template<
typename>
class layout_base,
unsigned int ... prp>
67 typename layout_base<T_type>::type &
dst;
88 boost::fusion::at_c<boost::mpl::at<v_prp,boost::mpl::int_<T::value>>::type::value>(
dst).mem->deviceToHost();
102template<
typename T_type,
template<
typename>
class layout_base ,
typename Memory,
unsigned int ... prp>
106 typename layout_base<T_type>::type &
dst;
132 typedef typename boost::mpl::at<v_prp,boost::mpl::int_<T::value>>::type ele_type;
134 typedef decltype(boost::fusion::at_c<ele_type::value>(
dst).mem_r) mem_r_type;
136 typedef typename boost::mpl::at<typename T_type::type,ele_type>::type type_prp;
149 ::template transform<Memory,mem_r_type>(
static_cast<Memory *
>(boost::fusion::at_c<boost::mpl::at<
v_prp,boost::mpl::int_<T::value>>::type::value>(
dst).mem),
150 boost::fusion::at_c<boost::mpl::at<
v_prp,boost::mpl::int_<T::value>>::type::value>(
dst).mem_r,
151 start*
sizeof(type_prp),
152 (
stop+1)*
sizeof(type_prp));
160 ::call(boost::fusion::at_c<boost::mpl::at<
v_prp,boost::mpl::int_<T::value>>::type::value>(
dst).mem_r,
start,
stop);
this class is a functor for "for_each" algorithm
device_to_host_impl(typename layout_base< T_type >::type &dst)
constructor
to_boost_vmpl< prp... >::type v_prp
Convert the packed properties into an MPL vector.
layout_base< T_type >::type & dst
encapsulated destination object
void operator()(T &t) const
It call the copy function for each property.
this class is a functor for "for_each" algorithm
void operator()(T &t) const
It call the copy function for each property.
to_boost_vmpl< prp... >::type v_prp
Convert the packed properties into an MPL vector.
device_to_host_start_stop_impl(typename layout_base< T_type >::type &dst, size_t start, size_t stop)
constructor
layout_base< T_type >::type & dst
encapsulated destination object
this class is a functor for "for_each" algorithm
layout_base< T_type >::type & dst
encapsulated destination object
size_t start
starting element
void operator()(T &t) const
It call the copy function for each property.
to_boost_vmpl< prp... >::type v_prp
Convert the packed properties into an MPL vector.
host_to_device_impl(typename layout_base< T_type >::type &dst, size_t start, size_t stop)
constructor
Check this is a gpu or cpu type cell-list.