You are on page 1of 4

Submitted By:

Sohaib Tariq

Reg No:
FA19-BCS-134

Submitted To:
Sir Mateen Yaqoob

Date:
11th July, 2023

Solution:
For 100 x 100:
Matrix Size: 100 x 100
Number of Processes: 2
Sequential Time: 0.0032968521118164062 seconds
Parallel Time: 0.0035009384155273438 seconds
Speedup: 0.94x

========================================
Matrix Size: 100 x 100
Number of Processes: 4
Sequential Time: 9.655952453613281e-05 seconds
Parallel Time: 0.00022459030151367188 seconds
Speedup: 0.43x

========================================
Matrix Size: 100 x 100
Number of Processes: 6
Sequential Time: 9.107589721679688e-05 seconds
Parallel Time: 0.0002148151397705078 seconds
Speedup: 0.42x

========================================
Matrix Size: 100 x 100
Number of Processes: 8
Sequential Time: 0.00010013580322265625 seconds
Parallel Time: 0.0002205371856689453 seconds
Speedup: 0.45x
========================================

For 200 x 200:


Matrix Size: 200 x 200
Number of Processes: 2
Sequential Time: 0.0003714561462402344 seconds
Parallel Time: 0.0009970664978027344 seconds
Speedup: 0.37x

========================================
Matrix Size: 200 x 200
Number of Processes: 4
Sequential Time: 0.0003998279571533203 seconds
Parallel Time: 0.0008080005645751953 seconds
Speedup: 0.49x

========================================
Matrix Size: 200 x 200
Number of Processes: 6
Sequential Time: 0.0003285408020019531 seconds
Parallel Time: 0.0007302761077880859 seconds
Speedup: 0.45x

========================================
Matrix Size: 200 x 200
Number of Processes: 8
Sequential Time: 0.0003390312194824219 seconds
Parallel Time: 0.0007367134094238281 seconds
Speedup: 0.46x

========================================
For 400 x 400:

Matrix Size: 400 x 400


Number of Processes: 2
Sequential Time: 0.002021312713623047 seconds
Parallel Time: 0.005089282989501953 seconds
Speedup: 0.40x

========================================
Matrix Size: 400 x 400
Number of Processes: 4
Sequential Time: 0.0019724369049072266 seconds
Parallel Time: 0.004111289978027344 seconds
Speedup: 0.48x

========================================
Matrix Size: 400 x 400
Number of Processes: 6
Sequential Time: 0.0023033618927001953 seconds
Parallel Time: 0.004493236541748047 seconds
Speedup: 0.51x

========================================
Matrix Size: 400 x 400
Number of Processes: 8
Sequential Time: 0.0019686222076416016 seconds
Parallel Time: 0.0041196346282958984 seconds
Speedup: 0.48x

========================================
For 800 x 800:

Matrix Size: 800 x 800


Number of Processes: 2
Sequential Time: 0.014464855194091797 seconds
Parallel Time: 0.032415151596069336 seconds
Speedup: 0.45x

========================================
Matrix Size: 800 x 800
Number of Processes: 4
Sequential Time: 0.014138221740722656 seconds
Parallel Time: 0.03192615509033203 seconds
Speedup: 0.44x

========================================
Matrix Size: 800 x 800
Number of Processes: 6
Sequential Time: 0.014121532440185547 seconds
Parallel Time: 0.03193306922912598 seconds
Speedup: 0.44x

========================================
Matrix Size: 800 x 800
Number of Processes: 8
Sequential Time: 0.014237403869628906 seconds
Parallel Time: 0.03240251541137695 seconds
Speedup: 0.44x

Comparison of Performance:

Scatter Operation:
The scatter operation (MPI_Scatterv) is used to distribute rows of matrix A among processes. It
divides the rows of the matrix into equal-sized chunks and sends each chunk to a different
process. As the size of the matrix increases, the amount of data sent to each process increases,
which may result in longer scatter times. The performance of the scatter operation depends on
the size of the matrix and the number of processes.
Broadcast Operation:
The broadcast operation (MPI_Bcast) is used to send matrix B from the root process (rank 0) to
all other processes. The root process broadcasts the data to all other processes, and the
performance of the broadcast operation depends on the size of the matrix B. As the size of matrix
B increases, the time required to broadcast the data to all processes may increase. However, the
impact of the broadcast operation on the overall performance may be less significant compared
to the scatter operation since it is a one-time operation.

In general, as the size of the matrix increases, both the scatter and broadcast operations may take
longer. However, the performance of the overall parallel matrix multiplication depends on
various factors such as the algorithm used, the efficiency of matrix multiplication
implementation, the communication overhead, and the hardware configuration.

You might also like