Hi Troels, Unfortunately this commit introduces a bug: On 27 May 2015 at 03:09, <tlinnet@xxxxxxxxxxxxx> wrote:
Author: tlinnet Date: Wed May 27 03:09:55 2015 New Revision: 27843 URL: http://svn.gna.org/viewcvs/relax?rev=27843&view=rev Log: In pipe_control of minimise, adding the possibility to control verbosity in multi processor mode. Modified: trunk/pipe_control/minimise.py Modified: trunk/pipe_control/minimise.py URL: http://svn.gna.org/viewcvs/relax/trunk/pipe_control/minimise.py?rev=27843&r1=27842&r2=27843&view=diff ============================================================================== --- trunk/pipe_control/minimise.py (original) +++ trunk/pipe_control/minimise.py Wed May 27 03:09:55 2015 @@ -31,6 +31,7 @@ from lib.float import isNaN from lib.io import write_data from multi import Processor_box +from multi.misc import Verbosity; mverbosity = Verbosity() from pipe_control.mol_res_spin import return_spin, spin_loop from pipe_control import pipes from pipe_control.pipes import check_pipe @@ -428,7 +429,7 @@ cdp.grid_zoom_level = level -def minimise(min_algor=None, line_search=None, hessian_mod=None, hessian_type=None, func_tol=None, grad_tol=None, max_iter=None, constraints=True, scaling=True, verbosity=1, sim_index=None): +def minimise(min_algor=None, line_search=None, hessian_mod=None, hessian_type=None, func_tol=None, grad_tol=None, max_iter=None, constraints=True, scaling=True, verbosity=1, mp_verbosity=0, sim_index=None): """Minimisation function. @keyword min_algor: The minimisation algorithm to use. @@ -451,6 +452,8 @@ @type scaling: bool @keyword verbosity: The amount of information to print. The higher the value, the greater the verbosity. @type verbosity: int + @keyword mp_verbosity: The amount of information to print from the multi processor module. The higher the value, the greater the verbosity. + @type mp_verbosity: int @keyword sim_index: The index of the simulation to optimise. This should be None if normal optimisation is desired. @type sim_index: None or int """ @@ -487,6 +490,9 @@ processor_box = Processor_box() processor = processor_box.processor + # Store the verbosity level for the multiprocessor. + mverbosity.set(mp_verbosity) + # Single Monte Carlo simulation. if sim_index != None: # Reset the minimisation statistics. @@ -511,8 +517,8 @@ api.minimise(min_algor=min_algor, min_options=min_options, func_tol=func_tol, grad_tol=grad_tol, max_iterations=max_iter, constraints=constraints, scaling_matrix=scaling_matrix, verbosity=verbosity-1, sim_index=i) # Print out. - if verbosity and not processor.is_queued(): - print("Simulation " + repr(i+1)) + if verbosity and processor.is_queued(): + print("Queueing Simulation nr:" + repr(i+1))
The first print statement should not have been deleted! In the uni-processor mode, it is required to print out the currently completed MC simulation. For example before: """ $ ./relax -sd Mf.test_opt_constr_newton_gmw_mt_S2_0_970_te_2048_Rex_0_149 [snip] relax> monte_carlo.setup(number=3) relax> monte_carlo.create_data(method='back_calc', distribution='measured', fixed_error=None) relax> monte_carlo.initial_values() relax> minimise.execute(min_algor='newton', line_search=None, hessian_mod=None, hessian_type=None, func_tol=1e-25, grad_tol=None, max_iter=10000000, constraints=True, scaling=True, verbosity=1) Over-fit spin deselection: No spins have been deselected. Simulation 1 Simulation 2 Simulation 3 relax> monte_carlo.error_analysis() """ And after: """ $ ./relax -sd Mf.test_opt_constr_newton_gmw_mt_S2_0_970_te_2048_Rex_0_149 [snip] relax> monte_carlo.setup(number=3) relax> monte_carlo.create_data(method='back_calc', distribution='measured', fixed_error=None) relax> monte_carlo.initial_values() relax> minimise.execute(min_algor='newton', line_search=None, hessian_mod=None, hessian_type=None, func_tol=1e-25, grad_tol=None, max_iter=10000000, constraints=True, scaling=True, verbosity=1, mp_verbosity=0) Over-fit spin deselection: No spins have been deselected. relax> monte_carlo.error_analysis() """ The second printout might be better if the mp_verbosity flag is set, rather than verbosity. This is not needed for normal analysis, as the aim is to have the same output and behaviour from the uni-processor and multi-processor, i.e. before the change: """ $ mpirun -np 6 relax -sd Mf.test_opt_constr_newton_gmw_mt_S2_0_970_te_2048_Rex_0_149 --multi=mpi4py [snip] relax> monte_carlo.setup(number=3) relax> monte_carlo.create_data(method='back_calc', distribution='measured', fixed_error=None) relax> monte_carlo.initial_values() relax> minimise.execute(min_algor='newton', line_search=None, hessian_mod=None, hessian_type=None, func_tol=1e-25, grad_tol=None, max_iter=10000000, constraints=True, scaling=True, verbosity=1) Over-fit spin deselection: No spins have been deselected. Idle set: set([2, 3, 4, 5]) Running set: set([1]) Simulation 1 Idle set: set([2, 3, 4, 5]) Running set: set([1]) Simulation 2 Idle set: set([2, 3, 4, 5]) Running set: set([1]) Simulation 3 relax> monte_carlo.error_analysis() """ Currently the muti-processor output is delayed until the end, but all the "Queuing..." statements will pop out at the start before anything is run. Neither is ideal. Also, I would suggest having instead:
+ if mp_verbosity and processor.is_queued(): + print("Queueing simulation " + repr(i+1))
This is to maintain the same format. Also note that these print statements are in all of the functions of pipe_control.minimise, however this change is only for one of the functions. So if you would like to keep this, then please extend to all the functions. Cheers, Edward