Using mpi4py in sage 'online' notebook (atsagenb.org)

78 views
Skip to first unread message

ravine

unread,
Mar 16, 2012, 6:06:18 PM3/16/12
to sage-support
Hi,

I just started using sage and am loving it! However, I was wondering,
is there a way to use the mpi4py package in the online (sagenb.org)
notebook ?

I was hoping to do so, but am stuck due to the following two issues:

1) The documentation at Sage (http://www.sagemath.org/doc/
numerical_sage/mpi4py.html) says that one can execute this code by
running "./local/bin/mpirun -np 5 ./sage -python filename.py" from
command line of the system. However, I do not know how to do the same
in the online notebook.

2) I tried to simply evaluate the sample program given in the
documentation page for mpi4py in sage:
from mpi4py import MPI
import numpy
rank=MPI.rank
size=MPI.size
v=numpy.array([rank]*5,dtype=float)
MPI.COMM_WORLD.Send(v,dest=(rank+1)%size)
data=MPI.COMM_WORLD.Recv(source=(rank-1)%size)
print(``my rank is %d"%n)
print(``I received this:'')
print(data)

However, it throws the error: "ImportError: No module named mpi4py"

It also does not allow me to install the "optional" mpi4py package on
its own server using "install_package" (since I obviously don't have
the required permissions).

So, is there a way that i can use mpi4py in the online notebook ?

Thanks a lot !
Ravi

Volker Braun

unread,
Mar 16, 2012, 8:28:19 PM3/16/12
to sage-s...@googlegroups.com
You can't install MPI on the public Sage server without administrative privileges.

Also, unless you want to learn MPI for educational purposes your are using the wrong tool to run stuff on a single machine. For tightly coupled problems you can't beat threads that way, and for very parallel problems you should just go with fork and the @parallel decorator.

Simon King

unread,
Mar 19, 2012, 1:57:16 AM3/19/12
to sage-s...@googlegroups.com
Why has the original post been marked as spam?

Anton Sherwood

unread,
Mar 19, 2012, 3:42:54 AM3/19/12
to sage-s...@googlegroups.com
On 2012-3-18 22:57, Simon King wrote:
> Why has the original post been marked as spam?

Possibly the phrase "I just started using **** and am loving it!" is a
red flag. (I didn't see it marked as spam.)

--
Anton Sherwood *\\* www.bendwavy.org *\\* www.zazzle.com/tamfang

Harald Schilly

unread,
Mar 19, 2012, 6:57:41 AM3/19/12
to sage-s...@googlegroups.com


On Monday, March 19, 2012 6:57:16 AM UTC+1, Simon King wrote:
Why has the original post been marked as spam?

I guess someone clicked on the "mark spam" button. I also found the setting to revert this... :-)

Simon King

unread,
Mar 19, 2012, 8:55:57 AM3/19/12
to sage-s...@googlegroups.com
Hi Harald,

Harald Schilly <harald.schilly <at> gmail.com> writes:
> I guess someone clicked on the "mark spam" button. I also found the setting to
revert this...

I also clicked on the "not spam" button...

Cheers,
Simon

Reply all
Reply to author
Forward
0 new messages