Giter Club home page Giter Club logo

open-mpi-ds's Introduction

Question 1 - QuickSort using MPI

Brief - Suppose, There are N no of processes to run on some given input array. The first process will find the parition the array based on selected pivot and generate 2 sub-array left and right. The left partion it will keep and based on availability of other processes will give the other partition to some other process. This will continue then the final result is sent back at the first process.

Analyis -

  • The running time complexity of algorithm is nlogn.
  • When the number of processes is kept fixed, the running time of the process increased when the size of input is increased.
  • When the size of input is kept fixed, the running time of the process increased when the number of processes is increased as each process is taking less time by running the quicksort algorithm on each sub arrays but at last the final process is merging all the subparts so the greater the subarrays to be merged the greater the time taken to merge.

Instruction for Run the code:

mpic++ 2018201019_1.cpp -o 2018201019_1 mpirun -np #NP ./2018201019_1 inputfile outputfile

INPUT: Array of elements : 1 9 28 4 58 29 1 5 3

Observation:

No of elements : 100000

$ mpirun -np 1 ./a.out test1.txt out.txt Total time (s): 0.439704 $ mpirun -np 3 ./a.out test1.txt out.txt Total time (s): 0.365743 $ mpirun -np 10 ./a.out test1.txt out.txt Total time (s): 0.780569 $ mpirun -np 15 ./a.out test1.txt out.txt Total time (s): 0.996206 $ mpirun -np 20 ./a.out test1.txt out.txt Total time (s): 1.163541

Question 2 - Single Source Shortest Path (Dijkstra's)

Brief -

  • Every process will find local minimum distance of some set of vertices from source vertex.
  • Then will find global minimum distance of each vertex from source vertex.

Analyis -

  • for varying input - When the number of processes is kept fixed, the running time of the process increased when the size of input is increased.

Instruction for Run the code:

mpic++ 2018201019_2.cpp -o 2018201019_2 mpirun -np #NP ./2018201019_2 inputfile outputfile

INPUT: 4 5 1 2 1 1 3 1 1 4 2 2 3 4 3 4 2 1

Observation: No of nodes : 5

$ mpirun -np 2 ./a.out Input/q2_input out.txt Total time (s): 0.004517 $ mpirun -np 3 ./a.out Input/q2_input out.txt Total time (s): 0.215743 $ mpirun -np 4 ./a.out Input/q2_input out.txt Total time (s): 0.234638 $ mpirun -np 5 ./a.out Input/q2_input out.txt Total time (s): 0.302795

open-mpi-ds's People

Contributors

girdhari9 avatar

Watchers

James Cloos avatar  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.