[Beowulf] python & Lush on a cluster (Newbie question)

Eugen Leitl eugen at leitl.org
Wed Jan 26 01:32:48 PST 2005

On Wed, Jan 26, 2005 at 01:52:32AM -0500, Robert G. Brown wrote:

> As a general rule, though, if you are serious enough about numerical
> research to build a cluster in the first place to speed up the
> computations, you will USUALLY be better off using a proper compiled
> language such as C, C++, or Fortran than using any sort of interpreted

You can have both, actually. It's easy to extend Python (via SWIG, or other
means), see e.g. Konrad Hinsen's MMTK or Warren DeLano's PyMol.

Python works with MPI as well, but this looks a bit experimental in places.



import pypar                         # The Python-MPI interface 

numproc = pypar.size()               # Number of processes as specified by
myid =    pypar.rank()               # Id of of this process (myid in [0,
node =    pypar.get_processor_name() # Host name on which current process is

print "I am proc %d of %d on node %s" %(myid, numproc, node)

if myid == 0:
  # Actions for process 0 

  msg = "P0"
  pypar.send(msg, destination=1)                   # Send message to proces 1
(right hand neighbour)
  msg = pypar.receive(source=numproc-1)            # Receive message from
last process

  print 'Processor 0 received message "%s" from processor %d' %(msg,

  # Actions for all other processes

  source = myid-1
  destination = (myid+1)%numproc

  msg = pypar.receive(source)
  msg = msg + 'P' + str(myid)                      # Update message     
  pypar.send(msg, destination)


> language.  I will avoid endorsing any one of these three at the expense
> of the other two, but well-written code in any of them will generally
> blow away equally well written code in an interpreted language (with a
> few possible exceptions).  You'd have to run tests to get some idea of
> the difference, but at a guess an interpreter will be around an order of
> magnitude slower.  This means you'd need some ten nodes running in
> efficient parallel just to break even.
> Additionally, "real" parallel numerical programming requires library
> support that is generally not available for anything but real compiled
> languages.  To use e.g. MPI or PVM to write a distributed program,
> you'll pretty much need one of these three.  Some of the advanced
> commercial compilers have a certain amount of built-in support for
> parallel programs as well.  Numerical libraries, e.g. the GSL, are
> only likely to be available for and run efficiently within compiled
> code, although I've heard rumors of ports into some interpreted
> languages as well.

Eugen* Leitl <a href="http://leitl.org">leitl</a>
ICBM: 48.07078, 11.61144            http://www.leitl.org
8B29F6BE: 099D 78BA 2FD3 B014 B08A  7779 75B0 2443 8B29 F6BE
http://moleculardevices.org         http://nanomachines.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://www.beowulf.org/pipermail/beowulf/attachments/20050126/6e5644bb/attachment.sig>

More information about the Beowulf mailing list