Question
Task List: 01) write a main method that will initialise MPI, figure out the world rank and world size. Rank 0 should be the coordinator
Task List:
01) write a main method that will initialise MPI, figure out the world rank and world size. Rank 0 should be the coordinator while all other ranks should be participants. Then finalise MPI and return a status of 0 to the OS (5%)
02) Add the following helper methods to your code (15%) printMatrix() will print a 2D matrix to the console dotProduct() will that multiply a row of matrix A with a column from matrix B that will return a single value that is the dot product of the row and column multiplyStripe() takes in a stripe of A, a matrix of B and computes a stripe of C.
03) Write coordinator and participant methods that perform the following interactions (80%) read in matrices A and B from disk. (coordinator only) broadcast a message stating that the computation will be performed if the matrices are present and correct and that we have the correct number of command line arguments. Give a different message otherwise. Take part in multiple broadcasts that will tell all nodes the size of a matrix, the size of a stripe and the size of an individual row. Allocate the necessary memory for the stripes and matrices required. Take part in a scatter to distribute the stripes of A and take part in a broadcast to get the full copy of B. perform the multiplication and take part in a gather to send all stripes of C back to the coordinator. print out the matrix (coordinator only) and deallocate all memory.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started