CS471: Parallel Processing Assignment-1 Solution



1.      This assignment is individual.

2.      Deadline is 14 March 2020.

3.      Upload it on Acadox with file named “A1_YourName_YourID_G#.c” else it will not be accepted. eg.1 A1_ahmed_2013000_CS_DS_1.c eg.2 A1_ahmed_2013000_CS_1.c



Matrix Multiplication:  


Write a matrix multiplication program. Matrices’ dimensions and values are taken as an input from user. Multiply the two matrices together then print the result to the console. 


Note: Must use dynamic allocation.  




Welcome to Matrix multiplication program! 


Please enter dimensions of the first matrix: 3 2 


Please enter its elements: 

1 2 

5 8 

1 5 


Please enter dimensions of the second matrix: 2 2 


Please enter its elements: 

6 8 

10 30 


Result Matrix is ( 3 x 2): 


26    68  110 

180  56  158 


You will develop a parallel program of “The matrix Multiplication” using the Master-Slave Paradigm.



1.      Use send and receive to distribute the work on slaves.

Example for a parallel scenario (use the scenario you find suitable):

a.       Divide rows of 1st matrix across slaves and send to them the complete 2nd matrix.

b.      Divide rows of 1st matrix and columns of 2nd matrix across slaves.

2.      Handle the remainder workload with any scenario you find suitable.

3.      Matrix input is taken from the user.

4.      Check if the two matrices can be multiplied first. 


Grading Criteria
Reading input from console
Using Dynamic Arrays
Master process: Distribution of Arrays across slaves
Master process: Collecting result from slaves and display result
Slave work: Partial Matrix multiplication
Handling remaining workload (any scenario accepted)
Running and valid output