Author: bugman
Date: Fri Mar 23 16:12:25 2012
New Revision: 15616
URL: http://svn.gna.org/viewcvs/relax?rev=15616&view=rev
Log:
Clean up and completion of the TODO for the Processor.assert_on_master() method.
The Processor.assert_on_master() method has been created and calls
raise_unimplemented(). The
Multi_processor.assert_on_master() method has been shifted to
Mpi4py_processor.assert_on_master(),
as that method's error message is MPI specific. The empty
Uni_processor.assert_on_master() method
has been added to allow that fabric to work.
Modified:
1.3/multi/mpi4py_processor.py
1.3/multi/multi_processor_base.py
1.3/multi/processor.py
1.3/multi/uni_processor.py
Modified: 1.3/multi/mpi4py_processor.py
URL:
http://svn.gna.org/viewcvs/relax/1.3/multi/mpi4py_processor.py?rev=15616&r1=15615&r2=15616&view=diff
==============================================================================
--- 1.3/multi/mpi4py_processor.py (original)
+++ 1.3/multi/mpi4py_processor.py Fri Mar 23 16:12:25 2012
@@ -84,6 +84,18 @@
def abort(self):
MPI.COMM_WORLD.Abort()
+
+
+ def assert_on_master(self):
+ """Make sure that this is the master processor and not a slave.
+
+ @raises Exception: If not on the master processor.
+ """
+
+ # Check if this processor is a slave, and if so throw an exception.
+ if self.on_slave():
+ msg = 'running on slave when expected master with MPI.rank == 0,
rank was %d'% self.rank()
+ raise Exception(msg)
def exit(self, status=0):
Modified: 1.3/multi/multi_processor_base.py
URL:
http://svn.gna.org/viewcvs/relax/1.3/multi/multi_processor_base.py?rev=15616&r1=15615&r2=15616&view=diff
==============================================================================
--- 1.3/multi/multi_processor_base.py (original)
+++ 1.3/multi/multi_processor_base.py Fri Mar 23 16:12:25 2012
@@ -72,13 +72,6 @@
if memo != None:
command.set_memo_id(memo)
self.memo_map[memo.memo_id()] = memo
-
-
- #TODO: move up a level
- def assert_on_master(self):
- if self.on_slave():
- msg = 'running on slave when expected master with MPI.rank == 0,
rank was %d'% self.rank()
- raise Exception(msg)
#TODO: move up a level
Modified: 1.3/multi/processor.py
URL:
http://svn.gna.org/viewcvs/relax/1.3/multi/processor.py?rev=15616&r1=15615&r2=15616&view=diff
==============================================================================
--- 1.3/multi/processor.py (original)
+++ 1.3/multi/processor.py Fri Mar 23 16:12:25 2012
@@ -214,6 +214,15 @@
raise_unimplemented(self.add_to_queue)
+ def assert_on_master(self):
+ """Make sure that this is the master processor and not a slave.
+
+ @raises Exception: If not on the master processor.
+ """
+
+ raise_unimplemented(self.assert_on_master)
+
+
def exit(self, status=0):
"""Exit the processor with the given status.
Modified: 1.3/multi/uni_processor.py
URL:
http://svn.gna.org/viewcvs/relax/1.3/multi/uni_processor.py?rev=15616&r1=15615&r2=15616&view=diff
==============================================================================
--- 1.3/multi/uni_processor.py (original)
+++ 1.3/multi/uni_processor.py Fri Mar 23 16:12:25 2012
@@ -60,6 +60,13 @@
if memo != None:
command.set_memo_id(memo)
self.memo_map[memo.memo_id()] = memo
+
+
+ def assert_on_master(self):
+ """Make sure that this is the master processor and not a slave.
+
+ As this is the Uni-processor, the processor is always the master.
Hence this method does nothing.
+ """
def get_intro_string(self):
_______________________________________________
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