Author: bugman Date: Wed Mar 21 12:35:50 2012 New Revision: 15591 URL: http://svn.gna.org/viewcvs/relax?rev=15591&view=rev Log: Implemented the mpi4py processor fabric data_upload() method. This currently sends the data out into the ether using an MPI.COMM_WORLD.send() call with the tag 10 which will be reserved for sending data into the data store. Somehow this needs to be caught and stored by the slaves. Modified: 1.3/multi/mpi4py_processor.py Modified: 1.3/multi/mpi4py_processor.py URL: http://svn.gna.org/viewcvs/relax/1.3/multi/mpi4py_processor.py?rev=15591&r1=15590&r2=15591&view=diff ============================================================================== --- 1.3/multi/mpi4py_processor.py (original) +++ 1.3/multi/mpi4py_processor.py Wed Mar 21 12:35:50 2012 @@ -124,6 +124,30 @@ MPI.COMM_WORLD.Abort() + 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. + + + @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 + """ + + # Send the data to all slaves. + for i in range(MPI.COMM_WORLD.size): + # Only send to the given rank. + if rank != None and rank != 0: + continue + + # Send the data to the given slave (using a special tag for the data store). + MPI.COMM_WORLD.send([name, value], dest=i, tag=10) + + def get_intro_string(self): """Return the string to append to the end of the relax introduction string.