Introduction to Parallel Computing by Roman Trobec & Boštjan Slivnik & Patricio Bulić & Borut Robič

Introduction to Parallel Computing by Roman Trobec & Boštjan Slivnik & Patricio Bulić & Borut Robič

Author:Roman Trobec & Boštjan Slivnik & Patricio Bulić & Borut Robič
Language: eng
Format: epub
ISBN: 9783319988337
Publisher: Springer International Publishing


MPI_SUM, MPI_PROD; return either sum or product of aligned data items;

MPI_LAND, MPI_LOR, MPI_BAND, MPI_BOR; return logical or bitwise AND or OR operation across the data items;

MPI_MAXLOC, MPI_MINLOC; return the maximum or minimum value and the rank of the process that owns it;

The MPI library enables to define custom reduction operations, which could be interesting for advanced readers (see references in Sect. 4.10 for details).

The MPI operation that implements all kind of data reductions is

MPI_REDUCE (inbuf, , count, type, op, root, comm).

The MPI_REDUCE operation implements manipulation op on matching data items in input buffer inbuf from all processes in the communicator comm. The results of the manipulation are stored in the output buffer of process root. The functionality of MPI_REDUCE is in fact an MPI_GATHER followed by manipulation op in process root. Reduce operations are implemented on a per-element basis, i.e., ith elements from each process’ inbuf are combined into the ith element in outbuf of process root.

A schematic presentation of the MPI_REDUCE functionality before and after the call:

MPI_REDUCE (inbuf,outbuf, 2,MPI_INT, MPI_SUM, 0,MPI_COMM_WORLD)

is shown in Fig. 4.7. Before the call, inbuf of three processes with ranks 0, 1, and 2 were: {5, 1}, {3, 2}, and {7, 6}, respectively. After the call to the MPI_REDUCE the value in outbuf of root process is {15, 9}.

Fig. 4.7Root process collects the data from input buffers of all processes, performs per-element MPI_SUM manipulation, and saves the result in its output buffer



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.