mailr7724 - in /branches/multi_processor_merge: multi/commands.py multi/mpi4py_processor.py specific_fns/model_free/mf_minimise.py


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

Header


Content

Posted by edward on October 15, 2008 - 23:09:
Author: bugman
Date: Wed Oct 15 23:09:28 2008
New Revision: 7724

URL: http://svn.gna.org/viewcvs/relax?rev=7724&view=rev
Log:
Manually ported r3251 from the multi_processor branch.

The 2 commands used were:
svn merge -r3250:3251 
svn+ssh://bugman@xxxxxxxxxxx/svn/relax/branches/multi_processor .
svn merge -r3250:3251 
svn+ssh://bugman@xxxxxxxxxxx/svn/relax/branches/multi_processor/specific_fns/model_free.py
 specific_fns/model_free/mf_minimise.py

.....
  r3251 | varioustoxins | 2007-03-30 09:53:32 +0200 (Fri, 30 Mar 2007) | 2 
lines
  Changed paths:
     M /branches/multi_processor/multi/commands.py
     M /branches/multi_processor/multi/mpi4py_processor.py
     M /branches/multi_processor/specific_fns/model_free.py

  MF class name fixes also now works on python 2.3.3
.....


Modified:
    branches/multi_processor_merge/multi/commands.py
    branches/multi_processor_merge/multi/mpi4py_processor.py
    branches/multi_processor_merge/specific_fns/model_free/mf_minimise.py

Modified: branches/multi_processor_merge/multi/commands.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/multi_processor_merge/multi/commands.py?rev=7724&r1=7723&r2=7724&view=diff
==============================================================================
--- branches/multi_processor_merge/multi/commands.py (original)
+++ branches/multi_processor_merge/multi/commands.py Wed Oct 15 23:09:28 2008
@@ -28,6 +28,7 @@
 #not quite a momento so a memo
 class MF_memo(Memo):
     def __init__(self,model_free,index,sim_index,run,param_set,scaling):
+        super(MF_memo,self).__init__()
         self.index = index
         self.sim_index=sim_index
         self.run=run
@@ -38,7 +39,7 @@
 
 class MF_result_command(Result_command):
     def __init__(self,memo_id,param_vector, func, iter, fc, gc, hc, warning):
-        
super(MF_completion_command,self).__init__(completed=True,memo_id=memo_id)
+        
super(MF_result_command,self).__init__(completed=True,memo_id=memo_id)
         self.memo_id=memo_id
         self.param_vector=param_vector
         self.func=func
@@ -82,7 +83,9 @@
         self.info_map={'res_id':None,'grid_size':1}
     #FIXME: bad names
     def set_mf(self, **kwargs):
-        self.mf_map.update(**kwargs)
+        # note the creation of a dict prevents a bug in python 2.3.3  where
+        # it complains update doesn't take keywords
+        self.mf_map.update(dict(**kwargs))
 
 
     def set_minimise(self,**kwargs):
@@ -93,7 +96,9 @@
         if 'grid_size' in kwargs:
            self.info_map['grid_size']= kwargs['grid_size']
            del kwargs['grid_size']
-        self.minimise_map.update(**kwargs)
+        # note the creation of a dict prevents a bug in python 2.3.3  where
+        # it complains update doesn't take keywords
+        self.minimise_map.update(dict(**kwargs))
 
     def build_mf(self):
         return  Mf(**self.mf_map)
@@ -135,5 +140,5 @@
         results = generic_minimise(func=self.mf.func, dfunc=self.mf.dfunc, 
d2func=self.mf.d2func, **self.minimise_map)
         param_vector, func, iter, fc, gc, hc, warning = results
 
-        
processor.return_object(MF_completion_command(self.memo_id,param_vector, 
func, iter, fc, gc, hc, warning))
+        processor.return_object(MF_result_command(self.memo_id,param_vector, 
func, iter, fc, gc, hc, warning))
 

Modified: branches/multi_processor_merge/multi/mpi4py_processor.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/multi_processor_merge/multi/mpi4py_processor.py?rev=7724&r1=7723&r2=7724&view=diff
==============================================================================
--- branches/multi_processor_merge/multi/mpi4py_processor.py (original)
+++ branches/multi_processor_merge/multi/mpi4py_processor.py Wed Oct 15 
23:09:28 2008
@@ -169,18 +169,26 @@
                         raise Exception(message)
 
 
+    def pre_run(self):
+        self.start_time =  time.time()
+
+    def post_run(self):
+        end_time = time.time()
+        time_diff= end_time - start_time
+        time_delta = datetime.timedelta(seconds=time_diff)
+        time_delta_str = time_delta.__str__()
+        (time_delta_str,millis) = time_delta_str.rsplit(sep='.',maxsplit=1)
+        print 'overall runtime: ' + time_delta_str + '\n'
+
 
     def run(self):
 
 
 
         if MPI.rank ==0:
-            start_time =  time.time()
+            self.pre_run()
             self.relax_instance.run()
-            end_time = time.time()
-            time_diff= end_time - start_time
-            time_delta = datetime.timedelta(seconds=time_diff)
-            print 'overall runtime: ' + time_delta.__str__() + '\n'
+            self.post_run()
 
             # note this a modified exit that kills all MPI processors
             sys.exit()

Modified: 
branches/multi_processor_merge/specific_fns/model_free/mf_minimise.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/multi_processor_merge/specific_fns/model_free/mf_minimise.py?rev=7724&r1=7723&r2=7724&view=diff
==============================================================================
--- branches/multi_processor_merge/specific_fns/model_free/mf_minimise.py 
(original)
+++ branches/multi_processor_merge/specific_fns/model_free/mf_minimise.py Wed 
Oct 15 23:09:28 2008
@@ -35,7 +35,7 @@
 from generic_fns.mol_res_spin import count_spins, exists_mol_res_spin_data, 
return_spin_from_index, spin_loop
 from maths_fns.mf import Mf
 from minfx.generic import generic_minimise
-from multi.commands import  MF_minimise_command,MF_completion_memo
+from multi.commands import  MF_minimise_command,MF_memo
 from physical_constants import h_bar, mu0, return_gyromagnetic_ratio
 from relax_errors import RelaxError, RelaxInfError, RelaxLenError, 
RelaxNaNError, RelaxNoModelError, RelaxNoPdbError, RelaxNoResError, 
RelaxNoSequenceError, RelaxNoTensorError, RelaxNoValueError, 
RelaxNoVectorsError, RelaxNucleusError, RelaxProtonTypeError, 
RelaxSpinTypeError
 
@@ -993,7 +993,7 @@
             # Disassemble the results.
             if results == None:
                 continue
-            memo = 
MF_completion_memo(model_free=self,index=index,sim_index=sim_index,run=self.run,param_set=self.param_set,scaling=scaling)
+            memo = 
MF_memo(model_free=self,index=index,sim_index=sim_index,run=self.run,param_set=self.param_set,scaling=scaling)
 
             self.relax.processor.add_to_queue(command,memo)
 




Related Messages


Powered by MHonArc, Updated Wed Oct 15 23:20:03 2008