Boost logo

Boost :

Subject: Re: [boost] [compute] Review
From: John Bytheway (jbytheway+boost_at_[hidden])
Date: 2014-12-31 08:52:32


On 2014-12-30 23:41, Kyle Lutz wrote:
> On Tue, Dec 30, 2014 at 6:23 PM, John Bytheway
> <jbytheway+boost_at_[hidden]> wrote:
>> On 2014-12-29 02:01, Kyle Lutz wrote:
>>> On Sun, Dec 28, 2014 at 7:26 PM, John Bytheway
>>> <jbytheway+boost_at_[hidden]> wrote:
>>>> - Why does reduce return its result through an OutputIterator?
>>>
>>> In order to allow the algorithm to store the result in device memory
>>> and avoid a host-device synchronization point (which would be
>>> necessary if it simply returned the reduced result).
>>
>> That makes sense, but seems inconsistent with accumulate, and to a
>> lesser extent the algorithms that return bool (binary_search, equal,
>> etc.) Are they all introducing a synchronization point? What about the
>> ones returning iterators?
>
> Yeah, algorithms like accumulate() which return the resulting value on
> the host are synchronization points. Others like transform() which
> return an iterator do not because the returned iterator is not
> actually the "result" of the operation and can be calculated and
> returned before the operation is actually complete.

That's true of transform, but not for most algorithms returning an
iterator, surely. How would you do this with find, or set_intersection?

John


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk