Apply re-formatting to C++ in src/ tree.
[alexxy/gromacs.git] / src / gromacs / nbnxm / pairlist_tuning.cpp
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
5  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6  * and including many others, as listed in the AUTHORS file in the
7  * top-level source directory and at http://www.gromacs.org.
8  *
9  * GROMACS is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public License
11  * as published by the Free Software Foundation; either version 2.1
12  * of the License, or (at your option) any later version.
13  *
14  * GROMACS is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with GROMACS; if not, see
21  * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
23  *
24  * If you want to redistribute modifications to GROMACS, please
25  * consider that scientific software is very special. Version
26  * control is crucial - bugs must be traceable. We will be happy to
27  * consider code for inclusion in the official distribution, but
28  * derived work must not be called official GROMACS. Details are found
29  * in the README & COPYING files - if they are missing, get the
30  * official version at http://www.gromacs.org.
31  *
32  * To help us fund GROMACS development, we humbly ask that you cite
33  * the research papers on the package. Check out http://www.gromacs.org.
34  */
35
36 /*! \internal \file
37  *
38  * \brief Implements functions for tuning adjustable parameters for the nbnxn non-bonded search and interaction kernels
39  *
40  * \author Berk Hess <hess@kth.se>
41  * \ingroup module_nbnxm
42  */
43
44 #include "gmxpre.h"
45
46 #include "pairlist_tuning.h"
47
48 #include <cassert>
49 #include <cmath>
50 #include <cstdlib>
51
52 #include <algorithm>
53 #include <string>
54
55 #include "gromacs/domdec/domdec.h"
56 #include "gromacs/hardware/cpuinfo.h"
57 #include "gromacs/math/vec.h"
58 #include "gromacs/mdlib/calc_verletbuf.h"
59 #include "gromacs/mdtypes/commrec.h"
60 #include "gromacs/mdtypes/inputrec.h"
61 #include "gromacs/mdtypes/interaction_const.h"
62 #include "gromacs/mdtypes/multipletimestepping.h"
63 #include "gromacs/mdtypes/state.h"
64 #include "gromacs/pbcutil/pbc.h"
65 #include "gromacs/topology/topology.h"
66 #include "gromacs/utility/cstringutil.h"
67 #include "gromacs/utility/fatalerror.h"
68 #include "gromacs/utility/gmxassert.h"
69 #include "gromacs/utility/logger.h"
70 #include "gromacs/utility/strconvert.h"
71 #include "gromacs/utility/stringutil.h"
72
73 #include "nbnxm_geometry.h"
74 #include "pairlistsets.h"
75
76 /*! \brief Returns if we can (heuristically) change nstlist and rlist
77  *
78  * \param [in] ir  The input parameter record
79  */
80 static bool supportsDynamicPairlistGenerationInterval(const t_inputrec& ir)
81 {
82     return ir.cutoff_scheme == ecutsVERLET && EI_DYNAMICS(ir.eI)
83            && !(EI_MD(ir.eI) && ir.etc == etcNO) && ir.verletbuf_tol > 0;
84 }
85
86 /*! \brief Cost of non-bonded kernels
87  *
88  * We determine the extra cost of the non-bonded kernels compared to
89  * a reference nstlist value of 10 (which is the default in grompp).
90  */
91 static const int nbnxnReferenceNstlist = 10;
92 //! The values to try when switching
93 const int nstlist_try[] = { 20, 25, 40, 50, 80, 100 };
94 //! Number of elements in the neighborsearch list trials.
95 #define NNSTL (sizeof(nstlist_try) / sizeof(nstlist_try[0]))
96 /* Increase nstlist until the size of the pair-list increased by
97  * \p c_nbnxnListSizeFactor??? or more, but never more than
98  * \p c_nbnxnListSizeFactor??? + \p c_nbnxnListSizeFactorMargin.
99  * Since we have dynamic pair list pruning, the force kernel cost depends
100  * only very weakly on nstlist. It depends strongly on nstlistPrune.
101  * Increasing nstlist mainly affects the cost of the pair search (down due
102  * to lower frequency, up due to larger list) and the list pruning kernel.
103  * We increase nstlist conservatively with regard to kernel performance.
104  * In serial the search cost is not high and thus we don't gain much by
105  * increasing nstlist a lot. In parallel the MPI and CPU-GPU communication
106  * volume as well as the communication buffer preparation and reduction time
107  * increase quickly with rlist and thus nslist. Therefore we should avoid
108  * large nstlist, even if that also reduces the domain decomposition cost.
109  * With GPUs we perform the dynamic pruning in a rolling fashion and this
110  * overlaps with the update on the CPU, which allows even larger nstlist.
111  */
112 // CPU: pair-search is a factor ~1.5 slower than the non-bonded kernel.
113 //! Target pair-list size increase ratio for CPU
114 static const float c_nbnxnListSizeFactorCpu = 1.25;
115 // Intel KNL: pair-search is a factor ~2-3 slower than the non-bonded kernel.
116 //! Target pair-list size increase ratio for Intel KNL
117 static const float c_nbnxnListSizeFactorIntelXeonPhi = 1.4;
118 // GPU: pair-search is a factor 1.5-3 slower than the non-bonded kernel.
119 //! Target pair-list size increase ratio for GPU
120 static const float c_nbnxnListSizeFactorGPU = 1.4;
121 //! Never increase the size of the pair-list more than the factor above plus this margin
122 static const float c_nbnxnListSizeFactorMargin = 0.1;
123
124 void increaseNstlist(FILE*               fp,
125                      t_commrec*          cr,
126                      t_inputrec*         ir,
127                      int                 nstlist_cmdline,
128                      const gmx_mtop_t*   mtop,
129                      const matrix        box,
130                      bool                useOrEmulateGpuForNonbondeds,
131                      const gmx::CpuInfo& cpuinfo)
132 {
133     if (!EI_DYNAMICS(ir->eI))
134     {
135         /* Can only increase nstlist with dynamics */
136         return;
137     }
138
139     float       listfac_ok, listfac_max;
140     int         nstlist_orig, nstlist_prev;
141     real        rlist_inc, rlist_ok, rlist_max;
142     real        rlist_new, rlist_prev;
143     size_t      nstlist_ind = 0;
144     gmx_bool    bBox, bDD, bCont;
145     const char* nstl_gpu =
146             "\nFor optimal performance with a GPU nstlist (now %d) should be larger.\nThe "
147             "optimum depends on your CPU and GPU resources.\nYou might want to try several "
148             "nstlist values.\n";
149     const char* nve_err = "Can not increase nstlist because an NVE ensemble is used";
150     const char* vbd_err =
151             "Can not increase nstlist because verlet-buffer-tolerance is not set or used";
152     const char* box_err = "Can not increase nstlist because the box is too small";
153     const char* dd_err  = "Can not increase nstlist because of domain decomposition limitations";
154     char        buf[STRLEN];
155
156     /* When most of the computation, and in particular the non-bondeds is only
157      * performed every ir->mtsFactor steps due to multiple time stepping,
158      * we scale all nstlist values by this factor.
159      */
160     const int mtsFactor = gmx::nonbondedMtsFactor(*ir);
161
162     if (nstlist_cmdline <= 0)
163     {
164         if (ir->nstlist <= mtsFactor)
165         {
166             /* The user probably set nstlist<=mtsFactor for a reason,
167              * don't mess with the settings, except when < mtsFactor.
168              */
169             ir->nstlist = mtsFactor;
170
171             return;
172         }
173
174         /* With a GPU and fixed nstlist suggest tuning nstlist */
175         if (fp != nullptr && useOrEmulateGpuForNonbondeds && ir->nstlist < nstlist_try[0] * mtsFactor
176             && !supportsDynamicPairlistGenerationInterval(*ir))
177         {
178             fprintf(fp, nstl_gpu, ir->nstlist);
179         }
180
181         nstlist_ind = 0;
182         while (nstlist_ind < NNSTL && ir->nstlist >= nstlist_try[nstlist_ind] * mtsFactor)
183         {
184             nstlist_ind++;
185         }
186         if (nstlist_ind == NNSTL)
187         {
188             /* There are no larger nstlist value to try */
189             return;
190         }
191     }
192
193     if (EI_MD(ir->eI) && ir->etc == etcNO)
194     {
195         if (MASTER(cr))
196         {
197             fprintf(stderr, "%s\n", nve_err);
198         }
199         if (fp != nullptr)
200         {
201             fprintf(fp, "%s\n", nve_err);
202         }
203
204         return;
205     }
206
207     if (ir->verletbuf_tol == 0 && useOrEmulateGpuForNonbondeds)
208     {
209         gmx_fatal(FARGS,
210                   "You are using an old tpr file with a GPU, please generate a new tpr file with "
211                   "an up to date version of grompp");
212     }
213
214     if (ir->verletbuf_tol < 0)
215     {
216         if (MASTER(cr))
217         {
218             fprintf(stderr, "%s\n", vbd_err);
219         }
220         if (fp != nullptr)
221         {
222             fprintf(fp, "%s\n", vbd_err);
223         }
224
225         return;
226     }
227
228     GMX_RELEASE_ASSERT(supportsDynamicPairlistGenerationInterval(*ir),
229                        "In all cases that do not support dynamic nstlist, we should have returned "
230                        "with an appropriate message above");
231
232     if (useOrEmulateGpuForNonbondeds)
233     {
234         listfac_ok = c_nbnxnListSizeFactorGPU;
235     }
236     else if (cpuinfo.brandString().find("Xeon Phi") != std::string::npos)
237     {
238         listfac_ok = c_nbnxnListSizeFactorIntelXeonPhi;
239     }
240     else
241     {
242         listfac_ok = c_nbnxnListSizeFactorCpu;
243     }
244     listfac_max = listfac_ok + c_nbnxnListSizeFactorMargin;
245
246     nstlist_orig = ir->nstlist;
247     if (nstlist_cmdline > 0)
248     {
249         if (fp)
250         {
251             sprintf(buf, "Getting nstlist=%d from command line option", nstlist_cmdline);
252         }
253         ir->nstlist = nstlist_cmdline;
254     }
255
256     ListSetupType listType =
257             (useOrEmulateGpuForNonbondeds ? ListSetupType::Gpu : ListSetupType::CpuSimdWhenSupported);
258     VerletbufListSetup listSetup = verletbufGetSafeListSetup(listType);
259
260     /* Allow rlist to make the list a given factor larger than the list
261      * would be with the reference value for nstlist (10*mtsFactor).
262      */
263     nstlist_prev = ir->nstlist;
264     ir->nstlist  = nbnxnReferenceNstlist * mtsFactor;
265     const real rlistWithReferenceNstlist =
266             calcVerletBufferSize(*mtop, det(box), *ir, ir->nstlist, ir->nstlist - 1, -1, listSetup);
267     ir->nstlist = nstlist_prev;
268
269     /* Determine the pair list size increase due to zero interactions */
270     rlist_inc = nbnxn_get_rlist_effective_inc(listSetup.cluster_size_j, mtop->natoms / det(box));
271     rlist_ok  = (rlistWithReferenceNstlist + rlist_inc) * std::cbrt(listfac_ok) - rlist_inc;
272     rlist_max = (rlistWithReferenceNstlist + rlist_inc) * std::cbrt(listfac_max) - rlist_inc;
273     if (debug)
274     {
275         fprintf(debug, "nstlist tuning: rlist_inc %.3f rlist_ok %.3f rlist_max %.3f\n", rlist_inc, rlist_ok, rlist_max);
276     }
277
278     nstlist_prev = nstlist_orig;
279     rlist_prev   = ir->rlist;
280     do
281     {
282         if (nstlist_cmdline <= 0)
283         {
284             ir->nstlist = nstlist_try[nstlist_ind] * mtsFactor;
285         }
286
287         /* Set the pair-list buffer size in ir */
288         rlist_new = calcVerletBufferSize(
289                 *mtop, det(box), *ir, ir->nstlist, ir->nstlist - mtsFactor, -1, listSetup);
290
291         /* Does rlist fit in the box? */
292         bBox = (gmx::square(rlist_new) < max_cutoff2(ir->pbcType, box));
293         bDD  = TRUE;
294         if (bBox && DOMAINDECOMP(cr))
295         {
296             /* Currently (as of July 2020), the code in this if clause is never executed.
297              * increaseNstlist(...) is only called from prepare_verlet_scheme, which in turns
298              * gets called by the runner _before_ setting up DD. DOMAINDECOMP(cr) will therefore
299              * always be false here. See #3334.
300              */
301             /* Check if rlist fits in the domain decomposition */
302             if (inputrec2nboundeddim(ir) < DIM)
303             {
304                 gmx_incons(
305                         "Changing nstlist with domain decomposition and unbounded dimensions is "
306                         "not implemented yet");
307             }
308             bDD = change_dd_cutoff(cr, box, gmx::ArrayRef<const gmx::RVec>(), rlist_new);
309         }
310
311         if (debug)
312         {
313             fprintf(debug,
314                     "nstlist %d rlist %.3f bBox %s bDD %s\n",
315                     ir->nstlist,
316                     rlist_new,
317                     gmx::boolToString(bBox),
318                     gmx::boolToString(bDD));
319         }
320
321         bCont = FALSE;
322
323         if (nstlist_cmdline <= 0)
324         {
325             if (bBox && bDD && rlist_new <= rlist_max)
326             {
327                 /* Increase nstlist */
328                 nstlist_prev = ir->nstlist;
329                 rlist_prev   = rlist_new;
330                 bCont        = (nstlist_ind + 1 < NNSTL && rlist_new < rlist_ok);
331             }
332             else
333             {
334                 /* Stick with the previous nstlist */
335                 ir->nstlist = nstlist_prev;
336                 rlist_new   = rlist_prev;
337                 bBox        = TRUE;
338                 bDD         = TRUE;
339             }
340         }
341
342         nstlist_ind++;
343     } while (bCont);
344
345     if (!bBox || !bDD)
346     {
347         gmx_warning("%s", !bBox ? box_err : dd_err);
348         if (fp != nullptr)
349         {
350             fprintf(fp, "\n%s\n", !bBox ? box_err : dd_err);
351         }
352         ir->nstlist = nstlist_orig;
353     }
354     else if (ir->nstlist != nstlist_orig || rlist_new != ir->rlist)
355     {
356         sprintf(buf,
357                 "Changing nstlist from %d to %d, rlist from %g to %g",
358                 nstlist_orig,
359                 ir->nstlist,
360                 ir->rlist,
361                 rlist_new);
362         if (MASTER(cr))
363         {
364             fprintf(stderr, "%s\n\n", buf);
365         }
366         if (fp != nullptr)
367         {
368             fprintf(fp, "%s\n\n", buf);
369         }
370         ir->rlist = rlist_new;
371     }
372 }
373
374 /*! \brief The interval in steps at which we perform dynamic, rolling pruning on a GPU.
375  *
376  * Ideally we should auto-tune this value.
377  * Not considering overheads, 1 would be the ideal value. But 2 seems
378  * a reasonable compromise that reduces GPU kernel launch overheads and
379  * also avoids inefficiency on large GPUs when pruning small lists.
380  * Because with domain decomposition we alternate local/non-local pruning
381  * at even/odd steps, which gives a period of 2, this value currenly needs
382  * to be 2, which is indirectly asserted when the GPU pruning is dispatched
383  * during the force evaluation.
384  */
385 static const int c_nbnxnGpuRollingListPruningInterval = 2;
386
387 /*! \brief The minimum nstlist for dynamic pair list pruning.
388  *
389  * In most cases going lower than 4 will lead to a too high pruning cost.
390  * This value should be a multiple of \p c_nbnxnGpuRollingListPruningInterval
391  */
392 static const int c_nbnxnDynamicListPruningMinLifetime = 4;
393
394 /*! \brief Set the dynamic pairlist pruning parameters in \p ic
395  *
396  * \param[in]     ir          The input parameter record
397  * \param[in]     mtop        The global topology
398  * \param[in]     box         The unit cell
399  * \param[in]     useGpuList  Tells if we are using a GPU type pairlist
400  * \param[in]     listSetup   The nbnxn pair list setup
401  * \param[in]     userSetNstlistPrune  The user set ic->nstlistPrune (using an env.var.)
402  * \param[in] ic              The nonbonded interactions constants
403  * \param[in,out] listParams  The list setup parameters
404  */
405 static void setDynamicPairlistPruningParameters(const t_inputrec*          ir,
406                                                 const gmx_mtop_t*          mtop,
407                                                 const matrix               box,
408                                                 const bool                 useGpuList,
409                                                 const VerletbufListSetup&  listSetup,
410                                                 const bool                 userSetNstlistPrune,
411                                                 const interaction_const_t* ic,
412                                                 PairlistParams*            listParams)
413 {
414     /* When applying multiple time stepping to the non-bonded forces,
415      * we only compute them every mtsFactor steps, so all parameters here
416      * should be a multiple of mtsFactor.
417      */
418     listParams->mtsFactor = gmx::nonbondedMtsFactor(*ir);
419
420     const int mtsFactor = listParams->mtsFactor;
421
422     GMX_RELEASE_ASSERT(ir->nstlist % mtsFactor == 0, "nstlist should be a multiple of mtsFactor");
423
424     listParams->lifetime = ir->nstlist - mtsFactor;
425
426     /* When nstlistPrune was set by the user, we need to execute one loop
427      * iteration to determine rlistInner.
428      * Otherwise we compute rlistInner and increase nstlist as long as
429      * we have a pairlist buffer of length 0 (i.e. rlistInner == cutoff).
430      */
431     const real interactionCutoff = std::max(ic->rcoulomb, ic->rvdw);
432     int        tunedNstlistPrune = listParams->nstlistPrune;
433     do
434     {
435         /* Dynamic pruning on the GPU is performed on the list for
436          * the next step on the coordinates of the current step,
437          * so the list lifetime is nstlistPrune (not the usual nstlist-mtsFactor).
438          */
439         int listLifetime         = tunedNstlistPrune - (useGpuList ? 0 : mtsFactor);
440         listParams->nstlistPrune = tunedNstlistPrune;
441         listParams->rlistInner   = calcVerletBufferSize(
442                 *mtop, det(box), *ir, tunedNstlistPrune, listLifetime, -1, listSetup);
443
444         /* On the GPU we apply the dynamic pruning in a rolling fashion
445          * every c_nbnxnGpuRollingListPruningInterval steps,
446          * so keep nstlistPrune a multiple of the interval.
447          */
448         tunedNstlistPrune += (useGpuList ? c_nbnxnGpuRollingListPruningInterval : 1) * mtsFactor;
449     } while (!userSetNstlistPrune && tunedNstlistPrune < ir->nstlist
450              && listParams->rlistInner == interactionCutoff);
451
452     if (userSetNstlistPrune)
453     {
454         listParams->useDynamicPruning = true;
455     }
456     else
457     {
458         /* Determine the pair list size increase due to zero interactions */
459         real rlistInc = nbnxn_get_rlist_effective_inc(listSetup.cluster_size_j, mtop->natoms / det(box));
460
461         /* Dynamic pruning is only useful when the inner list is smaller than
462          * the outer. The factor 0.99 ensures at least 3% list size reduction.
463          *
464          * With dynamic pruning on the CPU we prune after updating,
465          * so nstlistPrune=nstlist-1 would add useless extra work.
466          * With the GPU there will probably be more overhead than gain
467          * with nstlistPrune=nstlist-1, so we disable dynamic pruning.
468          * Note that in such cases the first sub-condition is likely also false.
469          */
470         listParams->useDynamicPruning =
471                 (listParams->rlistInner + rlistInc < 0.99 * (listParams->rlistOuter + rlistInc)
472                  && listParams->nstlistPrune < listParams->lifetime);
473     }
474
475     if (!listParams->useDynamicPruning)
476     {
477         /* These parameters should not be used, but set them to useful values */
478         listParams->nstlistPrune = -1;
479         listParams->rlistInner   = listParams->rlistOuter;
480     }
481 }
482
483 /*! \brief Returns a string describing the setup of a single pair-list
484  *
485  * \param[in] listName           Short name of the list, can be ""
486  * \param[in] nstList            The list update interval in steps
487  * \param[in] nstListForSpacing  Update interval for setting the number characters for printing \p nstList
488  * \param[in] rList              List cut-off radius
489  * \param[in] interactionCutoff  The interaction cut-off, use for printing the list buffer size
490  */
491 static std::string formatListSetup(const std::string& listName,
492                                    int                nstList,
493                                    int                nstListForSpacing,
494                                    real               rList,
495                                    real               interactionCutoff)
496 {
497     std::string listSetup = "  ";
498     if (!listName.empty())
499     {
500         listSetup += listName + " list: ";
501     }
502     listSetup += "updated every ";
503     // Make the shortest int format string that fits nstListForSpacing
504     std::string nstListFormat =
505             "%" + gmx::formatString("%zu", gmx::formatString("%d", nstListForSpacing).size()) + "d";
506     listSetup += gmx::formatString(nstListFormat.c_str(), nstList);
507     listSetup += gmx::formatString(
508             " steps, buffer %.3f nm, rlist %.3f nm\n", rList - interactionCutoff, rList);
509
510     return listSetup;
511 }
512
513 void setupDynamicPairlistPruning(const gmx::MDLogger&       mdlog,
514                                  const t_inputrec*          ir,
515                                  const gmx_mtop_t*          mtop,
516                                  matrix                     box,
517                                  const interaction_const_t* ic,
518                                  PairlistParams*            listParams)
519 {
520     GMX_RELEASE_ASSERT(listParams->rlistOuter > 0, "With the nbnxn setup rlist should be > 0");
521
522     /* Initialize the parameters to no dynamic list pruning */
523     listParams->useDynamicPruning = false;
524
525     const VerletbufListSetup ls = { IClusterSizePerListType[listParams->pairlistType],
526                                     JClusterSizePerListType[listParams->pairlistType] };
527
528     /* Currently emulation mode does not support dual pair-lists */
529     const bool useGpuList = (listParams->pairlistType == PairlistType::HierarchicalNxN);
530
531     if (supportsDynamicPairlistGenerationInterval(*ir) && getenv("GMX_DISABLE_DYNAMICPRUNING") == nullptr)
532     {
533         /* Note that nstlistPrune can have any value independently of nstlist.
534          * Actually applying rolling pruning is only useful when
535          * nstlistPrune < nstlist -1
536          */
537         char* env                 = getenv("GMX_NSTLIST_DYNAMICPRUNING");
538         bool  userSetNstlistPrune = (env != nullptr);
539
540         if (userSetNstlistPrune)
541         {
542             char* end;
543             listParams->nstlistPrune = strtol(env, &end, 10);
544             if (!end || (*end != 0)
545                 || !(listParams->nstlistPrune > 0 && listParams->nstlistPrune < ir->nstlist))
546             {
547                 gmx_fatal(FARGS,
548                           "Invalid value passed in GMX_NSTLIST_DYNAMICPRUNING=%s, should be > 0 "
549                           "and < nstlist",
550                           env);
551             }
552         }
553         else
554         {
555             static_assert(c_nbnxnDynamicListPruningMinLifetime % c_nbnxnGpuRollingListPruningInterval == 0,
556                           "c_nbnxnDynamicListPruningMinLifetime sets the starting value for "
557                           "nstlistPrune, which should be divisible by the rolling pruning interval "
558                           "for efficiency reasons.");
559
560             // TODO: Use auto-tuning to determine nstlistPrune
561             listParams->nstlistPrune = c_nbnxnDynamicListPruningMinLifetime;
562         }
563
564         setDynamicPairlistPruningParameters(
565                 ir, mtop, box, useGpuList, ls, userSetNstlistPrune, ic, listParams);
566
567         if (listParams->useDynamicPruning && useGpuList)
568         {
569             /* Note that we can round down here. This makes the effective
570              * rolling pruning interval slightly shorter than nstlistTune,
571              * thus giving correct results, but a slightly lower efficiency.
572              */
573             GMX_RELEASE_ASSERT(listParams->nstlistPrune >= c_nbnxnGpuRollingListPruningInterval,
574                                ("With dynamic list pruning on GPUs pruning frequency must be at "
575                                 "least as large as the rolling pruning interval ("
576                                 + std::to_string(c_nbnxnGpuRollingListPruningInterval) + ").")
577                                        .c_str());
578             listParams->numRollingPruningParts =
579                     listParams->nstlistPrune / c_nbnxnGpuRollingListPruningInterval;
580         }
581         else
582         {
583             listParams->numRollingPruningParts = 1;
584         }
585     }
586
587     std::string mesg;
588
589     const real interactionCutoff = std::max(ic->rcoulomb, ic->rvdw);
590     if (listParams->useDynamicPruning)
591     {
592         mesg += gmx::formatString(
593                 "Using a dual %dx%d pair-list setup updated with dynamic%s pruning:\n",
594                 ls.cluster_size_i,
595                 ls.cluster_size_j,
596                 listParams->numRollingPruningParts > 1 ? ", rolling" : "");
597         mesg += formatListSetup("outer", ir->nstlist, ir->nstlist, listParams->rlistOuter, interactionCutoff);
598         mesg += formatListSetup(
599                 "inner", listParams->nstlistPrune, ir->nstlist, listParams->rlistInner, interactionCutoff);
600     }
601     else
602     {
603         mesg += gmx::formatString("Using a %dx%d pair-list setup:\n", ls.cluster_size_i, ls.cluster_size_j);
604         mesg += formatListSetup("", ir->nstlist, ir->nstlist, listParams->rlistOuter, interactionCutoff);
605     }
606     if (supportsDynamicPairlistGenerationInterval(*ir))
607     {
608         const VerletbufListSetup listSetup1x1 = { 1, 1 };
609         const real               rlistOuter   = calcVerletBufferSize(
610                 *mtop, det(box), *ir, ir->nstlist, ir->nstlist - 1, -1, listSetup1x1);
611         real rlistInner = rlistOuter;
612         if (listParams->useDynamicPruning)
613         {
614             int listLifeTime = listParams->nstlistPrune - (useGpuList ? 0 : 1);
615             rlistInner       = calcVerletBufferSize(
616                     *mtop, det(box), *ir, listParams->nstlistPrune, listLifeTime, -1, listSetup1x1);
617         }
618
619         mesg += gmx::formatString(
620                 "At tolerance %g kJ/mol/ps per atom, equivalent classical 1x1 list would be:\n",
621                 ir->verletbuf_tol);
622         if (listParams->useDynamicPruning)
623         {
624             mesg += formatListSetup("outer", ir->nstlist, ir->nstlist, rlistOuter, interactionCutoff);
625             mesg += formatListSetup(
626                     "inner", listParams->nstlistPrune, ir->nstlist, rlistInner, interactionCutoff);
627         }
628         else
629         {
630             mesg += formatListSetup("", ir->nstlist, ir->nstlist, rlistOuter, interactionCutoff);
631         }
632     }
633
634     GMX_LOG(mdlog.info).asParagraph().appendText(mesg);
635 }