Giter VIP home page Giter VIP logo

cmpe272-extra-assingment's Introduction

CMPE272-Extra-assignment

Nishant Ajay Mehta

CMPE272 Extra Assignment for pyMPI

I have completed my extra credit assignment of topic:

Use pyMPI to implement a parallel program in python using MPI which send receives messages in parallel.http://pympi.sourceforge.net/

I have attached my code and print-screens of code being executed. Send you two print-screens for execution execution (Saved with this project):

  1. With mpi.barrier()
  2. Without mpi.barrier() function.

Tutorial:

Pre-requisites: Python (which will be already installed in most cases)

 $sudo apt-get install python

Install openMPI using command:

 $sudo apt-get libopenmpi-dev

or

 $sudo apt-get libopenmpi1.5-dev

Now download pyMPI package to work with python from http://sourceforge.net/projects/pympi/files/latest/download

Extract the archive:

 $tar -xvf pyMPI-2.5b0.tar.gz

Write your python code for MPI and save as msg.py:

 import mpi

 

 rank= mpi.rank

 if rank == 0:

    data = {'a': 7, 'b': 3.14}

    mpi.send(data,1)

    print ("Sending data from",rank,"data",data)

    data,status = mpi.recv(source=1)

    mpi.barrier()

    print ("Receving data at",rank,"data",data)

 elif rank == 1:

    data1 = {'a': 7, 'b': 'abc'}

    mpi.send(data1,0)

    print ("Sending data from",rank,"data",data1)

    data,status = mpi.recv(source=0)

    mpi.barrier()

    print ("Recieving data at",rank,"data",data1)

Save the code in same folder as pyMPI and run:

 $ mpirun -np 2 pyMPI msg.py

You can also use Synaptic Package Manager for installation: Install Synaptic Package Manager:

 $sudo apt-get install synaptic

Open Synaptic GUI tool, now directly search and select all the packages to be installed.

 Nishant Ajay Mehta

 smarts3.in

 [email protected]

cmpe272-extra-assingment's People

Contributors

nishantam avatar

Watchers

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