mailr15612 - /1.3/multi/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 - 12:33:
Author: bugman
Date: Fri Mar 23 12:33:28 2012
New Revision: 15612

URL: http://svn.gna.org/viewcvs/relax?rev=15612&view=rev
Log:
The multi/test_implementation2.py script can now be run in uni-processor mode.

Thought it still fails due to deficiencies in the Processor base class (one 
of Gary's TODOS in the
Multi_processor class).


Modified:
    1.3/multi/test_implementation2.py

Modified: 1.3/multi/test_implementation2.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/multi/test_implementation2.py?rev=15612&r1=15611&r2=15612&view=diff
==============================================================================
--- 1.3/multi/test_implementation2.py (original)
+++ 1.3/multi/test_implementation2.py Fri Mar 23 12:33:28 2012
@@ -9,7 +9,12 @@
 Testing
 =======
 
-To run in mpi4py multi-processor mode with one master and two slave 
processors, type::
+To run in uni-processor mode on a dual core system, change the MULTI 
variable to False and type::
+
+$ python test_implementation2.py
+
+
+To run in mpi4py multi-processor mode with one master and two slave 
processors, change the MULTI variable to True and type::
 
 $ mpiexec -n 3 python test_implementation2.py
 """
@@ -33,8 +38,14 @@
 
 
 # Module variables.
-FABRIC = 'mpi4py'
-PROCESSOR_NUM = 2
+PROFILE = False
+MULTI = True
+if MULTI:
+    FABRIC = 'mpi4py'
+    PROCESSOR_NUM = 2
+else:
+    FABRIC = 'uni'
+    PROCESSOR_NUM = 1
 
 
 def print_stats(stats, status=0):
@@ -297,10 +308,14 @@
 # Set up the processor.
 processor = load_multiprocessor(FABRIC, Application_callback(master=Main()), 
processor_size=PROCESSOR_NUM, verbosity=1)
 
-processor.run()
-
-# Replace the default profiling print out function.
-profile.Profile.print_stats = print_stats
-
-# Execute with profiling.
-#profile.runctx('processor.run()', globals(), locals())
+# Run without profiling.
+if not PROFILE:
+    processor.run()
+
+# Run with profiling.
+else:
+    # Replace the default profiling print out function.
+    profile.Profile.print_stats = print_stats
+
+    # Execute with profiling.
+    profile.runctx('processor.run()', globals(), locals())




Related Messages


Powered by MHonArc, Updated Fri Mar 23 12:40:02 2012