mailr7710 - in /branches/multi_processor_merge: multi/ relax


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

Header


Content

Posted by edward on October 15, 2008 - 21:46:
Author: bugman
Date: Wed Oct 15 21:46:10 2008
New Revision: 7710

URL: http://svn.gna.org/viewcvs/relax?rev=7710&view=rev
Log:
Manually ported r3210 from the multi_processor branch.

The command used was:
svn merge -r3209:3210 
svn+ssh://bugman@xxxxxxxxxxx/svn/relax/branches/multi_processor .

.....
  r3210 | varioustoxins | 2007-03-16 15:22:49 +0100 (Fri, 16 Mar 2007) | 2 
lines
  Changed paths:
     A /branches/multi_processor/multi
     A /branches/multi_processor/multi/__init__.py
     A /branches/multi_processor/multi/mpi4py_processor.py
     A /branches/multi_processor/multi/uni_processor.py
     M /branches/multi_processor/relax

  updates to get first mpi initialization working
.....


Added:
    branches/multi_processor_merge/multi/
      - copied from r3210, branches/multi_processor/multi/
Modified:
    branches/multi_processor_merge/relax

Modified: branches/multi_processor_merge/relax
URL: 
http://svn.gna.org/viewcvs/relax/branches/multi_processor_merge/relax?rev=7710&r1=7709&r2=7710&view=diff
==============================================================================
--- branches/multi_processor_merge/relax (original)
+++ branches/multi_processor_merge/relax Wed Oct 15 21:46:10 2008
@@ -102,8 +102,11 @@
         relax_errors.relax = self
         relax_warnings.relax = self
 
-
-    def run(self, mode):
+    def run(self):
+
+        #FIXME use self.mode all over
+        mode = self.mode
+
         # Show the version number and exit.
         if mode == 'version':
             print 'relax ' + self.version
@@ -289,19 +292,7 @@
             # Set the mode.
             mode = 'licence'
 
-        # multi processor
-        elif options.multiprocessor != 'uni':
-
-            # Exclusive modes.
-            if options.test_suite or options.unit_test:
-                parser.error("the relax multi processor mode and executing 
the test suite are mutually exclusive")
-            elif options.licence:
-                parser.error("the relax multi processor multi processor and 
licence are mutually exclusive")
-
-            self.multiprocessor_type = options.multiprocessor
-            self.n_processors = options.n_processors
-
-            mode='multi'
+
 
         # Script mode.
         elif self.script_file:
@@ -319,7 +310,26 @@
             mode = 'prompt'
 
         # Return.
-        return mode
+
+        # multi processor
+
+        if options.multiprocessor == 'uni':
+            self.multi_mode = 'uni'
+        else:
+            # Exclusive modes.
+            if options.test_suite or options.unit_test:
+                parser.error("the relax multi processor mode and executing 
the test suite are mutually exclusive")
+            elif options.licence:
+                parser.error("the relax multi processor multi processor and 
licence are mutually exclusive")
+
+            self.multiprocessor_type = options.multiprocessor
+            self.n_processors = options.n_processors
+
+            #note will be changed to multi_master or multi_slave when 
multi_processor initialises
+            self.multi_mode='multi'
+
+        #FIXME: use self.mode throughout
+        self.mode=mode
 
 
     def get_intro_string(self):
@@ -451,13 +461,14 @@
 
     try:
         module = __import__(module_path,globals(),  locals(), [])
-        print 'loaded module %s' % module_path
+        if verbose:
+            print 'loaded module %s' % module_path
     except Exception, e:
         if verbose:
             print 'failed to load module_path %s' % module_path
             print 'exception:',e
 
-
+    #FIXME: needs more failure checking
     if module != None:
         result = [module]
         components = module_path.split('.')
@@ -467,16 +478,20 @@
     return result
 
 #FIXME: mode not required should be an instance variable of relax?
-def load_multiprocessor(mode,relax_instance):
+def load_multiprocessor(relax_instance):
 
     processor_name = relax_instance.multiprocessor_type + '_processor'
     class_name= processor_name[0].upper() + processor_name[1:]
     module_path = '.'.join(('multi',processor_name))
 
 
-    modules = import_module(module_path)
-    clazz =  getattr(modules[-1], class_name)
-    object = clazz(mode,relax_instance)
+    modules = import_module(module_path,verbose=True)
+    print modules
+    if hasattr(modules[-1],class_name):
+        clazz =  getattr(modules[-1], class_name)
+    else:
+        raise RelaxError("can't load class %s from module %s" % 
(class_name,module_path))
+    object = clazz(relax_instance)
     return object
 
 if __name__ == "__main__":
@@ -490,7 +505,7 @@
     if not profile_flag:
         relax_instance = Relax()
         mode=relax_instance.arguments(sys.argv[1:])
-        multi_processor = load_multiprocessor(mode,relax_instance)
+        multi_processor = load_multiprocessor(relax_instance)
         multi_processor.run()
 
     else:




Related Messages


Powered by MHonArc, Updated Wed Oct 15 22:00:02 2008