Source

yt.inline-intercomm / yt_recv.py

from yt.mods import *
from mpi4py import MPI
import pylab
pylab.ion()

my_info = MPI.Info()

port = MPI.Lookup_name("enzo_server", my_info)
comm = MPI.COMM_WORLD.Connect(port, my_info, 0)

while 1:
    print "NOTIFYING ENZO"
    comm.send(None, dest = 0, tag = 104)
    print "RECEIVING"
    image = comm.recv(source = 0)
    print "UPDATING", image.min(), image.max()
    pylab.clf()
    pylab.imshow(image)
    pylab.clim(image.min(), image.max())
    pylab.draw()