Exemple #1
0
  static result_type
  apply(ViewT& v)
  {
    using namespace vsip_csl::dispatcher;
    result_type r;

    // Don't use the default dispatch list here, as that doesn't include the
    // 'parallel' backend. (The latter then uses the default list for local
    // dispatches.
    typedef Make_type_list<
      be::parallel,
      be::cbe_sdk,
      be::cuda,
      be::cvsip,
      be::mercury_sal, 
      be::generic>::type list_type;

    if (is_expr_dense(v.block()))
    {
      Dispatcher<op::reduce<ReduceT>, 
        void(result_type&, new_block_type const&, new_order_type, new_dim_type), list_type>::
        dispatch(r, new_block_type(const_cast<block_type&>(v.block())), new_order_type(), new_dim_type());
    }
    else
    {
      Dispatcher<op::reduce<ReduceT>, 
        void(result_type&, block_type const&, order_type, dim_type), list_type>::
      dispatch(r, v.block(), order_type(), dim_type());
    }

    return r;
  }
void
check_block_size(length_type g_size, length_type l_size, ViewT const& view)
{
  test_assert(g_size == view.size(0));
  test_assert(g_size == view.block().size(1, 0));

  test_assert(l_size == view.local().size(0));
  test_assert(l_size == view.local().block().size(1, 0));

  test_assert(g_size == view.size());
  test_assert(g_size == view.block().size());

  test_assert(l_size == view.local().size());
  test_assert(l_size == view.local().block().size());
}
Exemple #3
0
typename ReduceT<typename ViewT::value_type>::result_type
reduce(ViewT v)
{
  using namespace vsip_csl::dispatcher;

  typedef typename ViewT::value_type T;
  typedef typename ReduceT<T>::result_type result_type;
  typedef typename ViewT::block_type block_type;
  typedef typename get_block_layout<block_type>::order_type order_type;
  typedef Int_type<ViewT::dim> dim_type;

  result_type r;

#if VSIP_IMPL_REF_IMPL
  Evaluator<op::reduce<ReduceT>, be::cvsip, 
    void(result_type&, block_type const&, order_type, dim_type)>::
    exec(r, v.block(), order_type(), dim_type());
#else

  // This optimization is only applicable to target platforms that provide a
  // backend that uses direct data access rather than redim_get/put().
  // This includes CUDA and Cell backends, but not x86 (as of August 2010).
#if defined(VSIP_IMPL_CBE_SDK) || defined(VSIP_IMPL_HAVE_CUDA)
  bool const redimensionable = 
    (ViewT::dim != 1) && (!is_expr_block<block_type>::value);
#else
  bool const redimensionable = false;
#endif

  r = Reduction_dispatch_helper<ReduceT, ViewT, redimensionable>::apply(v);
#endif

  return r;
}
Exemple #4
0
 Ps_helper(ViewT& view, Stream_pattern const& spatt, bool input)
   : data_   (view.block())
   , addr_  (data_.ptr())
   , spatt_ (spatt)
   , input_ (input)
 {}