CSCN73000 – Lab5
Parallel Data Processing – First MPI Application
Overview
Lab5 has been designed to give you experience implementing your first multi-threaded program using
Microsoft MPI libraries. The main goal of this lab is to get you to implement a prefix sum (again) and
become familiar with the thought process and communication that MPI provides between threads. The
lab provides you with a starting point and then has two components to be implemented.
This lab will be using Visual Studio, C++11 or greater (C++20 is recommended) and Standard MPI (NOT
BOOST).
PART 1: Prefix Sum Review
You implemented a prefix sum in Lab 4 using OpenMP, so you should be familiar with the how to
calculate a prefix sum. If you need a bit of a refresher, I recommend re-watching the following YouTube
video and reviewing your Lab4 solution.
• https://www.youtube.com/watch?v=lavZl_wEbPE&t=2067s
PART 2: Installing the Microsoft MPI Libraries
Before you begin you will need to download and install the Microsoft MPI libraries on your local Laptop/PC. Goto
the following link and click on “download”
• https://www.microsoft.com/en-us/download/details.aspx?id=100593
Once you click on download a dialog should pop up with the choice to download two files
• msmpisetup.exe
• msmpisdk.msi
You will need to download and install BOTH of these files. The first is the MPI runtime environment and the
second is the software development kit your source will need. Just use all the defaults during the installation
process.
PART 3: Getting Started
There is some starting code for you to work with. Download the “Lab5_Startingpoint.cpp” file from eConestoga
and setup a new Visual Studio Solution/Project that contains the starting point code. This code will compile but
does not produce anything. You will notice there are comments stating where your updates need to go.
Just to review, you should notice the code already provides you with the required MPI calls.
• MPI_Init()
• MPI_Finalize()
The code also creates two variables (taskid and numtask), which are populated using the calls MPI_Comm_rank()
and MPI_Comm_size(). This will help you to see that you are correctly running the MPI Environment.
PART 4: Implementation of Default Array
The source code you have been provided contains a default Original_Array of 10 integer numbers (0-9). Using
blocking MPI calls, design a parallel solution that will calculate a prefix sum using the following requirements:
• Your application design shall use 10 threads
• Each thread shall be responsible for 1 entry in the resulting Prefix_Array.
• Each thread shall calculate the prefix sum for its assigned index in the Prefix_Array
When you are ready to test/debug your code, use a windows console terminal and mpiexec.exe to run your
application. Once complete, take a screenshot of your final output (terminal window only) and upload it into the
box below:
(1)
PART 5: Discussion
Answer the following questions in the text boxes provided.
(1) What data did your send from the Master to Worker? Why?
(2) What data did you send from the Worker to the Master? Why?
(3) Summarize the problems you encountered during development and the process you used to
solve/debug your issues.
Rubric
See eConestoga for details.
In Class Requirement
There is no in-class portion to this lab.
What to Hand In
Once you have completed your lab upload the following files INDIVIDUALLY to eConestoga using the
Lab5_Final submission link:
• A copy of this completed PDF form
• A ZIP file containing your entire solution space.
Please make sure you delete all .vs (Hidden), release and debug directories before you compress and
upload your solution.
请加QQ:99515681 或邮箱:99515681@qq.com WX:codehelp