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?<http://kylelutz.github.io/compute/boost_compute/faq.html#boost_compute.faq.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  and instructions for
> using the library can be found in the documentation .
> 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 .
> 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  and design rationale 
> where I hope to have answered some common questions).
>  https://github.com/kylelutz/compute
>  http://kylelutz.github.io/compute/
>  http://kylelutz.github.io/compute/compute/reference.html
>  http://kylelutz.github.io/compute/boost_compute/faq.html
>  http://kylelutz.github.io/compute/boost_compute/design.html
> Boost-users mailing list
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk