mailr10163 - in /branches/multi_processor_merge: dep_check.py multi/mpi4py_processor.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on January 11, 2010 - 10:52:
Author: bugman
Date: Mon Jan 11 10:52:36 2010
New Revision: 10163

URL: http://svn.gna.org/viewcvs/relax?rev=10163&view=rev
Log:
Shifted the mpi4py dependency check into the dep_check module.


Modified:
    branches/multi_processor_merge/dep_check.py
    branches/multi_processor_merge/multi/mpi4py_processor.py

Modified: branches/multi_processor_merge/dep_check.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/multi_processor_merge/dep_check.py?rev=10163&r1=10162&r2=10163&view=diff
==============================================================================
--- branches/multi_processor_merge/dep_check.py (original)
+++ branches/multi_processor_merge/dep_check.py Mon Jan 11 10:52:36 2010
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2008-2009 Edward d'Auvergne                                  
 #
+# Copyright (C) 2008-2010 Edward d'Auvergne                                  
 #
 #                                                                            
 #
 # This file is part of the program relax.                                    
 #
 #                                                                            
 #
@@ -122,6 +122,24 @@
 except ImportError:
     vmd_module = False
 
+# mpi4py.
+try:
+    import mpi4py
+    del mpi4py
+    mpi4py_import = True
+except ImportError, message:
+    mpi4py_import = False
+
+    # The error message.
+    mpi4py_message = """The dependency 'mpi4py' has not been installed. You 
should either:
+
+1. Run without multiprocessor support i.e. remove the --multi mpi4py flag 
from the command line.
+
+2. Install mpi4py.
+
+3. Choose another multi processor method to give to the --multi command line 
flag.\n
+    """
+ 
 
 # Compiled C modules.
 #####################

Modified: branches/multi_processor_merge/multi/mpi4py_processor.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/multi_processor_merge/multi/mpi4py_processor.py?rev=10163&r1=10162&r2=10163&view=diff
==============================================================================
--- branches/multi_processor_merge/multi/mpi4py_processor.py (original)
+++ branches/multi_processor_merge/multi/mpi4py_processor.py Mon Jan 11 
10:52:36 2010
@@ -24,7 +24,12 @@
 # TODO: clone communicators & resize
 # TODO: check exceptions on master
 
+# Dependency check module.
+import dep_check
+
 # Python module imports.
+if dep_check.mpi4py_import:
+    from mpi4py import MPI
 import os
 import sys
 import textwrap
@@ -38,25 +43,6 @@
 _sys_exit = sys.exit
 
 in_main_loop = False
-
-# load mpi
-try:
-    from mpi4py import MPI
-except ImportError:
-    msg = '''The dependency 'mpi4py' has not been installed. You should 
either
-
-                 1. Run without multiprocessor support i.e. remove the
-                    --multi mpi4py flag from the command line.
-
-                 2. Install mpi4py.
-
-                 3. Choose another multi processor method to give to the
-                    --multi command line flag.\n'''
-    #FIXME dedent not working
-    msg = textwrap.dedent(msg)
-    sys.stderr.write(msg)
-    sys.stderr.write('exiting...\n\n')
-    sys.exit()
 
 
 def broadcast_command(command):




Related Messages


Powered by MHonArc, Updated Mon Jan 11 11:00:02 2010