Git Product home page Git Product logo

parallelmatrixmultiplier's Introduction

Parallel Matrix Multiplier

The program is a part of an assignment for the CS F372 - Operating System course of BITS Pilani, Hyderabad Campus.
The objective of the assignment was to multiply arbitrarily large matrices using parallelism provided by the Linux process and threads libraries.

Problem Statement

  1. Write a C program reader which takes three filenames (in1.txt, in2.txt and out.txt) as command line arguments. The first two files (in1.txt and in2.txt) contain two matrices of arbitrary size but satisfying the criteria for matrix multiplication. The sizes will be passed in the command line. reader spawns n threads which each read row(s) and column(s) each from in1.txt and in2.txt.

    1. Different threads should read different parts of the file. Vary the number of threads from 1… to arbitrarily large.
    2. Record the time that it takes to read the entire file into memory with different number of threads (1, 2, … n). The timing should be at the granularity of nanoseconds.
    3. Plot time against the number of threads for different input sizes. Analyse the findings from the plots.
  2. Write a C program (multiplier) which uses IPC mechanisms to receive the rows and columns read by reader. multiplier spawns multiple threads to compute the cells in the product matrix. The program stores the product matrix in the file out.txt

    1. Vary the number of threads from 1… to arbitrarily large.
    2. Record the time it takes to compute the product with different number of threads. The timing should be at the granularity of nanoseconds.
    3. Plot the time against the number of threads for different input sizes. Analyse the findings from the plots.
  3. Write a scheduler program scheduler. scheduler spawns 2 children processes which exec to become the processes reader and multiplier. scheduler uses some mechanism to simulate a uniprocessor scheduler. That is, it suspends reader and lets multiplier execute, and vice versa. Simulate the following scheduling algorithms in scheduler:

    1. Round Robin with time quantum 2 ms.
    2. Round Robin with time quantum 1 ms.

Running the Program

  1. Place the input 1 and input 2 txt files in the folder.

  2. Run the following in the terminal:

    gcc -o P1.out -pthread reader.c
    gcc -o P2.out -pthread multiplier.c
    gcc -o S.out -pthread scheduler.c
    ./S.out <I> <J> <K> <in1.txt> <in2.txt> <out.txt>
    
  3. The matrix product will be printed in the output file name provided.

Group Members

parallelmatrixmultiplier's People

Contributors

code-r57 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.