Re: [Pympi-users] Idle as the console/ TCP locked down, so IDLE loopback doesn't work
Status: Alpha
Brought to you by:
patmiller
|
From: Pat M. <pat...@ll...> - 2005-08-18 19:59:08
|
I modified Julian's IDLE startup script to put in an input
adapter
% cat pyMPI_idle.py
import mpi
import sys
if (mpi.rank == 0):
import idlelib.PyShell
class adapter(idlelib.PyShell.ModifiedInterpreter):
base = idlelib.PyShell.ModifiedInterpreter
def runsource(self,source):
mpi.bcast_input_to_slaves(source+'\n')
return self.base.runsource(self,source)
idlelib.PyShell.ModifiedInterpreter = adapter
idlelib.PyShell.main()
I added a routine to the mpi module that allows alternate
IO routines to properly broadcast input data to the waiting
slaves... Its called (unimaginatively) mpi.bcast_input_to_slaves()
The adapter in IDLE calls it right before it executes a completed
IDLE input line.
I did a very quick test....
% mpirun -np 4 pyMPI -i pyMPI_idle.py -n
< now in the IDLE window >
>>> 3
3
>>> mpi.rank
0
>>> mpi.allreduce(mpi.rank.mpi.SUM)
6
Requires lastest CVS snapshot (don't forget to run ./boot before the ./configure)
Pat
--
Pat Miller | (925) 423-0309 | http://www.llnl.gov/CASC/people/pmiller
It is not what we do, but also what we do not do, for which we are
accountable. -- Moliere, actor and playwright (1622-1673)
|