Home CPSC 425

Lab 6: MPI

 

Objective

To get experience writing multi-process programs with MPI.


 

Task

For this lab, you will write an MPI version of the Pi estimator program.

You can start with your version from lab 1, or use my version here.


 

Details

To complete the lab, you will need to:
  1. Add in code to set the random seed to the process rank (using srand). This will ensure each process has its own random numbers.
  2. Have each process send its estimate of Pi to process 0.
  3. Have process 0 receive each estimate and average them.
  4. Have process 0 print the final answer.
  5. Have each process still do the same number of tosses. The program won't speed up, but should be more accurate.
  6. Compile and run your program to ensure that it works.

 

Submitting

When you're finished, submit the source code to Canvas.

Copyright © 2024 Ian Finlayson | Licensed under a Creative Commons BY-NC-SA 4.0 License.