MPI Quiz Practice

Download the shell practice quize program, quizprac.c

  1. Enter a number in process 0, for example 3
  2. Each process finds the sum of rank*number + 1 through (rank+1)*number - Example, process 0 finds 1+2+3; process 1 finds 4+5+6; process 2 finds 7+8+9; etc.
  3. Use MPI_Reduce and MPI_PROD to find the product of all of these sums - Example, 6*15*24 = 2160
  4. Process 0 prints the result (2160).
  5. This example shell program uses a while loop that repeats until the user enters a 0
  6. More examples:
      Number = 4, numprocesses = 3
        Rank 0: 1+2+3+4
        Rank 1: 5+6+7+8
        Rank 2: 9+10+11+12
    
        MPI_Reduce and MPI_PROD calculates: 10*26*42=10920
    
      Number = 4, numprocesses = 4
        Rank 0: 1+2+3+4
        Rank 1: 5+6+7+8
        Rank 2: 9+10+11+12
        Rank 3: 13+14+15+16
    
        MPI_Reduce and MPI_PROD calculates: 10*26*42*58=633360