11

So far, I'm aware of the Mars, though what about alternatives?

Nikita Zhiltsov
  • 654
  • 9
  • 15

2 Answers2

6

At present, the easiest interface is provided by thrust::reduce.

As you noted, there is also Mars.

alfC
  • 14,261
  • 4
  • 67
  • 118
M. Tibbits
  • 8,400
  • 8
  • 44
  • 59
  • 3
    What thrust::reduce does is not what I'd call map-reduce. thrust::reduce is the reduce function found in many functional programming contexts that turns a sequence, a starting value, and a binary operation into a single value. In Scala, it's called "foldLeft" or "foldRight" but in most functional programming languages it's called "reduce". The reduce stage of a map-reduce algorithm performs some operation on a set of values associated with a key, but this operation is not necessary binary and doesn't necessarily turn the sequence into a single value. – Jim Pivarski Jun 26 '13 at 00:41
1

Years ago I have implemented cumar.

As I was using Mac OS X and 'nvcc' compiler was not happy with Apple's 'clang', I designed this library pure C++ ( and a flavor of lambda ).

A typical map operation looks like this:

//A = B + C, all of length 'n'
cumar::map()("[](double a&, double b, double c){ a = b+c; }" )(A, A+n, B, C);

For reduce operation, it looks like this:

// x = min(A), A of size 'n'
cumar::reduce()( "[](double a, double b){ return a < b ? a : b; }" )(A, A+n);
Feng Wang
  • 1,506
  • 15
  • 17