Skip to content

A simple MPI program to compute the matrix matrix multiplication. Splitting the matrix A rowwise, and distribute it to different processes. Comparing the runtime using 1, 2 and 4 processors.

Notifications You must be signed in to change notification settings

Amagnum/Parallel-matrix-matrix-multiplication-MPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Matrix-matrix-multiplication-MPI

A simple MPI program to compute the matrix matrix multiplication. Splitting the matrix A rowwise, and distribute it to different processes. Comparing the runtime using 1, 2 and 4 processors.

C++ code for matrix multiplication

    int i, j, k;
    for (i = 0; i < N; i++) {
        for (j = 0; j < N; j++) {
            res[i][j] = 0;
            for (k = 0; k < N; k++)
                res[i][j] += mat1[i][k] * mat2[k][j];
        }
    }

Results:

Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
CPU(s): 8
Thread(s) per core: 2
alt approach

Compile & run the code:

$ mpic++ main.cpp -o exc
$ mpirun -np 4 exc

REFERENCES

  1. Chandresh Kumar Maurya, Assisant professor, IIT Indore link
  2. Advanced Message Passing in MPI, Using MPI Datatypes with Opaque C++ Types, Paul Preney pdf link

About

A simple MPI program to compute the matrix matrix multiplication. Splitting the matrix A rowwise, and distribute it to different processes. Comparing the runtime using 1, 2 and 4 processors.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages