Merge release-2016 into master
authorRoland Schulz <roland.schulz@intel.com>
Sat, 23 Jul 2016 00:06:56 +0000 (17:06 -0700)
committerRoland Schulz <roland.schulz@intel.com>
Sat, 23 Jul 2016 00:06:56 +0000 (17:06 -0700)
Conflicts:
src/programs/mdrun/resource-division.cpp
src/programs/mdrun/resource-division.h
src/programs/mdrun/runner.cpp

Change-Id: I02a0af8295df0fa271e6e236daf035ea442cb73a

1  2 
src/gromacs/fileio/enxio.cpp
src/gromacs/tools/dump.cpp
src/gromacs/trajectory/trajectoryframe.h
src/programs/mdrun/resource-division.cpp
src/programs/mdrun/resource-division.h
src/programs/mdrun/runner.cpp

Simple merge
Simple merge
index 8f6694235886f38d92d5dcdc45a8b7ccddf2c680,7d489bb013bb83d98aa92b4e8192181b8bfb0f3f..5e51e7e106f491bfeb05d82f918b1eac1926a98e
@@@ -56,7 -57,7 +56,8 @@@
  #include "gromacs/topology/topology.h"
  #include "gromacs/utility/fatalerror.h"
  #include "gromacs/utility/gmxassert.h"
 +#include "gromacs/utility/logger.h"
+ #include "gromacs/utility/stringutil.h"
  
  
  /* DISCLAIMER: All the atom count and thread numbers below are heuristic.
@@@ -306,8 -345,10 +345,9 @@@ int get_nthreads_mpi(const gmx_hw_info_
                       gmx_hw_opt_t        *hw_opt,
                       const t_inputrec    *inputrec,
                       const gmx_mtop_t    *mtop,
 -                     const t_commrec     *cr,
 -                     FILE                *fplog,
 +                     const gmx::MDLogger &mdlog,
-                      gmx_bool             bUseGpu)
+                      gmx_bool             bUseGpu,
+                      bool                 doMembed)
  {
      int                          nthreads_hw, nthreads_tot_max, nrank, ngpu;
      int                          min_atoms_per_mpi_rank;
      const gmx::CpuInfo          &cpuInfo = *hwinfo->cpuInfo;
      const gmx::HardwareTopology &hwTop   = *hwinfo->hardwareTopology;
  
-     /* Check if an algorithm does not support parallel simulation.  */
-     if (inputrec->eI == eiLBFGS ||
-         inputrec->coulombtype == eelEWALD)
      {
-         GMX_LOG(mdlog.warning).asParagraph().appendText("The integration or electrostatics algorithm doesn't support parallel runs. Using a single thread-MPI rank.");
-         if (hw_opt->nthreads_tmpi > 1)
+         /* Check if an algorithm does not support parallel simulation.  */
+         // TODO This might work better if e.g. implemented algorithms
+         // had to define a function that returns such requirements,
+         // and a description string.
+         SingleRankChecker checker;
+         checker.applyConstraint(inputrec->eI == eiLBFGS, "L-BFGS minimization");
+         checker.applyConstraint(inputrec->coulombtype == eelEWALD, "Plain Ewald electrostatics");
+         checker.applyConstraint(doMembed, "Membrane embedding");
+         if (checker.mustUseOneRank())
          {
-             gmx_fatal(FARGS, "You asked for more than 1 thread-MPI rank, but an algorithm doesn't support that");
+             std::string message = checker.getMessage();
+             if (hw_opt->nthreads_tmpi > 1)
+             {
+                 gmx_fatal(FARGS, "%s However, you asked for more than 1 thread-MPI rank, so mdrun cannot continue. Choose a single rank, or a different algorithm.", message.c_str());
+             }
 -            md_print_warn(cr, fplog, "%s Choosing to use only a single thread-MPI rank.", message.c_str());
++            GMX_LOG(mdlog.warning).asParagraph().appendTextFormatted("%s Choosing to use only a single thread-MPI rank.", message.c_str());
+             return 1;
          }
-         return 1;
      }
  
      if (hw_opt->nthreads_tmpi > 0)
index 9cde520897a7e91f3676931396a1e08cd872b146,0f292aaf63a56386dd871da8ae4b356d53c863fb..5da5c2020c529318f549172d0e72aad7d3a7d3cf
@@@ -63,8 -58,10 +63,9 @@@ int get_nthreads_mpi(const gmx_hw_info_
                       gmx_hw_opt_t        *hw_opt,
                       const t_inputrec    *inputrec,
                       const gmx_mtop_t    *mtop,
 -                     const t_commrec     *cr,
 -                     FILE                *fplog,
 +                     const gmx::MDLogger &mdlog,
-                      gmx_bool             bUseGpu);
+                      gmx_bool             bUseGpu,
+                      bool                 doMembed);
  
  /* Check if the number of OpenMP threads is within reasonable range
   * considering the hardware used. This is a crude check, but mainly
index 4e5edee9297672e46ecde4e42cb81698e4709686,560b923ba600d4304b2eea72a1a5d76b7a1f6bfa..48989ca40812558bf9180e375dc8e314d315affa
@@@ -855,7 -833,8 +856,8 @@@ int mdrunner(gmx_hw_opt_t *hw_opt
          hw_opt->nthreads_tmpi = get_nthreads_mpi(hwinfo,
                                                   hw_opt,
                                                   inputrec, mtop,
-                                                  mdlog, bUseGPU);
 -                                                 cr, fplog, bUseGPU,
++                                                 mdlog, bUseGPU,
+                                                  doMembed);
  
          if (hw_opt->nthreads_tmpi > 1)
          {