mailr15621 - in /1.3/multi: __init__.py processor.py test_implementation2.py


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

Header


Content

Posted by edward on March 23, 2012 - 17:43:
Author: bugman
Date: Fri Mar 23 17:43:53 2012
New Revision: 15621

URL: http://svn.gna.org/viewcvs/relax?rev=15621&view=rev
Log:
Renamed data_upload() to send_data_to_slaves() and made it more specific.

The rank argument has been dropped, and now the API function and Processor 
methods are used solely
for transferring data from the master to all slave processors.


Modified:
    1.3/multi/__init__.py
    1.3/multi/processor.py
    1.3/multi/test_implementation2.py

Modified: 1.3/multi/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/multi/__init__.py?rev=15621&r1=15620&r2=15621&view=diff
==============================================================================
--- 1.3/multi/__init__.py (original)
+++ 1.3/multi/__init__.py Fri Mar 23 17:43:53 2012
@@ -214,25 +214,20 @@
     processor_box = Processor_box()
 
 
-def data_upload(name=None, value=None, rank=None):
-    """API function for sending data to be stored on the Processor of the 
given rank.
-
-    This can be used for transferring data from Processor instance i to the 
data store of Processor instance j.
-
+def send_data_to_slaves(name=None, value=None):
+    """API function for sending data from the master to all slaves 
processors.
 
     @keyword name:  The name of the data structure to store.
     @type name:     str
     @keyword value: The data structure.
     @type value:    anything
-    @keyword rank:  An optional argument to send data only to the Processor 
of the given rank.  If None, then the data will be sent to all Processor 
instances.
-    @type rank:     None or int
     """
 
     # Load the Processor_box.
     processor_box = Processor_box()
 
     # Forward the call to the processor instance.
-    processor_box.processor.data_upload(name=name, value=value, rank=rank)
+    processor_box.processor.send_data_to_slaves(name=name, value=value)
 
 
 

Modified: 1.3/multi/processor.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/multi/processor.py?rev=15621&r1=15620&r2=15621&view=diff
==============================================================================
--- 1.3/multi/processor.py (original)
+++ 1.3/multi/processor.py Fri Mar 23 17:43:53 2012
@@ -235,28 +235,20 @@
         """
 
 
-    def data_upload(self, name=None, value=None, rank=None):
-        """API function for sending data to be stored on the Processor of 
the given rank.
-
-        This can be used for transferring data from Processor instance i to 
the data store of Processor instance j.
-
+    def send_data_to_slaves(self, name=None, value=None):
+        """Transfer the given data from the master to all slaves.
 
         @keyword name:  The name of the data structure to store.
         @type name:     str
         @keyword value: The data structure.
         @type value:    anything
-        @keyword rank:  An optional argument to send data only to the 
Processor of the given rank.  If None, then the data will be sent to all 
Processor instances.
-        @type rank:     None or int
-        """
-
-        # The range.
-        if rank != None:
-            rank_list = [rank]
-        else:
-            rank_list = range(1, self.processor_size()+1)
+        """
+
+        # This must be the master processor!
+        self.assert_on_master()
 
         # Create the command list.
-        for i in rank_list:
+        for i in range(self.processor_size()):
             # Create and append the command.
             command = Slave_storage_command()
 

Modified: 1.3/multi/test_implementation2.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/multi/test_implementation2.py?rev=15621&r1=15620&r2=15621&view=diff
==============================================================================
--- 1.3/multi/test_implementation2.py (original)
+++ 1.3/multi/test_implementation2.py Fri Mar 23 17:43:53 2012
@@ -34,7 +34,7 @@
 sys.path.append('..')
 
 # relax module imports.
-from multi import data_fetch, data_upload, Application_callback, 
load_multiprocessor, Memo, Processor_box, Result_command, Slave_command
+from multi import data_fetch, send_data_to_slaves, Application_callback, 
load_multiprocessor, Memo, Processor_box, Result_command, Slave_command
 
 
 # Module variables.
@@ -144,7 +144,7 @@
         """This required method executes the entire program."""
 
         # Send the invariant data to the slaves' data stores.
-        data_upload('vect', self.vect)
+        send_data_to_slaves('vect', self.vect)
 
         # Initialise the Processor box singleton.
         processor_box = Processor_box()




Related Messages


Powered by MHonArc, Updated Fri Mar 23 18:00:01 2012