Author: bugman
Date: Thu Mar 22 10:34:35 2012
New Revision: 15601
URL: http://svn.gna.org/viewcvs/relax?rev=15601&view=rev
Log:
Shifted the mpi4py processor module functions broadcast_command() and
ditch_all_results() into the class.
These have been turned into private methods.
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=15601&r1=15600&r2=15601&view=diff
==============================================================================
--- 1.3/multi/mpi4py_processor.py (original)
+++ 1.3/multi/mpi4py_processor.py Thu Mar 22 10:34:35 2012
@@ -42,22 +42,6 @@
from multi.multi_processor_base import Multi_processor,
Too_few_slaves_exception
-
-def broadcast_command(command):
- for i in range(1, MPI.COMM_WORLD.size):
- if i != 0:
- MPI.COMM_WORLD.send(obj=command, dest=i)
-
-
-def ditch_all_results():
- for i in range(1, MPI.COMM_WORLD.size):
- if i != 0:
- while True:
- result = MPI.COMM_WORLD.recv(source=i)
- if result.completed:
- break
-
-
class Mpi4py_processor(Multi_processor):
"""The mpi4py multi-processor class."""
@@ -81,6 +65,22 @@
# Initialise a flag for determining if we are in the run() method or
not.
self.in_main_loop = False
+
+
+ def _broadcast_command(self, command):
+ for i in range(1, MPI.COMM_WORLD.size):
+ if i != 0:
+ MPI.COMM_WORLD.send(obj=command, dest=i)
+
+
+ def _ditch_all_results(self):
+ for i in range(1, MPI.COMM_WORLD.size):
+ if i != 0:
+ while True:
+ result = MPI.COMM_WORLD.recv(source=i)
+ if result.completed:
+ break
+
def abort(self):
@@ -140,10 +140,10 @@
# Slave clean up.
if MPI.Is_initialized() and not MPI.Is_finalized() and
MPI.COMM_WORLD.rank == 0:
# Send the exit command to all slaves.
- broadcast_command(Exit_command())
+ self._broadcast_command(Exit_command())
# Dump all results.
- ditch_all_results()
+ self._ditch_all_results()
# Exit the program with the given status.
sys.exit(status)
_______________________________________________
relax (http://nmr-relax.com)
This is the relax-commits mailing list
[email protected]
To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits