Often threads need to coordinate so that one thread may share a value with the other threads, or so that a number of threads can concatenate subvectors into one vector. Both of these operations are instances of a function we call gather, which is a parallel-prefix concatenation operation which is a member of the HPC++ Collective class.

The gather operation allows each thread to contribute a vector of data of arbitrary size and returns the vector of concatenated subvectors (whose size is given by the value the reference parameter size when the call completes). (A broadcast is simply the special case where all but one thread contributes a vector of length 0.)

Class Definition

template <class T>
class HPCxx_Collective{
   HPCxx_Collective(HPCxx_Group *g);
   T * gather(int threadKey, T* thread_data, int &size);


Last modified: Thu Apr 22 02:09:17 EST 1999