NPRG058: Advanced Programming in Parallel Environment

Lab practice 09 - MPI Collective communication

Please, login to parlab (there is no need for GPUs today). Open the code that computes minimum (that you wrote last week). The expected solution was that each process finds minimum in its local array, sends it to rank #0, and rank #0 computes the global minimum.

  1. Replace manual reduction at rank #0 with collective reduction.
  2. Generating data at individual processes is somewhat odd, let's do this properly. Generate the data at rank #0 and distribute them evenly across other processes using collective communication routines (it might be a good idea to keep a chunk at rank #0 as well) before the min-search.

Stretch goal: Find the index of the minimal value as well. Note that the index must be valid in the original dataset from rank #0. If there are multiple min values, report the first one.

Stretch goal 2: Replace the collective communication used in data distribution (step 2) with one-sided RMA transfers. Let each process (except rank #0) get their own data (rank #0 exposes the entire input array as window).