Merge branch release-2018
authorMark Abraham <mark.j.abraham@gmail.com>
Fri, 13 Apr 2018 10:09:09 +0000 (11:09 +0100)
committerAleksei Iupinov <a.yupinov@gmail.com>
Fri, 13 Apr 2018 11:21:44 +0000 (13:21 +0200)
Minor conflicts documenting gpuregiontimer_ocl.h, resolved
with a suitable mix from both branches.

Change-Id: I5bb417acaff941f18730f0417c5e46c8f4c2fc1e

1  2 
docs/user-guide/mdp-options.rst
docs/user-guide/terminology.rst
src/gromacs/gpu_utils/gpuregiontimer_ocl.h

index 318dc4196b5c9e8131358fc4a9e65116e8561f16,58e42569c6618e4d5f62ea55d455deffa0f53f4c..6e568d29e47a61820a2019280b4713e979197781
@@@ -151,7 -151,7 +151,7 @@@ Run contro
        molecule. When :mdp:`nstlist` is larger than one,
        :mdp:`nstlist` insertions are performed in a sphere with radius
        :mdp:`rtpi` around a the same random location using the same
-       neighborlist. Since neighborlist construction is expensive,
+       pair list. Since pair list construction is expensive,
        one can perform several extra insertions with the same list
        almost for free. The random seed is set with
        :mdp:`ld-seed`. The temperature for the Boltzmann weighting is
@@@ -438,7 -438,7 +438,7 @@@ Neighbor searchin
        Generate a pair list for groups of atoms. These groups
        correspond to the charge groups in the topology. This was the
        only cut-off treatment scheme before version 4.6, and is
-       **deprecated in |gmx-version|**. There is no explicit buffering of
+       **deprecated since 5.1**. There is no explicit buffering of
        the pair list. This enables efficient force calculations for
        water, but energy is only conserved when a buffer is explicitly
        added.
  
        Frequency to update the neighbor list. When this is 0, the
        neighbor list is made only once. With energy minimization the
-       neighborlist will be updated for every energy evaluation when
+       pair list will be updated for every energy evaluation when
        :mdp:`nstlist` is greater than 0. With :mdp-value:`cutoff-scheme=Verlet` and
        :mdp:`verlet-buffer-tolerance` set, :mdp:`nstlist` is actually
        a minimum value and :ref:`gmx mdrun` might increase it, unless
@@@ -567,7 -567,7 +567,7 @@@ Electrostatic
  
     .. mdp-value:: Cut-off
  
-       Plain cut-off with neighborlist radius :mdp:`rlist` and
+       Plain cut-off with pair list radius :mdp:`rlist` and
        Coulomb cut-off :mdp:`rcoulomb`, where :mdp:`rlist` >=
        :mdp:`rcoulomb`.
  
  
        Use an unmodified Coulomb potential. With the group scheme this
        means no exact cut-off is used, energies and forces are
-       calculated for all pairs in the neighborlist.
+       calculated for all pairs in the pair list.
  
  .. mdp:: rcoulomb-switch
  
@@@ -754,8 -754,8 +754,8 @@@ Van der Waal
  
     .. mdp-value:: Cut-off
  
-       Twin range cut-offs with neighbor list cut-off :mdp:`rlist` and
-       VdW cut-off :mdp:`rvdw`, where :mdp:`rvdw` >= :mdp:`rlist`.
+       Plain cut-off with pair list radius :mdp:`rlist` and VdW
+       cut-off :mdp:`rvdw`, where :mdp:`rlist` >= :mdp:`rvdw`.
  
     .. mdp-value:: PME
  
  
        Use an unmodified Van der Waals potential. With the group scheme
        this means no exact cut-off is used, energies and forces are
-       calculated for all pairs in the neighborlist.
+       calculated for all pairs in the pair list.
  
     .. mdp-value:: Force-switch
  
@@@ -1338,12 -1338,14 +1338,14 @@@ Bond
  
  .. mdp:: constraints
  
+    Controls which bonds in the topology will be converted to rigid
+    holonomic constraints. Note that typical rigid water models do not
+    have bonds, but rather a specialized ``[settles]`` directive, so
+    are not affected by this keyword.
     .. mdp-value:: none
  
-       No constraints except for those defined explicitly in the
-       topology, *i.e.* bonds are represented by a harmonic (or other)
-       potential or a Morse potential (depending on the setting of
-       :mdp:`morse`) and angles by a harmonic (or other) potential.
+       No bonds converted to constraints.
  
     .. mdp-value:: h-bonds
  
  
     .. mdp-value:: h-angles
  
-       Convert all bonds and additionally the angles that involve
-       H-atoms to bond-constraints.
+       Convert all bonds to constraints and convert the angles that
+       involve H-atoms to bond-constraints.
  
     .. mdp-value:: all-angles
  
-       Convert all bonds and angles to bond-constraints.
+       Convert all bonds to constraints and all angles to bond-constraints.
  
  .. mdp:: constraint-algorithm
  
+    Chooses which solver satisfies any non-SETTLE holonomic
+    constraints.
     .. mdp-value:: LINCS
  
        LINear Constraint Solver. With domain decomposition the parallel
  
  .. mdp:: continuation
  
-    This option was formerly known as unconstrained-start.
+    This option was formerly known as ``unconstrained-start``.
  
     .. mdp-value:: no
  
@@@ -2237,11 -2242,12 +2242,11 @@@ NMR refinemen
  
        distance restraints over an ensemble of molecules in one
        simulation box. Normally, one would perform ensemble averaging
 -      over multiple subsystems, each in a separate box, using ``mdrun
 -      -multi``. Supply ``topol0.tpr``, ``topol1.tpr``, ... with
 -      different coordinates and/or velocities. The environment
 +      over multiple simulations, using ``mdrun
 +      -multidir``. The environment
        variable ``GMX_DISRE_ENSEMBLE_SIZE`` sets the number of systems
 -      within each ensemble (usually equal to the ``mdrun -multi``
 -      value).
 +      within each ensemble (usually equal to the number of directories
 +      supplied to ``mdrun -multidir``).
  
  .. mdp:: disre-weighting
  
     .. mdp-value:: yes
  
        use orientation restraints, ensemble averaging can be performed
 -      with `mdrun -multi`
 +      with ``mdrun -multidir``
  
  .. mdp:: orire-fc
  
@@@ -3101,6 -3107,100 +3106,6 @@@ Mixed quantum/classical molecular dynam
        CASSCF method.
  
  
 -Implicit solvent
 -^^^^^^^^^^^^^^^^
 -
 -.. mdp:: implicit-solvent
 -
 -   .. mdp-value:: no
 -
 -      No implicit solvent
 -
 -   .. mdp-value:: GBSA
 -
 -      Do a simulation with implicit solvent using the Generalized Born
 -      formalism. Three different methods for calculating the Born
 -      radii are available, Still, HCT and OBC. These are specified
 -      with the :mdp:`gb-algorithm` field. The non-polar solvation is
 -      specified with the :mdp:`sa-algorithm` field.
 -
 -.. mdp:: gb-algorithm
 -
 -   .. mdp-value:: Still
 -
 -      Use the Still method to calculate the Born radii
 -
 -   .. mdp-value:: HCT
 -
 -      Use the Hawkins-Cramer-Truhlar method to calculate the Born
 -      radii
 -
 -   .. mdp-value:: OBC
 -
 -      Use the Onufriev-Bashford-Case method to calculate the Born
 -      radii
 -
 -.. mdp:: nstgbradii
 -
 -   (1) \[steps\]
 -   Frequency to (re)-calculate the Born radii. For most practial
 -   purposes, setting a value larger than 1 violates energy
 -   conservation and leads to unstable trajectories.
 -
 -.. mdp:: rgbradii
 -
 -   (1.0) \[nm\]
 -   Cut-off for the calculation of the Born radii. Currently must be
 -   equal to rlist
 -
 -.. mdp:: gb-epsilon-solvent
 -
 -   (80)
 -   Dielectric constant for the implicit solvent
 -
 -.. mdp:: gb-saltconc
 -
 -   (0) \[M\]
 -   Salt concentration for implicit solvent models, currently not used
 -
 -.. mdp:: gb-obc-alpha
 -.. mdp:: gb-obc-beta
 -.. mdp:: gb-obc-gamma
 -
 -   Scale factors for the OBC model. Default values of 1, 0.78 and 4.85
 -   respectively are for OBC(II). Values for OBC(I) are 0.8, 0 and 2.91
 -   respectively
 -
 -.. mdp:: gb-dielectric-offset
 -
 -   (0.009) \[nm\]
 -   Distance for the di-electric offset when calculating the Born
 -   radii. This is the offset between the center of each atom the
 -   center of the polarization energy for the corresponding atom
 -
 -.. mdp:: sa-algorithm
 -
 -   .. mdp-value:: Ace-approximation
 -
 -      Use an Ace-type approximation
 -
 -   .. mdp-value:: None
 -
 -      No non-polar solvation calculation done. For GBSA only the polar
 -      part gets calculated
 -
 -.. mdp:: sa-surface-tension
 -
 -   \[kJ mol-1 nm-2\]
 -   Default value for surface tension with SA algorithms. The default
 -   value is -1; Note that if this default value is not changed it will
 -   be overridden by :ref:`gmx grompp` using values that are specific
 -   for the choice of radii algorithm (0.0049 kcal/mol/Angstrom^2 for
 -   Still, 0.0054 kcal/mol/Angstrom2 for HCT/OBC) Setting it to 0 will
 -   while using an sa-algorithm other than None means no non-polar
 -   calculations are done.
 -
 -
  Computational Electrophysiology
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  Use these options to switch on and control ion/water position exchanges in "Computational
@@@ -3249,7 -3349,7 +3254,7 @@@ User defined thingie
  Removed features
  ^^^^^^^^^^^^^^^^
  
 -This feature has been removed from |Gromacs|, but so that old
 +These features have been removed from |Gromacs|, but so that old
  :ref:`mdp` and :ref:`tpr` files cannot be mistakenly misused, we still
  parse this option. :ref:`gmx grompp` and :ref:`gmx mdrun` will issue a
  fatal error if this is set.
  
     (no)
  
 +.. mdp:: implicit-solvent
 +
 +   (no)
 +
  .. _reference manual: gmx-manual-parent-dir_
index 29eae4f5ef586a9646973923ceece914d0f9d06e,6ae9835fb5c6754c7b244d3c7ddaf393f26c7054..0671b004de6972ff4b23427fbefa8ed78aaec411
@@@ -194,7 -194,7 +194,7 @@@ case
  * Cut-off treatment and/or long-range electrostatics treatment (see Van Der
    Spoel, D. & van Maaren, P. J. The origin of layer structure artifacts in
    simulations of liquid water. *J. Chem. Theor. Comp.* **2**, 1–11 (2006).)
- * Treatment of neighborlists,
+ * Treatment of pair lists,
  * Constraint algorithms (see e.g. Hess, B. P-LINCS: A parallel linear constraint
    solver for molecular simulation. *J. Chem. Theor. Comp.* **4**, 116–122
    (2008).)
@@@ -333,7 -333,7 +333,7 @@@ when addressing such a scenario
     to a breakdown in the model physics, even if the starting configuration of
     the system is reasonable.
  
 -If using implicit solvation, starting your equilibration with a smaller time
 +When using no explict solvent, starting your equilibration with a smaller time
  step than your production run can help energy equipartition more stably.
  
  There are several common situations in which instability frequently arises,
index 91e9e8de23bdf8faeebc28217caea500c4aa5e9f,81444cafdcee5a10b73927ba191bf2d516b52e67..00f28c633fd032235896eac981d872bfd7f28511
  
  #include <array>
  
 +#include "gromacs/gpu_utils/gputraits_ocl.h"
  #include "gromacs/gpu_utils/oclutils.h"
  
  #include "gpuregiontimer.h"
  
 -template <> struct GpuTraits<GpuFramework::OpenCL>
 -{
 -    using CommandStream = cl_command_queue;
 -    using CommandEvent  = cl_event;
 -};
 -
 -//! Short-hand for external use
 -using GpuRegionTimer = GpuRegionTimerWrapper<GpuFramework::OpenCL>;
 -
 -// cppcheck-suppress noConstructor
  /*! \libinternal \brief
-  * This is a GPU region timing implementation for OpenCL.
-  * It provides methods for measuring the last timespan.
-  * Copying/assignment is disabled since the underlying timing events are owned by this.
+  * The OpenCL implementation of the GPU code region timing.
+  * With OpenCL, one has to use cl_event handle for each API call that has to be timed, and
+  * accumulate the timing afterwards. As we would like to avoid overhead on API calls,
+  * we only query and accumulate cl_event timing at the end of time steps, not after the API calls.
+  * Thus, this implementation does not reuse a single cl_event for multiple calls, but instead
+  * maintains an array of cl_events to be used within any single code region.
+  * The array size is fixed at a small but sufficiently large value for the number of cl_events
+  * that might contribute to a timer region, currently 10.
   */
- // cppcheck-suppress noConstructor
 -template <> class GpuRegionTimerImpl<GpuFramework::OpenCL>
 +class GpuRegionTimerImpl
  {
 -    //! Short-hands
 -    using CommandStream = typename GpuTraits<GpuFramework::OpenCL>::CommandStream;
 -    using CommandEvent  = typename GpuTraits<GpuFramework::OpenCL>::CommandEvent;
 -
      /*! \brief The underlying individual timing events array.
       * The maximum size is chosen arbitrarily to work with current code, and can be changed.
       * There is simply no need for run-time resizing, and it's unlikely we'll ever need more than 10.
  
      public:
  
-         /*! \brief Will be called before the region start. */
 +        GpuRegionTimerImpl()  = default;
 +        ~GpuRegionTimerImpl() = default;
 +        //! No copying
 +        GpuRegionTimerImpl(const GpuRegionTimerImpl &)       = delete;
 +        //! No assignment
 +        GpuRegionTimerImpl &operator=(GpuRegionTimerImpl &&) = delete;
 +        //! Moving is disabled but can be considered in the future if needed
 +        GpuRegionTimerImpl(GpuRegionTimerImpl &&)            = delete;
 +
+         /*! \brief Should be called before the region start. */
          inline void openTimingRegion(CommandStream){}
-         /*! \brief Will be called after the region end. */
+         /*! \brief Should be called after the region end. */
          inline void closeTimingRegion(CommandStream){}
-         /*! \brief Returns the last measured region timespan (in milliseconds) and calls reset() */
+         /*! \brief Returns the last measured region timespan (in milliseconds) and calls reset(). */
          inline double getLastRangeTime()
          {
              double milliseconds = 0.0;
              reset();
              return milliseconds;
          }
-         /*! \brief Resets internal state */
+         /*! \brief Resets the internal state, releasing the used cl_events. */
          inline void reset()
          {
              for (size_t i = 0; i < currentEvent_; i++)
              {
                  if (events_[i]) // This conditional is ugly, but is required to make some tests (e.g. empty domain) pass
                  {
-                     GMX_ASSERT(CL_SUCCESS == clReleaseEvent(events_[i]), "OpenCL event release failure");
+                     cl_int gmx_unused cl_error = clReleaseEvent(events_[i]);
+                     GMX_ASSERT(CL_SUCCESS == cl_error, "OpenCL event release failure");
                  }
              }
              currentEvent_ = 0;
              // As long as we're doing nullptr checks, we might want to be extra cautious.
              events_.fill(nullptr);
          }
 -        /*! \brief Provides next unused cl_event for OpenCL API consumption. */
 +        /*! \brief Returns a new raw timing event
 +         * for passing into individual GPU API calls
 +         * within the region if the API requires it (e.g. on OpenCL).
 +         */
          inline CommandEvent *fetchNextEvent()
          {
              GMX_ASSERT(currentEvent_ < events_.size(), "Increase c_maxEventNumber_ if needed");
          }
  };
  
 +//! Short-hand for external use
 +using GpuRegionTimer = GpuRegionTimerWrapper<GpuRegionTimerImpl>;
 +
  #endif