Open cdeterman opened 6 years ago
I think it only exists as an example: https://github.com/thrust/thrust/blob/master/examples/strided_range.cu
@henryiii thanks, I wonder why it hasn't been formally added in to thrust. Any additional thoughts regarding the 'padding' problem?
This falls into the broader category of "multi-dimensional" support, I think, although a skip iterator could be useful for a linear sequence.
We don't have a firm design for what we're going to do in this space. But, I imagine we'll eventually want a family of strided iterators.
Note, however, that traditionally such iterators have all sorts of performance problems.
SEE ALSO: https://www.youtube.com/watch?v=EVGenON6p9g SEE ALSO: https://github.com/brycelelbach/mditerator SEE ALSO: https://github.com/brycelelbach/mdspan SEE ALSO: wg21.link/P0009
@brycelelbach @allisonvacanti there have been several times where I've wanted something very simple like this for linear sequences. I don't think we need a full on md-span or multi-dimensional iterator for something this simple. Similarly, I've wanted a counting_iterator
that takes a "step" value.
I imagine these would look something like this:
template <typename InputIterator, typename Stride>
auto make_strided_iterator(InputIterator it, Stride stride);
template <typename Incrementable>
auto make_counting_iterator(Incremenetable begin, Incrementable step);
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1899r0.pdf
Equivalent for ranges.
Is there anything equivalent in Thrust that corresponds to the
strided_iterator
found in boost compute? On the same topic of operating on specific elements of a buffer, is there a way to operator on 'padded' objects? Note, I also have this same question posted in boost compute For example, take the row-wise padded matrix:So the internal flat buffer would be
As an example, how could I use
sort
on just the 'non-padded' elements?Likewise, the column wise may also be padded (less common but might as well include here)