Boost logo

Boost :

Subject: [boost] Synchronization (RE: [compute] review)
From: Gruenke,Matt (mgruenke_at_[hidden])
Date: 2014-12-28 19:46:34

-----Original Message-----
From: Boost [mailto:boost-bounces_at_[hidden]] On Behalf Of Kyle Lutz
Sent: Sunday, December 28, 2014 14:42
To: boost_at_[hidden] List
Subject: Re: [boost] [compute] review

>On Sun, Dec 28, 2014 at 1:54 AM, Gruenke,Matt wrote:

>> I agree with other comments made about synchronization. The design should
>> be more explicit about what's asynchronous,

> Like I mentioned before, there is only one method for asynchrony in Boost.Compute,
> the command queue abstraction provided by OpenCL. Operations are enqueued to be
> executed on the compute device and this occurs asynchronously with respect to code
> executing on the host. The exception to this rule are functions which interact
> directly with host-memory which by default are blocking and offer explicit
> "_async()" versions (in order to prevent potential race-conditions on host-memory).

>> Regarding synchronization, I'm a also bit concerned about the performance impact
>> of synchronizing on all copies to host memory. Overuse of synchronization can
>> easily result in performance deterioration. On this point, I think it might be
>> worth limiting host memory usable with algorithms, to containers that perform
>> implicit synchronization to actual use (or destruction) of results. Give users
>> the choice between that or performing explicit copies to raw types.

> To be clear, all copies are not synchronized with host memory.
> Boost.Compute allows both synchronous and asynchronous memory transfers between the
> host and device.

My understanding, based on comments you've made to other reviewers, is that functions like boost::compute::transform() are asynchronous when the result is on the device, but block when the result is on the host. This is what I'm concerned about. Is it true?

>> Also, I agree with Thomas M that it'd be useful for operations to return events.

> All asynchronous operations in the command queue class do return events. One of his
> comments was to also return events from the synchronous methods for consistency and
> I am working on adding this.

Well, what I had in mind was events for higher-order operations, like boost::compute::transform().



This e-mail contains privileged and confidential information intended for the use of the addressees named above. If you are not the intended recipient of this e-mail, you are hereby notified that you must not disseminate, copy or take any action in respect of any information contained in it. If you have received this e-mail in error, please notify the sender immediately by e-mail and immediately destroy this e-mail and its attachments.

Boost list run by bdawes at, gregod at, cpdaniel at, john at