DAAchinmay 1
DAAchinmay 1
By
Bachelor in
COMPUTER ENGINEERING
For Academic Year 2023-2024
has completed the necessary Mini Project work and prepared the report on
Project Guide
Prof.K.V.Metre
Acknowledgement
I take this opportunity to thank all those who have contributed in successful
completionof this Project work. I would like to express my sincere thanks to my Project
Guided by Prof. K. V . Metre, who has encouraged me to work on this project and
guided me wheneverrequired.
We also would like to express our gratitude to our H.O.D. Dr. M. U. Kharat for
givingus opportunities to undertake this project work at Met Institute of engineering,
Nashik.
We are extremely grateful to our Principal Dr. V. P. Wani for his constant
inspiration and keen interest to make the project and presentation absolutely flawless.
At the last but not the least we would like to thank our Teaching staff member,
Workshop staff member, Friends and family member for their timely co-operation and
help.
By
Course Outcome:
1. Introduction 1
2. Objectives 3
3. System Requirement 4
4. Algorithm 5
5. System Overview 6
7. Conclusion 14
8. References 15
Introduction
1
Let's try to understand the matrix multiplication of 3*3 and 3*3 matrices by the figure
given :
We can add, subtract, multiply and divide 2 matrices. To do so, we are taking
input from the user for row number, column number, first matrix elements and second
matrix elements. Then we are performing multiplication on the matrices entered by the
user. In matrix multiplication first matrix one row element is multiplied by second
matrix all column elements.
2
Objectives
speedup.
3
Software/Hardware Requirements
Hardware Requirement:
Processor: Intel (i5, i7, i9)
HDD: Min 32 GB; Recommended 64 GB or more
RAM: Min 1 GB; Recommended 4 GB or above
Software Requirement:
4
Algorithm
Step 1: Start
Step 9: Stop.
5
System overview
6
CODE and OUTPUT
import java.util.Scanner;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
if (colsA != rowsB) {
System.out.println("Matrix multiplication is not possible with these dimensions.");
return;
}
8
startTime = System.nanoTime();
matrixMultiplyMultithreadedRow(matrixA, matrixB, result);
endTime = System.nanoTime();
long rowThreadTime = TimeUnit.NANOSECONDS.toMillis(endTime - startTime);
System.out.println("Matrix multiplication with one thread per row took " +
rowThreadTime + " ms");
9
}
}
}
}
executor.shutdown();
while (!executor.isTerminated()) {
// Wait for all threads to finish
}
}
executor.shutdown();
while (!executor.isTerminated()) {
// Wait for all threads to finish
}
}
OUTPUT:
12
34
11
Enter elements for matrix B:
56
78
19 22
43 50
38 44
86 100
57 66
129 150
Performance comparison:
Single Thread: 0 ms
12
Conclusion
13
References
• https://www.geeksforgeeks.org/multiplication-of-matrix-using-threads/
• https://www.javaprogramto.com/2020/01/java-matrix-multiplication-
threads.html
• https://pocketstudyblog.wordpress.com/2017/09/12/implement-matrix-
multiplication-using-multithreading-application-should-make-use-of-pthread-
create-pthread-join-pthread-exit/
14