Author: varioustoxins Date: Fri Mar 30 09:53:32 2007 New Revision: 3251 URL: http://svn.gna.org/viewcvs/relax?rev=3251&view=rev Log: MF class name fixes also now works on python 2.3.3 Modified: branches/multi_processor/multi/commands.py branches/multi_processor/multi/mpi4py_processor.py branches/multi_processor/specific_fns/model_free.py Modified: branches/multi_processor/multi/commands.py URL: http://svn.gna.org/viewcvs/relax/branches/multi_processor/multi/commands.py?rev=3251&r1=3250&r2=3251&view=diff ============================================================================== --- branches/multi_processor/multi/commands.py (original) +++ branches/multi_processor/multi/commands.py Fri Mar 30 09:53:32 2007 @@ -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/multi/mpi4py_processor.py URL: http://svn.gna.org/viewcvs/relax/branches/multi_processor/multi/mpi4py_processor.py?rev=3251&r1=3250&r2=3251&view=diff ============================================================================== --- branches/multi_processor/multi/mpi4py_processor.py (original) +++ branches/multi_processor/multi/mpi4py_processor.py Fri Mar 30 09:53:32 2007 @@ -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/specific_fns/model_free.py URL: http://svn.gna.org/viewcvs/relax/branches/multi_processor/specific_fns/model_free.py?rev=3251&r1=3250&r2=3251&view=diff ============================================================================== --- branches/multi_processor/specific_fns/model_free.py (original) +++ branches/multi_processor/specific_fns/model_free.py Fri Mar 30 09:53:32 2007 @@ -35,7 +35,7 @@ from maths_fns.mf import Mf from minimise.generic import generic_minimise from float import isNaN,isInf -from multi.commands import MF_minimise_command,MF_completion_memo +from multi.commands import MF_minimise_command,MF_memo class Model_free(Common_functions): @@ -2394,7 +2394,7 @@ func_tol=func_tol, grad_tol=grad_tol, maxiter=max_iterations, full_output=1, print_flag=print_flag,res_id=res_id,grid_size=self.grid_size) - 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)