| | 1 | Collective operations are being used by several parallel language like MPI or openMP |
| | 2 | {{{ |
| | 3 | // Operation for collective reductions or collective operations |
| | 4 | typedef enum { |
| | 5 | NO_OP, // no operation |
| | 6 | MAX, // maxinum |
| | 7 | MIN, // minimun |
| | 8 | SUM, // sum |
| | 9 | PROD, // product |
| | 10 | LAND, // logical and |
| | 11 | BAND, // bit-wise and |
| | 12 | LOR, // logical or |
| | 13 | BOR, // bit-wise or |
| | 14 | LXOR, // logical exclusive or |
| | 15 | BXOR, // bit-wise exclusive or |
| | 16 | MINLOC, // min value and location |
| | 17 | MAXLOC, // max value and location |
| | 18 | REPLACE // replace ? TODO: Find definition for this operation |
| | 19 | }$operation; |
| | 20 | }}} |
| | 21 | |
| | 22 | An system function being responsible for doing the operation will be much helpful for implementing collective function like "MPI_Reduce()". |
| | 23 | {{{ |
| | 24 | /* Unpacks the bundle type data and applays the specified operations on that data. |
| | 25 | For every binary operarions defined in &operation, data will be used as the left operand and |
| | 26 | buf will be used as right operand and input and ouput argument. The value of buf as an input |
| | 27 | argument will always be the result got from the very last operation. Finally buf is also an output argument. |
| | 28 | */ |
| | 29 | void $bundle_unpack_apply(void *data, void *buf, $operation op); |
| | 30 | }}} |