Giter Site home page Giter Site logo

distributed_sum's Introduction

Distributed sum

Description

Distributed application of computing the sum of a matrix:

  • Start with one root process (p0) and a matrix of integers of dimension m lines by n columns;
  • The matrix is dynamically generated using random numbers;
  • The m and n parameters are provided as program arguments;
  • The goal is to obtain for each line i (i=1..m) the sum (si) of its elements;
  • The root process starts by spawning m child processes (p1...pm). For each child process, it sends the corresponding line in the matrix (li) as an array of n elements. A child process, computes the sum for the input array and send it back to the parent process;
  • Depending on the size of the received array, a child process does the following:
    • if the array size is less than k (ex: 1000) elements, the child process computes the sum by itself and sends the result back to its parent;
    • otherwise, the child process splits the array in half, spawns two children of its own (thus becoming itself a parent), sends each half to the corresponding child and waits for the results. Upon receiving the partial sum results, it sums them and sends the result back to its parent.

Implementation

Implemented in C using MPI.

Run using the command (on Linux):

mpirun -np 1 distributed_sum_master [m] [n] [k]

License

MIT License.

distributed_sum's People

Contributors

alexgrigoras avatar

Stargazers

 avatar

Watchers

 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.