Starting from:
$25

$19

Assignment 2: Matrix Multiplication using MPI

Instructions to compile and execute the matrix multiplication code:

    1. Upload both the files (mpi_mm.c and mpi.grace_job) to your scratch directory after logging into grace portal.
    2. Open the current directory in the terminal using the “Open in terminal” option on the top.

    3. Authenticate using your net id’s password and duo-2 factor authentication.

    4. Load the module using the following command:

module load intel/2020b

    5. Compile the source file using the following command: mpiicc -o mpi_mm.exe mpi_mm.c

    6. Change the number of processes and size of matrices at line 22 of mpi.grace_job file:

mpirun -np <n> ./mpi_mm.exe <s>    (n: #processes, s: size of matrices)

    7. Run the batch file using the following command: sbatch mpi.grace_job

    8. After a job is complete, you’ll be able to see the output in the output file corresponding to your jobid in the same directory as the source code.
(You’ll be able to find out whether a recent job has been completed or not by going to: grace dashboard > jobs > active jobs)


Assignment:

    • Use MPI_Reduce to calculate the minimum, maximum and the average runtime taken by the “receiving” part, the “calculation” part, and the “sending” part of the worker processes. Plot minimum time, maximum time and average time as functions of the number of processes where the number of processes will vary between {2, 4, 8, 16, 32, 64}. (You may plot all the three times:- min, max, avg on a single graph with different colors)
        ◦ There will be different plots for :

■  Matrices of size 100x100
[10 points]

Matrices of size 1,000x1,000
[10 points]

Matrices of size 10,000x10,000
[10 points]
○  Correctness of the code changes
[20 points]
    • Similarly, in the master process, compute the runtime for the “whole computation”, for the “initialization” part, and for the “sending and receiving” part and plot graphs for initialization time, send/receive time, and total time vs number of processes where the number of processes will vary between {2, 4, 8, 16, 32, 64}.
        ◦ There will be different plots for :

■  Matrices of size 100x100
[10 points]

Matrices of size 1000x1000
[10 points]

Matrices of size 10,000x10,000
[10 points]
    • Write down your observations on the variation of runtimes with the number of processes

for various matrix sizes.    [20 points]



Upload a .zip file on canvas containing:

    • A pdf with your answers.

    • mpi_mm.c file with your code changes.

More products