Merge release-4-5-patches into release-4-6
authorRoland Schulz <roland@utk.edu>
Tue, 20 Nov 2012 02:17:30 +0000 (21:17 -0500)
committerRoland Schulz <roland@utk.edu>
Tue, 20 Nov 2012 02:17:30 +0000 (21:17 -0500)
Conflicts:
src/tools/gmx_tune_pme.c

Change-Id: I924851995261a7777def8a5dea168597aabf0e0d

1  2 
cmake/gmxCFlags.cmake
src/tools/gmx_tune_pme.c

Simple merge
index 49a1033733b6b38ea1b578deb479664c64da0326,7474694004ca7731e61156c1705704c93f7374b2..d2d7a4b215d2ec3077db76e5a49cfb27e48a2bd1
@@@ -695,13 -699,14 +697,14 @@@ static void modify_PMEsettings
      t_state      state;
      gmx_mtop_t   mtop;
      char         buf[200];
 -    
 +
      snew(ir,1);
      read_tpx_state(fn_best_tpr,ir,&state,NULL,&mtop);
 -        
 +
-     /* Set nsteps to the right value */
+     /* Reset nsteps and init_step to the value of the input .tpr file */
      ir->nsteps = simsteps;
 -    
+     ir->init_step = init_step;
 +
      /* Write the tpr file which will be launched */
      sprintf(buf, "Writing optimized simulation file %s with nsteps=%s.\n", fn_sim_tpr, gmx_large_int_pfmt);
      fprintf(stdout,buf,ir->nsteps);
@@@ -2228,44 -2490,33 +2234,43 @@@ int gmx_tune_pme(int argc,char *argv[]
      /* Main loop over all scenarios we need to test: tpr files, PME nodes, repeats  */
      /********************************************************************************/
      snew(perfdata, ntprs);
 -    do_the_tests(fp, tpr_names, maxPMEnodes, minPMEnodes, npme_fixed, npmevalues_opt[0], perfdata, &pmeentries,
 -                 repeats, nnodes, ntprs, bThreads, cmd_mpirun, cmd_np, cmd_mdrun,
 -                 cmd_args_bench, fnm, NFILE, sim_part, presteps, cpt_steps);
 -    
 -    fprintf(fp, "\nTuning took%8.1f minutes.\n", (gettime()-seconds)/60.0);
 -
 -    /* Analyse the results and give a suggestion for optimal settings: */
 -    bKeepTPR = analyze_data(fp, opt2fn("-p", NFILE, fnm), perfdata, nnodes, ntprs, pmeentries,
 -                            repeats, info, &best_tpr, &best_npme);
 -    
 -    /* Take the best-performing tpr file and enlarge nsteps to original value */
 -    if ( bKeepTPR && !bOverwrite && !(fs > 0.0) )
 -    {
 -        simulation_tpr = opt2fn("-s",NFILE,fnm);
 -    }
 -    else
 +    if (bBenchmark)
      {
 -        simulation_tpr = opt2fn("-so",NFILE,fnm);
 -        modify_PMEsettings(bOverwrite? (new_sim_nsteps+cpt_steps) : info->orig_sim_steps,
 +        do_the_tests(fp, tpr_names, maxPMEnodes, minPMEnodes, npme_fixed, npmevalues_opt[0], perfdata, &pmeentries,
 +                repeats, nnodes, ntprs, bThreads, cmd_mpirun, cmd_np, cmd_mdrun,
 +                cmd_args_bench, fnm, NFILE, sim_part, presteps, cpt_steps);
 +
 +        fprintf(fp, "\nTuning took%8.1f minutes.\n", (gettime()-seconds)/60.0);
 +
 +        /* Analyse the results and give a suggestion for optimal settings: */
 +        bKeepTPR = analyze_data(fp, opt2fn("-p", NFILE, fnm), perfdata, nnodes, ntprs, pmeentries,
 +                repeats, info, &best_tpr, &best_npme);
 +
 +        /* Take the best-performing tpr file and enlarge nsteps to original value */
 +        if ( bKeepTPR && !bOverwrite )
 +        {
 +            simulation_tpr = opt2fn("-s",NFILE,fnm);
 +        }
 +        else
 +        {
 +            simulation_tpr = opt2fn("-so",NFILE,fnm);
-             modify_PMEsettings(bOverwrite? (new_sim_nsteps+cpt_steps) :
-                     info->orig_sim_steps, tpr_names[best_tpr],
-                     simulation_tpr);
++            modify_PMEsettings(bOverwrite? (new_sim_nsteps+cpt_steps) : info->orig_sim_steps,
+                 info->orig_init_step, tpr_names[best_tpr], simulation_tpr);
 -    }
 +        }
 +
 +        /* Let's get rid of the temporary benchmark input files */
 +        for (i=0; i<ntprs; i++)
 +        {
 +            fprintf(stdout, "Deleting temporary benchmark input file %s\n", tpr_names[i]);
 +            remove(tpr_names[i]);
 +        }
  
 -    /* Now start the real simulation if the user requested it ... */
 -    launch_simulation(bLaunch, fp, bThreads, cmd_mpirun, cmd_np, cmd_mdrun,
 -                      cmd_args_launch, simulation_tpr, nnodes, best_npme);
 +        /* Now start the real simulation if the user requested it ... */
 +        launch_simulation(bLaunch, fp, bThreads, cmd_mpirun, cmd_np, cmd_mdrun,
 +                cmd_args_launch, simulation_tpr, nnodes, best_npme);
 +    }
      ffclose(fp);
 -        
 +
      /* ... or simply print the performance results to screen: */
      if (!bLaunch)
          finalize(opt2fn("-p", NFILE, fnm));