Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 01-15-2009, 04:29 AM   #1
LQ Newbie
Registered: Jan 2009
Posts: 1

Rep: Reputation: 0
Question about MPI


We are trying to run MPI with Python, and we encounter a problem.
We didn't find any solution in the web.

By running 'mpirun -np 2 python', the MPI does not recognize the fact that 2 processes are running and print us rank 0 for both processes.

by running this simple program with the command: 'mpirun -np 2 python'

from mpi4py import MPI
import sys,os

hwmess = "Hello, World!! I am process %d of %d on %s.\n"
myrank = MPI.COMM_WORLD.Get_rank()
nprocs = MPI.COMM_WORLD.Get_size()
procnm = MPI.Get_processor_name()
sys.stdout.write(hwmess % (myrank, nprocs, procnm))

v = os.getpid()

counter = 0
while True:
if counter == 1000000:
print "I'm",os.getpid(),"my rank",myrank,"I got",data
counter = 0
counter = counter + 1

the output I get is:

Hello, World!! I am process 0 of 1 on
Hello, World!! I am process 0 of 1 on
I'm 21599 my rank 0 I got 21599
I'm 21601 my rank 0 I got 21601
I'm 21599 my rank 0 I got 21599
I'm 21601 my rank 0 I got 21601
I'm 21599 my rank 0 I got 21599
I'm 21601 my rank 0 I got 21601

Do you have any idea what's wrong and how can we fix it?
Any help will be appreciated.

Thanks you very much,

Last edited by sara.vilner; 01-16-2009 at 03:47 AM. Reason: not clear
Old 01-15-2009, 11:13 PM   #2
LQ Newbie
Registered: Dec 2004
Distribution: Slackware X
Posts: 2

Rep: Reputation: 0
You should add more details...
Unless we have more information we cannot address your problem.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mpi mkrems Programming 0 06-09-2008 08:18 PM
Mpi chandan_shetty Linux - Networking 1 05-10-2008 06:16 AM
Question about MPI programming ArthurHuang Programming 8 01-29-2006 10:14 PM
what do I need to know to use MPI kgustaf Linux - Networking 0 07-25-2005 05:13 PM
stupid question on LAM/MPI funkymunky Programming 2 10-17-2003 12:41 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:33 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration