2
OpenMP code:
• void a7( float *x, int *y, int n ) {
  float a = 0.0;
  int b = 0, i;
•   #pragma omp parallel for reduction(+:a) reduction(^:b)
  for( i=0; i<n; i++ ) {
    a += x[i];
    b ^= y[i];
  }
}
Concur code:
• void a7( vector<float> &x, vector<int> &y ) {
  float a = paccumulate( x, 0.0, _1 + _2 );
  int b = paccumulate( y, 0, _1 ^ _2 );
}
•Also, may get better cache performance by going through one collection and then the other. (The original code may have bad cache behavior unless x and y are related in some way.)
Example: Parallel Array Update
template< class Container, class T, class Op >
T paccumulate( Container c, T init, Op op ) {
  vector< future<T> > workers =

    active for each( T t in c )                   // spawn
      init = op( init, *i );
  return accumulate( workers, init, { op( _1, _2.init.wait() ) } );     // gather
}

template< class Container, class T, class Op >
T paccumulate( Container c, T init, Op op ) {
  vector< future<T> > workers;
  int num = distance( c.begin(), c.end() );

  for( int worker = 0; worker < get_workers(); ++worker )
    workers.push_back( active {                 // spawn

      return accumulate( c.begin() + worker/num, c.begin() + (worker+1)/num, op, 0 );
    } );
  return accumulate( workers, init, { op( _1, _2.init.wait() ) } );     // gather
}