Skip to content

Optimise time taken to read and multiply two matrices from files using multithreading and round robin scheduling

Notifications You must be signed in to change notification settings

kishank12312/Multithreaded-RR-Scheduler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multithreaded Round Robin Scheduler For Matrix Multiplication

This project aims to optimize an I/O and calculation heavy task such as matrix multiplication by the use of multithreading and round robin scheduling between the script reading the matrices and the one performing the calculation. Implemented in C

Usage

  • Run MatrixGen.py to create two random matrices
    • Usage: python3 MatrixGen.py <A> <B> <C> where A,B,C are positive integers
    • This creates 2 random matrices, the first one of size AxB stored in in1.txt, and the second one of size BxC stored in in2.txt.
    • It also creates the expected output of the multiplication of these matrices and stores the result in matrixres.txt
  • Run transpose.py to transpose the 2nd matrix for simplification of calculation
    • Usage: python3 transpose.py
  • Update the run.sh file's 5th line
    • Usage: time ./c <A> <B> <C> <input_file1> <input_file2> <output_file> where A, B and C are the same dimensions as above. input_file1, input_file2 and output_file can be left as is.
  • Run the above bash file. Output will be generated in the output file specified above.

We can see a significant improvement in overall time taken, especially on large improvements. Graphs about waiting times, turn around times, time taken to read/compute the inputs vs number of threads is present in Images folder. The data for the same is in CSVs folder.

Normally 1e9 sized input takes little more than 10 minutes. However we were able to run it totally in around 0.8 seconds. This is a huge improvement in performance.

About

Optimise time taken to read and multiply two matrices from files using multithreading and round robin scheduling

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published