Questions tagged [boost-compute]

Boost.Compute is a GPU/parallel-computing library for C++ based on OpenCL with STL-like interface.

The core library is a thin C++ wrapper over the OpenCL API and provides access to compute devices, contexts, command queues and memory buffers. On top of the core library is a generic, STL-like interface providing common algorithms (e.g. transform(), accumulate(), sort()) along with common containers (e.g. vector<T>, flat_set<T>). It also features a number of extensions including parallel-computing algorithms (e.g. exclusive_scan(), scatter(), reduce()) and a number of fancy iterators (e.g. transform_iterator<>, permutation_iterator<>, zip_iterator<>)

More information on Boost.Compute can be found here:

Notable alternatives for Boost.Compute:

31 questions
42
votes
1 answer

Differences between VexCL, Thrust, and Boost.Compute

With a just a cursory understanding of these libraries, they look to be very similar. I know that VexCL and Boost.Compute use OpenCl as a backend (although the v1.0 release VexCL also supports CUDA as a backend) and Thrust uses CUDA. Aside from the…
Sean Lynch
  • 2,852
  • 4
  • 32
  • 46
9
votes
2 answers

Performance: boost.compute v.s. opencl c++ wrapper

The following codes add two vectors using boost.compute and opencl c++ wrapper respectively. The result shows boost.compute is almost 20 times slower than the opencl c++ wrapper. I wonder if I miss use boost.compute or it is indeed slow. Platform:…
cqdjyy01234
  • 1,180
  • 10
  • 20
7
votes
1 answer

OpenCL: Is possible to use templated objects as kernel arguments with Boost::compute?

The function signature of my kernel is as follows: template< size_t S, typename Field, typename Type1, typename Type2> void kernel(const Type1 arg1, const Type2 arg2, Field *results) { // S is known at compile time // Field might be float or…
user3116936
  • 492
  • 3
  • 21
7
votes
3 answers

Boost.Compute slower than plain CPU?

I just started to play with Boost.Compute, to see how much speed it can bring to us, I wrote a simple program: #include #include #include #include #include #include…
Jamboree
  • 5,139
  • 2
  • 16
  • 36
6
votes
1 answer

How to call boost_compute 'BOOST_COMPUTE_FUNCTION' defined function?

I'm currently exploring boost_compute. Unfortunately there are less documentation pages and examples, than I need to understand what to do. Given the following minified code: BOOST_COMPUTE_FUNCTION(bool, add, (int* values, int* results, int…
infotoni91
  • 722
  • 3
  • 13
4
votes
1 answer

Memory copy speed comparison CPU<->GPU

I am now learning boost::compute openCL wrapper library. I am experiencing very slow copy procedure. If we scale CPU to CPU copy speed as 1, how fast is GPU to CPU, GPU to GPU, CPU to GPU copy? I don't require precise numbers. Just a general idea…
Zeta
  • 913
  • 10
  • 24
3
votes
1 answer

boost::compute copy custom structures

Is it possible to copy arrays of custom structures using boost::compute? E.g. struct A { float a; }; struct AB { float a; float b; }; BOOST_COMPUTE_ADAPT_STRUCT(A, A, (a)) BOOST_COMPUTE_ADAPT_STRUCT(AB, AB, (a, b)) boost::compute::vector
DikobrAz
  • 3,557
  • 4
  • 35
  • 53
3
votes
1 answer

Call of boost::compute::sort() with zip iterators delivers build errors

I have a problem building a program that makes use of the Boost.Compute library. I use two zip_iterators consisting out of a tuple of two float iterators each to sort two float-vectors with the boost::compute::sort() function. My code (both…
Miray
  • 31
  • 3
2
votes
1 answer

boost::compute stream compaction

How to do stream compaction with boost::compute? E.g. if you want to perform heavy operation only on certain elements in the array. First you generate mask array with ones corresponding to elements for which you want to perform operation: mask = [0…
DikobrAz
  • 3,557
  • 4
  • 35
  • 53
2
votes
1 answer

Does boost::compute support const modifiers?

Is it possible to set which function arguments have 'global' or 'const' modifiers? Or how at least to inspect the code of generated function on a per function basis (to insert it manually)? Closest thing I saw was BOOST_COMPUTE_STRINGIZE_SOURCE…
DuckQueen
  • 772
  • 10
  • 62
  • 134
1
vote
0 answers

Using ArrayFire and Boost Compute in single code

I am trying to run a code which uses functions from both boost compute library and arrayfire library. I am getting the following errors when I try to build the code: Scanning dependencies of target hello [ 50%] Building CXX object…
1
vote
0 answers

Accumulating complex number in C++ using boost compute lib

I want to accumulate complex numbers in boost.compute library, but I face compile error when I run the below code. I am using boost 1.65.0 P.S: the code is incomplete. I just summarize it to show the compile error. #include…
1
vote
2 answers

Problem in choosing best available GPU using openCL programmatically

I'm using the advice given here for choosing an optimal GPU for my algorithm. https://stackoverflow.com/a/33488953/5371117 I query the devices on my MacBook Pro using boost::compute::system::devices(); which returns me following list of…
1
vote
1 answer

How can I avoid the boost::compute::zip_iterator and boost::iterators::zip_iterator confict when using boost compute and boost::range together?

I'd like to use boost::compute and boost::range together, like below, but if I uncomment the #include line I get an error saying that boost::compute::zip_iterator and boost::iterators::zip_iterator are ambiguous. Is there a…
1
vote
1 answer

Generate boost::uuids::uuid from boost::compute::detail::sha1

I am trying to generate boost::uuids::uuid from boost::compute::detail::sha1 in this way: #include #include "boost/uuid/uuid.hpp" #include "boost/uuid/uuid_io.hpp" #include "boost/uuid/string_generator.hpp" #include…
definename
  • 193
  • 1
  • 12
1
2 3