There's more...

Note that with the op=MPI.SUM option, we apply the sum operation to all the elements of the column array. To better understand how the reduction operates, let's look at the following diagram:

Reduction in collective communication

The sending operation is as follows:

  • The P0 process sends the [0 1 2data array.
  • The P1 process sends the [0 2 4data array.
  • The P2 process sends the [0 3 6] data array.

The reduction operation sums the ith elements of each task and then puts the result in the ith element of the array in the P0 root process. For the receiving operation, the P0 process receives the [0 6 12data array.

Some of the reduction operations defined by MPI are as follows:

  • MPI.MAX: This returns the maximum element.
  • MPI.MIN: This returns the minimum element.
  • MPI.SUM: This sums up the elements.
  • MPI.PROD: This multiplies all elements.
  • MPI.LAND: This performs the AND logical operation across the elements.
  • MPI.MAXLOC: This returns the maximum value and the rank of the process that owns it.
  • MPI.MINLOC: This returns the minimum value and the rank of the process that owns it.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.216.229