wiki:CommonHelperFunctionsForDifferentParallelLanguage

For the reason of trying not to be interfered with predefined constants in programs, I propose to add a prefix for all operations. (I use COP_ as prefixes for a temporary use. COP stands for CIVL OPERATION.)

Collective operations are being used by several parallel language like MPI or openMP

// Operation for collective reductions or collective operations
typedef enum {
  COP_NO_OP,  // no operation
  COP_MAX,    // maxinum
  COP_MIN,    // minimun
  COP_SUM,    // sum
  COP_PROD,   // product
  COP_LAND,   // logical and
  COP_BAND,   // bit-wise and
  COP_LOR,    // logical or
  COP_BOR,    // bit-wise or
  COP_LXOR,   // logical exclusive or
  COP_BXOR,   // bit-wise exclusive or
  COP_MINLOC, // min value and location
  COP_MAXLOC, // max value and location
  COP_REPLACE // replace ? TODO: Find definition for this operation
}$operation;

An system function being responsible for doing the operation will be much helpful for implementing collective function like "MPI_Reduce()".

/* Unpacks the bundle type data and applays the specified operations on that data.
   For every binary operarions defined in &operation, data will be used as the left operand and 
   buf will be used as right operand and input and ouput argument. The value of buf as an input
   argument provides operands for this operation. Finally buf is also an output argument. The 
   argument "count" stands for the number of elements participating the operation.
*/
void $bundle_unpack_apply($bundle data, void *buf, int count, $operation op);
Last modified 12 years ago Last modified on 08/28/14 17:02:50
Note: See TracWiki for help on using the wiki.