MPI.COMM_WORLD.Get_size() is always resulting '1'

2,144 views
Skip to first unread message

Sarath Malipeddi

unread,
Feb 13, 2014, 1:58:53 AM2/13/14
to mpi...@googlegroups.com
HI all

MPI.COMM_WORLD.Get_size() is always resulting '1' as output even i have 2 cores on host PC and 2 cores on another PC which are able to communicate through SSH without password.

>>> from mpi4py import MPI
>>> comm=MPI.COMM_WORLD
>>> size=comm.Get_size()
>>> size
1
>>>

MPICH2 and MPI4PY were successfully installed on both the PCs. I am new to PYTHON and MPI please someone help me.

Thank you in advance
Sarath. M

Yury V. Zaytsev

unread,
Feb 13, 2014, 3:32:37 AM2/13/14
to mpi...@googlegroups.com
On Wed, 2014-02-12 at 22:58 -0800, Sarath Malipeddi wrote:
>
> MPICH2 and MPI4PY were successfully installed on both the PCs. I am
> new to PYTHON and MPI please someone help me.

Did you specify the number of processes in mpirun?

--
Sincerely yours,
Yury V. Zaytsev


Sarath Malipeddi

unread,
Feb 13, 2014, 3:53:03 AM2/13/14
to mpi...@googlegroups.com
Thank you for quick response Yury

"mpiexec -n 4 python demo/helloworld.py"

for this line response is

Hello, World! I am process 1 of 4 on vm1.
Hello, World! I am process 3 of 4 on vm1.
Hello, World! I am process 0 of 4 on vm1.
Hello, World! I am process 2 of 4 on vm1.


vm1 my 'hostname' which has 2 cores
vm2 another pc name which has 2 cores'

all 4 processes ran on vm1 only
what about the cores in vm2?
Sorry for bad explanation.
thank you
sarath. m

Yury V. Zaytsev

unread,
Feb 13, 2014, 4:02:33 AM2/13/14
to mpi...@googlegroups.com
On Thu, 2014-02-13 at 00:53 -0800, Sarath Malipeddi wrote:
>
> all 4 processes ran on vm1 only
> what about the cores in vm2?

Your MPI setup is wrong; at very least, I believe, you need to specify
the hosts file. Please google for some tutorials that explain how to set
up MPI (there are billions of them out there), your questions are not
specific to mpi4py.

Sarath Malipeddi

unread,
Feb 13, 2014, 8:31:29 AM2/13/14
to mpi...@googlegroups.com
Thank you Yury i forgot to provide hosts file in commend, now its working.... would please tell me how to use mpi in python interactive mode...?

Lisandro Dalcin

unread,
Feb 14, 2014, 5:00:00 PM2/14/14
to mpi4py
I recommend to use IPython parallel features,
http://ipython.org/ipython-doc/stable/parallel/index.html, take a look
to the first sections, then the specific one about MPI.


--
Lisandro Dalcin
---------------
CIMEC (UNL/CONICET)
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
3000 Santa Fe, Argentina
Tel: +54-342-4511594 (ext 1016)
Tel/Fax: +54-342-4511169
Reply all
Reply to author
Forward
0 new messages