Matthew Turk avatar Matthew Turk committed cd7e14c

Update to use multiple processors on the Enzo side.

Comments (0)

Files changed (2)

 This sets up an inter-communicator to pass data back and forth between a
 running enzo process and a running yt process.
 
-** Right now it only works on a single processor on both ends! **
-
 To start it, you have to have the MPI lookup server running.  For OpenMPI, this
 looks like:
 
 
 Now, you can start Enzo (compiled with python-yes) with this:
 
-    $ mpirun -np 1 --ompi-server file:ompi_server.txt ./enzo.exe -d AMRCosmologySimulation.enzo
+    $ mpirun -np N --ompi-server file:ompi_server.txt ./enzo.exe -d AMRCosmologySimulation.enzo
 
-In another window, once it's up and running (and you have seen yt import) run
-this in either another window or another machine with a shared file system:
+where N is the number of processors you want to run it on.  If you look in the
+user_script.py file, you can see that the intercommunicator is only used by the
+root processor.
+
+In another window, maybe even on another host, once it's up and running (and
+you have seen yt import) run this in either another window or another machine
+with a shared file system:
 
     $ mpirun -np 1 --ompi-server file:ompi_server.txt python2.7 yt_recv.py --parallel
 
 if 1:
     my_info = MPI.Info()
     port = MPI.Open_port(my_info)
-    MPI.Publish_name("enzo_server", my_info, port)
+    print "OPENING PORT"
+    if MPI.COMM_WORLD.rank == 0:
+        print "PUBLISHING NAME"
+        MPI.Publish_name("enzo_server", my_info, port)
+    print "WAITING FOR A CONNECTION"
     comm = MPI.COMM_WORLD.Accept(port, my_info, 0)
+    print "ACCEPTED A CONNECTION"
 
 def main():
     pf = EnzoStaticOutputInMemory()
     print "SENDING PIXEL BUFFER", frb["Density"].min(), frb["Density"].max()
     write_image(na.log10(frb["Density"]), "temp.png")
     #return
-    st = MPI.Status()
-    waiting = comm.Iprobe(MPI.ANY_SOURCE, 104, status=st)
-    if not waiting: 
-        print "NO FOUND WAITING"
-        return
-    print "GETTING NEW OUTPUT"
-    comm.send(na.log10(frb["Density"]), dest = 0)
+    if MPI.COMM_WORLD.rank == 0:
+        st = MPI.Status()
+        waiting = comm.Iprobe(MPI.ANY_SOURCE, 104, status=st)
+        if not waiting: 
+            print "NO FOUND WAITING"
+            return
+        print "GETTING NEW OUTPUT"
+        comm.send(na.log10(frb["Density"]), dest = 0)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.