Skip to content

Computing the vector-vector multiplication on p processors using block-striped partitioning for uniform data distribution. Assuming that the vectors are of size n and p is the number of processors used and n is a multiple of p.

Notifications You must be signed in to change notification settings

Amagnum/Parallel-Dot-Product-of-2-vectors-MPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Dot Product of 2 Vectors using MPI C++ | Multiprocessing | Parallel Computing

MPI code for computing the dot product of vectors on p processors using block-striped partitioning for uniform data distribution.

Assuming that the vectors are of size n and p is number of processors used and n is a multiple of p.

Algebraically, the dot product is the sum of the products of the corresponding entries of the two sequences of numbers.

Let vector A be

[ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ]

Let vector B be

[ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ]

Output:

[ 1.0 + 4.0 + 9.0 + 16.0 + 25.0 + 36.0 + 49.0 + 64.0 ] = 204.0

Partition Approach

alt approach


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

Computing the vector-vector multiplication on p processors using block-striped partitioning for uniform data distribution. Assuming that the vectors are of size n and p is the number of processors used and n is a multiple of p.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages