lion03 / thrust

Automatically exported from code.google.com/p/thrust
Apache License 2.0
0 stars 0 forks source link

Discard Output Iterator possible? #229

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I'm using thrust::reduce_by_key to do multiple reduction. However, I don't
need the actual selected keys after the reduction any more (4th parameter), 
they do only cost memory. Now I wonder if the output key iterator is also 
needed by the algorithm or can the output simply be discarded? If so it would 
be nice if there was a "discard output iterator" which does not save the values 
assigned to in order not to waste memory.

Original issue reported on code.google.com by janick.m...@gmail.com on 28 Sep 2010 at 12:30

GoogleCodeExporter commented 8 years ago

Original comment by jaredhoberock on 28 Sep 2010 at 4:19

GoogleCodeExporter commented 8 years ago

Original comment by jaredhoberock on 28 Sep 2010 at 4:19

GoogleCodeExporter commented 8 years ago

Original comment by jaredhoberock on 28 Sep 2010 at 4:19

GoogleCodeExporter commented 8 years ago

Original comment by jaredhoberock on 22 Oct 2010 at 10:09

GoogleCodeExporter commented 8 years ago
I could really use this too.  Not just in reduce_by_key, but also 
remove_copy_if.

Original comment by andrew.c...@gmail.com on 1 Dec 2010 at 8:09

GoogleCodeExporter commented 8 years ago
Why is this useful for remove_copy_if?

Original comment by jaredhoberock on 2 Dec 2010 at 11:36

GoogleCodeExporter commented 8 years ago
I am calling remove_copy_if over a range of tuples.  My pred is get<1>(*i) != 
-1.   If this fails, then I want to write get<0>(*i) the output range, and 
would prefer to just discard get<1>(*i)

Original comment by andrew.c...@gmail.com on 2 Dec 2010 at 11:48

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
and so, I would do this by writing to  
make_zip_iterator(make_tuple(values.begin(), make_discard_iterator()))

Original comment by andrew.c...@gmail.com on 2 Dec 2010 at 11:56

GoogleCodeExporter commented 8 years ago
Makes sense, I hadn't considered making discard_iterator a member of a 
zip_iterator

Original comment by jaredhoberock on 2 Dec 2010 at 11:58

GoogleCodeExporter commented 8 years ago
This issue was closed by revision e78242b754.

Original comment by jaredhoberock on 4 Feb 2011 at 4:04

GoogleCodeExporter commented 8 years ago
Thanks for the patch! I'm going to test it right now, but it already looks 
great!

Original comment by janick.m...@gmail.com on 4 Feb 2011 at 9:15