Boost logo

Boost :

Subject: Re: [boost] [Boost-users] Boost.Compute v0.1 Released
From: Gonzalo BG (gonzalobg88_at_[hidden])
Date: 2014-03-17 08:17:29

> Is it possible to use ordinary C++ functions/functors or C++11 lambdas
> with Boost.Compute?<>
> Unfortunately no. OpenCL relies on having C99 source code available at
> run-time in order to execute code on the GPU. Thus compiled C++ functions
> or C++11 lambdas cannot simply be passed to the OpenCL environment to be
> executed on the GPU.
> This is the reason why I wrote the Boost.Compute lambda library. Basically
> it takes C++ lambda expressions (e.g. _1 * sqrt(_1) + 4) and transforms
> them into C99 source code fragments (e.g. “input[i] * sqrt(input[i]) + 4)”)
> which are then passed to the Boost.Compute STL-style algorithms for
> execution. While not perfect, it allows the user to write code closer to
> C++ that still can be executed through OpenCL.
> Also check out the BOOST_COMPUTE_FUNCTION() macro which allows OpenCL
> functions to be defined inline with C++ code. An example can be found in
> the monte_carlo example code.

I find this to be a serious (killer) downside.

Are there any examples/FAQ about launching kernels that call member
functions or about using Boost.Compute within class hierarchies?
Even a minimal example where the data is a class member e.g. vector and the
kernel uses one or two member functions would be very much appreciated.

The std proposal for a parallel algorithms library, TBB, C++AMP, and Thrust
seem to be a better fit for a "C++ interface to multi-core CPU and GPGPU
computing platforms" than any OpenCL based library I've seen (OpenCL, Bolt,
VexCL, Boost.Compute). OpenCL and C++ seem to not be made for each other.
OpenCL is just FUBAR without extra compiler support like C++AMP or OpenACC.
On Monday, March 17, 2014 1:03:57 AM UTC+1, Kyle Lutz wrote:
> I'm proud to announce the initial release (version 0.1) of
> Boost.Compute! It is available on GitHub [1] and instructions for
> using the library can be found in the documentation [2].
> Boost.Compute is a GPGPU and parallel-programming library based on
> OpenCL. It provides an STL-like API and implements many common
> containers (e.g. vector<T>, array<T, N>) as well as many common
> algorithms (e.g. sort(), accumulate(), transform()). A full list can
> be found in the header reference [3].
> I hope to propose Boost.Compute for review in the next few months but
> for I'm looking for more wide-spread testing and feedback from the
> Boost community (please note the FAQ [4] and design rationale [5]
> where I hope to have answered some common questions).
> Thanks,
> Kyle
> [1]
> [2]
> [3]
> [4]
> [5]
> _______________________________________________
> Boost-users mailing list
> Boost..._at_[hidden] <javascript:>

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