|
Boost Users : |
Subject: Re: [Boost-users] Boost.Compute v0.1 Released
From: Gonzalo BG (gonzalobg88_at_[hidden])
Date: 2014-03-17 08:22:18
>
> 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 [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] https://github.com/kylelutz/compute
> [2] http://kylelutz.github.io/compute/
> [3] http://kylelutz.github.io/compute/compute/reference.html
> [4] http://kylelutz.github.io/compute/boost_compute/faq.html
> [5] http://kylelutz.github.io/compute/boost_compute/design.html
> _______________________________________________
> Boost-users mailing list
> Boost..._at_[hidden] <javascript:>
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net