mailr3238 - in /branches/multi_processor: multi/mpi4py_processor.py relax


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

Header


Content

Posted by garyt on March 19, 2007 - 23:24:
Author: varioustoxins
Date: Mon Mar 19 23:23:33 2007
New Revision: 3238

URL: http://svn.gna.org/viewcvs/relax?rev=3238&view=rev
Log:
updates to create a better inter process command passing mechanism
and initiate relax in what might possibly be a sane state!

Modified:
    branches/multi_processor/multi/mpi4py_processor.py
    branches/multi_processor/relax

Modified: branches/multi_processor/multi/mpi4py_processor.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/multi_processor/multi/mpi4py_processor.py?rev=3238&r1=3237&r2=3238&view=diff
==============================================================================
--- branches/multi_processor/multi/mpi4py_processor.py (original)
+++ branches/multi_processor/multi/mpi4py_processor.py Mon Mar 19 23:23:33 
2007
@@ -30,13 +30,13 @@
 
 #FIXME do some inheritance
 class Exit_command(object):
-    def run(self,processor):
+    def run(self,relax,processor):
         processor.do_quit=True
 
 class Get_name_command(object):
-    def run(self,processor):
+    def run(self,relax,processor):
         result = '%s-%s' % (MPI.Get_processor_name(),os.getpid())
-        MPI.COMM_WORLD.Send(buf=result, dest=0)
+        processor.return_object(result)
 
 #FIXME do some inheritance
 class Mpi4py_processor:
@@ -53,6 +53,9 @@
     def exit(self):
         exit_mpi()
 
+    def return_object(self,result):
+        MPI.COMM_WORLD.Send(buf=result, dest=0)
+
     def run_command(self,command):
         for i in range(1,MPI.size):
             if i != 0:
@@ -62,7 +65,7 @@
             if i !=0:
                 elem = MPI.COMM_WORLD.Recv(source=i)
                 if type(elem) == 'object':
-                    elem.run(relax_instance)
+                    elem.run(relax_instance, relax_instance.processor)
                 else:
                     #FIXME can't cope with multiple lines
                     print i,elem
@@ -85,14 +88,21 @@
             self.relax_instance.multi_mode='multi_master'
         else:
             self.relax_instance.multi_mode='multi_slave'
+            self.relax_instance.mode='slave'
+            self.relax_instance.script_file=None
+            self.relax_instance.dummy_mode=True
+            self.relax_instance.run()
+
 
         if MPI.rank ==0:
             self.relax_instance.run()
             sys.exit()
         else:
+            #self.relax_instance.run(deamon=True)
             while not self.do_quit:
-                data = MPI.COMM_WORLD.Recv(source=0)
-                data.run(self)
+                command = MPI.COMM_WORLD.Recv(source=0)
+                command.run(self.relax_instance, 
self.relax_instance.processor)
+
 
             #if data=='close':
             #    exit_mpi()

Modified: branches/multi_processor/relax
URL: 
http://svn.gna.org/viewcvs/relax/branches/multi_processor/relax?rev=3238&r1=3237&r2=3238&view=diff
==============================================================================
--- branches/multi_processor/relax (original)
+++ branches/multi_processor/relax Mon Mar 19 23:23:33 2007
@@ -172,6 +172,11 @@
             self.interpreter = Interpreter(self)
             self.interpreter.run()
             print 'exit'
+
+        elif mode == 'slave':
+            self.interpreter = Interpreter(self)
+            self.dummy_mode=1
+            self.interpreter.run()
 
         # FIXME no more threading
         # Threading mode.




Related Messages


Powered by MHonArc, Updated Thu Mar 22 09:40:06 2007