[Yt-svn] yt-commit r878 - trunk/yt/lagos

mturk at wrangler.dreamhost.com mturk at wrangler.dreamhost.com
Wed Nov 5 09:54:08 PST 2008


Author: mturk
Date: Wed Nov  5 09:54:07 2008
New Revision: 878
URL: http://yt.spacepope.org/changeset/878

Log:

YT is now in parallel ONLY if load run with 'mpi4py', which is available from
the mpi4py distribution if you run 'python install_exe' following installation.



Modified:
   trunk/yt/lagos/ParallelTools.py

Modified: trunk/yt/lagos/ParallelTools.py
==============================================================================
--- trunk/yt/lagos/ParallelTools.py	(original)
+++ trunk/yt/lagos/ParallelTools.py	Wed Nov  5 09:54:07 2008
@@ -27,33 +27,25 @@
 from yt.funcs import *
 import yt.logger
 import itertools
-import os
 
-try:
-    MPIRUN_RANK = os.environ['MPIRUN_RANK']
-except KeyError:
+if os.path.basename(sys.argv[0]) == "mpi4py":
+    from mpi4py import MPI
+    parallel_capable = (MPI.COMM_WORLD.size > 1)
+    if parallel_capable:
+        mylog.info("Parallel computation enabled: %s / %s",
+                   MPI.COMM_WORLD.rank, MPI.COMM_WORLD.size)
+        ytcfg["yt","__parallel_rank"] = str(MPI.COMM_WORLD.rank)
+        ytcfg["yt","__parallel_size"] = str(MPI.COMM_WORLD.size)
+        ytcfg["yt","__parallel"] = "True"
+        # Now let's make sure we have the right options set.
+        if MPI.COMM_WORLD.rank > 0:
+            if ytcfg.getboolean("lagos","serialize"):
+                ytcfg["lagos","onlydeserialize"] = "True"
+            if ytcfg.getboolean("yt","LogFile"):
+                ytcfg["yt","LogFile"] = "False"
+                yt.logger.disable_file_logging()
+else:
     parallel_capable = False
-    MPIRUN_RANK = 0
-
-if (MPIRUN_RANK):
-    try:
-        from mpi4py import MPI
-        parallel_capable = (MPI.COMM_WORLD.size > 1)
-        if parallel_capable:
-            mylog.info("Parallel computation enabled: %s / %s",
-                      MPI.COMM_WORLD.rank, MPI.COMM_WORLD.size)
-            ytcfg["yt","__parallel_rank"] = str(MPI.COMM_WORLD.rank)
-            ytcfg["yt","__parallel_size"] = str(MPI.COMM_WORLD.size)
-            ytcfg["yt","__parallel"] = "True"
-            # Now let's make sure we have the right options set.
-            if MPI.COMM_WORLD.rank > 0:
-                if ytcfg.getboolean("lagos","serialize"):
-                    ytcfg["lagos","onlydeserialize"] = "True"
-                if ytcfg.getboolean("yt","LogFile"):
-                    ytcfg["yt","LogFile"] = "False"
-                    yt.logger.disable_file_logging()
-    except ImportError:
-        parallel_capable = False
 
 class GridIterator(object):
     def __init__(self, pobj, just_list = False):



More information about the yt-svn mailing list