80 template<concepts::Acc TAcc, std::
size_t Dim>
111 class const_iterator;
129 : elements_{elements}
133 stride_{stride - elements}
135 , index_{
std::min(first, extent)}
151 if(indexElem_ >= elements_)
156 if(index_ >= extent_)
172 return (*(*
this) == *other);
177 return not(*
this == other);
255 template<concepts::Acc TAcc,
typename... TArgs>
269 template<std::size_t
Dim, concepts::Acc TAcc,
typename... TArgs>
283 template<concepts::Acc TAcc,
typename... TArgs>
291 template<concepts::Acc TAcc,
typename... TArgs>
299 template<concepts::Acc TAcc,
typename... TArgs>
349 template<concepts::Acc TAcc>
351 class UniformElementsND
366 ALPAKA_FN_ACC inline UniformElementsND(TAcc
const& acc, Vec extent)
385 if((thread_ < extent_).all())
393 return const_iterator{
this, at_end_t{}};
400 return const_iterator{
this, at_end_t{}};
405 friend class UniformElementsND;
430 return (index_ == other.index_);
435 return not(*
this == other);
449 ALPAKA_FN_ACC inline const_iterator(UniformElementsND
const* loop, at_end_t
const&)
451 , first_{loop_->extent_}
452 , range_{loop_->extent_}
453 , index_{loop_->extent_}
460 bool overflow =
false;
462 if(index_[I] >= range_[I])
464 index_[I] = first_[I];
480 if(not nth_elements_loop<N - 1>())
486 return do_elements_loops<N - 1>();
495 bool overflow =
false;
496 first_[I] += loop_->stride_[I];
497 if(first_[I] >= loop_->extent_[I])
499 first_[I] = loop_->thread_[I];
502 index_[I] = first_[I];
503 range_[I] = std::min(first_[I] + loop_->elements_[I], loop_->extent_[I]);
517 if(not nth_strided_loop<N - 1>())
523 return do_strided_loops<N - 1>();
534 if(not do_elements_loops<Dim::value>())
542 if(not do_strided_loops<Dim::value>())
549 first_ = loop_->extent_;
550 range_ = loop_->extent_;
551 index_ = loop_->extent_;
555 UniformElementsND
const* loop_;
577 template<concepts::Acc TAcc>
581 return detail::UniformElementsND<TAcc>(acc);
584 template<concepts::Acc TAcc>
590 return detail::UniformElementsND<TAcc>(acc, extent);
649 template<concepts::Acc TAcc, std::
size_t Dim>
651 class UniformGroupsAlong
671 class const_iterator;
672 using iterator = const_iterator;
676 return const_iterator(stride_, extent_, first_);
681 return const_iterator(stride_, extent_, extent_);
686 friend class UniformGroupsAlong;
691 , first_{
std::min(first, extent)}
724 return (first_ == other.first_);
729 return not(*
this == other);
796 template<concepts::Acc TAcc,
typename... TArgs>
801 return detail::UniformGroupsAlong<TAcc, 0>(acc,
static_cast<Idx>(args)...);
810 template<std::size_t
Dim, concepts::Acc TAcc,
typename... TArgs>
815 return detail::UniformGroupsAlong<TAcc, Dim>(acc,
static_cast<Idx>(args)...);
824 template<concepts::Acc TAcc,
typename... TArgs>
829 return detail::UniformGroupsAlong<TAcc, alpaka::Dim<TAcc>::value - 1>(acc,
static_cast<Idx>(args)...);
832 template<concepts::Acc TAcc,
typename... TArgs>
837 return detail::UniformGroupsAlong<TAcc, alpaka::Dim<TAcc>::value - 2>(acc,
static_cast<Idx>(args)...);
840 template<concepts::Acc TAcc,
typename... TArgs>
845 return detail::UniformGroupsAlong<TAcc, alpaka::Dim<TAcc>::value - 3>(acc,
static_cast<Idx>(args)...);
902 template<concepts::Acc TAcc, std::
size_t Dim>
904 class UniformGroupElementsAlong
927 class const_iterator;
928 using iterator = const_iterator;
932 return const_iterator(local_, first_, range_);
937 return const_iterator(range_, first_, range_);
942 friend class UniformGroupElementsAlong;
980 return (index_ == other.index_);
985 return not(*
this == other);
1050 template<concepts::Acc TAcc,
typename... TArgs>
1055 return detail::UniformGroupElementsAlong<TAcc, 0>(acc,
static_cast<Idx>(args)...);
1064 template<std::size_t
Dim, concepts::Acc TAcc,
typename... TArgs>
1069 return detail::UniformGroupElementsAlong<TAcc, Dim>(acc,
static_cast<Idx>(args)...);
1078 template<concepts::Acc TAcc,
typename... TArgs>
1083 return detail::UniformGroupElementsAlong<TAcc, alpaka::Dim<TAcc>::value - 1>(acc,
static_cast<Idx>(args)...);
1086 template<concepts::Acc TAcc,
typename... TArgs>
1091 return detail::UniformGroupElementsAlong<TAcc, alpaka::Dim<TAcc>::value - 2>(acc,
static_cast<Idx>(args)...);
1094 template<concepts::Acc TAcc,
typename... TArgs>
1099 return detail::UniformGroupElementsAlong<TAcc, alpaka::Dim<TAcc>::value - 3>(acc,
static_cast<Idx>(args)...);
#define ALPAKA_UNREACHABLE(...)
Before CUDA 11.5 nvcc is unable to correctly identify return statements in 'if constexpr' branches....
#define ALPAKA_FN_ACC
All functions that can be used on an accelerator have to be attributed with ALPAKA_FN_ACC or ALPAKA_F...
ALPAKA_FN_HOST_ACC constexpr auto divCeil(Integral a, Integral b) -> Integral
Returns the ceiling of a / b, as integer.
ALPAKA_NO_HOST_ACC_WARNING ALPAKA_FN_HOST_ACC auto min(T const &min_ctx, Tx const &x, Ty const &y)
Returns the smaller of two arguments. NaNs are treated as missing data (between a NaN and a numeric v...
ALPAKA_FN_HOST auto end(TView &view) -> Iterator< TView >
ALPAKA_FN_HOST auto begin(TView &view) -> Iterator< TView >
The alpaka accelerator library.
typename trait::IdxType< T >::type Idx
ALPAKA_NO_HOST_ACC_WARNING ALPAKA_FN_HOST_ACC auto getWorkDiv(TWorkDiv const &workDiv) -> Vec< Dim< TWorkDiv >, Idx< TWorkDiv > >
Get the extent requested.
ALPAKA_NO_HOST_ACC_WARNING ALPAKA_FN_HOST_ACC auto getIdx(TIdx const &idx, TWorkDiv const &workDiv) -> Vec< Dim< TWorkDiv >, Idx< TIdx > >
Get the indices requested.
ALPAKA_FN_ACC auto uniformGroupsAlong(TAcc const &acc, TArgs... args)
ALPAKA_FN_ACC auto uniformGroupElementsAlong(TAcc const &acc, TArgs... args)
ALPAKA_FN_ACC auto uniformElementsAlongZ(TAcc const &acc, TArgs... args)
ALPAKA_FN_ACC auto uniformElements(TAcc const &acc, TArgs... args)
ALPAKA_FN_ACC auto uniformGroupsAlongX(TAcc const &acc, TArgs... args)
ALPAKA_FN_ACC auto uniformGroupElementsAlongX(TAcc const &acc, TArgs... args)
ALPAKA_FN_ACC auto uniformElementsND(TAcc const &acc)
ALPAKA_FN_ACC auto uniformElementsAlongX(TAcc const &acc, TArgs... args)
ALPAKA_NO_HOST_ACC_WARNING ALPAKA_FN_HOST_ACC constexpr auto elementwise_min(Vec< TDim, TVal > const &p, Vecs const &... qs) -> Vec< TDim, TVal >
ALPAKA_FN_ACC auto uniformGroupElementsAlongZ(TAcc const &acc, TArgs... args)
ALPAKA_FN_ACC auto uniformGroupElementsAlongY(TAcc const &acc, TArgs... args)
ALPAKA_FN_ACC auto uniformGroupElements(TAcc const &acc, TArgs... args)
ALPAKA_FN_ACC auto uniformGroupsAlongY(TAcc const &acc, TArgs... args)
ALPAKA_FN_HOST_ACC Vec(TFirstIndex &&, TRestIndices &&...) -> Vec< DimInt< 1+sizeof...(TRestIndices)>, std::decay_t< TFirstIndex > >
typename trait::DimType< T >::type Dim
The dimension type trait alias template to remove the ::type.
ALPAKA_FN_ACC auto uniformGroupsAlongZ(TAcc const &acc, TArgs... args)
ALPAKA_FN_ACC auto uniformElementsAlongY(TAcc const &acc, TArgs... args)
ALPAKA_FN_ACC auto uniformGroups(TAcc const &acc, TArgs... args)
ALPAKA_FN_ACC auto uniformElementsAlong(TAcc const &acc, TArgs... args)