Remove 1 pulse DD request
authorBerk Hess <hess@kth.se>
Fri, 24 Jan 2020 13:59:21 +0000 (14:59 +0100)
committerArtem Zhmurov <zhmurov@gmail.com>
Sat, 15 Feb 2020 16:52:21 +0000 (17:52 +0100)
Since the CUDA DD code now supports multiple pulses this is no longer
needed.

Refs #3106

Change-Id: I2db1d3cf45d9b0c814c0897a048bc5efb9f99e79

src/gromacs/domdec/builder.h
src/gromacs/domdec/domdec.cpp
src/gromacs/domdec/domdec_internal.h
src/gromacs/domdec/domdec_setup.cpp
src/gromacs/domdec/domdec_setup.h

index 067524997d0b398e3ff046db79af66de3081c09b..ea31080c627bc71ef338f66a129671dcb079d6c6 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -79,7 +79,7 @@ public:
                                t_commrec*           cr,
                                const DomdecOptions& options,
                                const MdrunOptions&  mdrunOptions,
-                               bool                 prefer1DAnd1Pulse,
+                               bool                 prefer1D,
                                const gmx_mtop_t&    mtop,
                                const t_inputrec&    ir,
                                const matrix         box,
index 13b7a33e2b0b8170538e5f7251cf6d65f639db56..e42765cc8f6f81e1f815caf0c8649276d52b7ef2 100644 (file)
@@ -2736,15 +2736,8 @@ static void set_cell_limits_dlb(const gmx::MDLogger& mdlog,
     comm->bVacDLBNoLimit = (ir->pbcType == PbcType::No);
     for (d = 0; d < dd->ndim; d++)
     {
-        if (comm->ddSettings.request1DAnd1Pulse)
-        {
-            comm->cd[d].np_dlb = 1;
-        }
-        else
-        {
-            comm->cd[d].np_dlb = std::min(npulse, dd->numCells[dd->dim[d]] - 1);
-            comm->maxpulse     = std::max(comm->maxpulse, comm->cd[d].np_dlb);
-        }
+        comm->cd[d].np_dlb = std::min(npulse, dd->numCells[dd->dim[d]] - 1);
+        comm->maxpulse     = std::max(comm->maxpulse, comm->cd[d].np_dlb);
         if (comm->cd[d].np_dlb < dd->numCells[dd->dim[d]] - 1)
         {
             comm->bVacDLBNoLimit = FALSE;
@@ -2864,7 +2857,7 @@ static DDSettings getDDSettings(const gmx::MDLogger&     mdlog,
 
     ddSettings.useSendRecv2        = (dd_getenv(mdlog, "GMX_DD_USE_SENDRECV2", 0) != 0);
     ddSettings.dlb_scale_lim       = dd_getenv(mdlog, "GMX_DLB_MAX_BOX_SCALING", 10);
-    ddSettings.request1DAnd1Pulse  = bool(dd_getenv(mdlog, "GMX_DD_1D_1PULSE", 0));
+    ddSettings.request1D           = bool(dd_getenv(mdlog, "GMX_DD_1D", 0));
     ddSettings.useDDOrderZYX       = bool(dd_getenv(mdlog, "GMX_DD_ORDER_ZYX", 0));
     ddSettings.useCartesianReorder = bool(dd_getenv(mdlog, "GMX_NO_CART_REORDER", 1));
     ddSettings.eFlop               = dd_getenv(mdlog, "GMX_DLB_BASED_ON_FLOPS", 0);
@@ -2903,9 +2896,9 @@ static DDSettings getDDSettings(const gmx::MDLogger&     mdlog,
 
 gmx_domdec_t::gmx_domdec_t(const t_inputrec& ir) : unitCellInfo(ir) {}
 
-/*! \brief Return whether the simulation described can run a 1D single-pulse DD.
+/*! \brief Return whether the simulation described can run a 1D DD.
  *
- * The GPU halo exchange code requires a 1D single-pulse DD. Such a DD
+ * The GPU halo exchange code requires 1D DD. Such a DD
  * generally requires a larger box than other possible decompositions
  * with the same rank count, so the calling code might need to decide
  * what is the most appropriate way to run the simulation based on
@@ -2920,33 +2913,33 @@ gmx_domdec_t::gmx_domdec_t(const t_inputrec& ir) : unitCellInfo(ir) {}
  * exchange code path. The number of PME ranks, if any, should be set
  * in \c options.numPmeRanks.
  */
-static bool canMake1DAnd1PulseDomainDecomposition(const DDSettings&              ddSettingsOriginal,
-                                                  const t_commrec*               cr,
-                                                  const int                      numRanksRequested,
-                                                  const DomdecOptions&           options,
-                                                  const gmx_mtop_t&              mtop,
-                                                  const t_inputrec&              ir,
-                                                  const matrix                   box,
-                                                  gmx::ArrayRef<const gmx::RVec> xGlobal)
+static bool canMake1DDomainDecomposition(const DDSettings&              ddSettingsOriginal,
+                                         const t_commrec*               cr,
+                                         const int                      numRanksRequested,
+                                         const DomdecOptions&           options,
+                                         const gmx_mtop_t&              mtop,
+                                         const t_inputrec&              ir,
+                                         const matrix                   box,
+                                         gmx::ArrayRef<const gmx::RVec> xGlobal)
 {
     // Ensure we don't write any output from this checking routine
     gmx::MDLogger dummyLogger;
 
     DDSystemInfo systemInfo = getSystemInfo(dummyLogger, cr, options, mtop, ir, box, xGlobal);
 
-    DDSettings ddSettings             = ddSettingsOriginal;
-    ddSettings.request1DAnd1Pulse     = true;
-    const real gridSetupCellsizeLimit = getDDGridSetupCellSizeLimit(
-            dummyLogger, ddSettings.request1DAnd1Pulse, !isDlbDisabled(ddSettings.initialDlbState),
-            options.dlbScaling, ir, systemInfo.cellsizeLimit);
+    DDSettings ddSettings = ddSettingsOriginal;
+    ddSettings.request1D  = true;
+    const real gridSetupCellsizeLimit =
+            getDDGridSetupCellSizeLimit(dummyLogger, !isDlbDisabled(ddSettings.initialDlbState),
+                                        options.dlbScaling, ir, systemInfo.cellsizeLimit);
     gmx_ddbox_t ddbox = { 0 };
     DDGridSetup ddGridSetup =
             getDDGridSetup(dummyLogger, cr, numRanksRequested, options, ddSettings, systemInfo,
                            gridSetupCellsizeLimit, mtop, ir, box, xGlobal, &ddbox);
 
-    const bool canMakeDDWith1DAnd1Pulse = (ddGridSetup.numDomains[XX] != 0);
+    const bool canMake1DDD = (ddGridSetup.numDomains[XX] != 0);
 
-    return canMakeDDWith1DAnd1Pulse;
+    return canMake1DDD;
 }
 
 bool is1D(const gmx_domdec_t& dd)
@@ -2972,7 +2965,7 @@ public:
          t_commrec*           cr,
          const DomdecOptions& options,
          const MdrunOptions&  mdrunOptions,
-         bool                 prefer1DAnd1Pulse,
+         bool                 prefer1D,
          const gmx_mtop_t&    mtop,
          const t_inputrec&    ir,
          const matrix         box,
@@ -3020,7 +3013,7 @@ DomainDecompositionBuilder::Impl::Impl(const MDLogger&      mdlog,
                                        t_commrec*           cr,
                                        const DomdecOptions& options,
                                        const MdrunOptions&  mdrunOptions,
-                                       const bool           prefer1DAnd1Pulse,
+                                       const bool           prefer1D,
                                        const gmx_mtop_t&    mtop,
                                        const t_inputrec&    ir,
                                        const matrix         box,
@@ -3035,11 +3028,10 @@ DomainDecompositionBuilder::Impl::Impl(const MDLogger&      mdlog,
 
     ddSettings_ = getDDSettings(mdlog_, options_, mdrunOptions, ir_);
 
-    if (prefer1DAnd1Pulse
-        && canMake1DAnd1PulseDomainDecomposition(ddSettings_, cr_, cr_->nnodes, options_, mtop_,
-                                                 ir_, box, xGlobal))
+    if (prefer1D
+        && canMake1DDomainDecomposition(ddSettings_, cr_, cr_->nnodes, options_, mtop_, ir_, box, xGlobal))
     {
-        ddSettings_.request1DAnd1Pulse = true;
+        ddSettings_.request1D = true;
     }
 
     if (ddSettings_.eFlop > 1)
@@ -3058,9 +3050,9 @@ DomainDecompositionBuilder::Impl::Impl(const MDLogger&      mdlog,
     // DD grid setup uses a more different cell size limit for
     // automated setup than the one in systemInfo_. The latter is used
     // in set_dd_limits() to configure DLB, for example.
-    const real gridSetupCellsizeLimit = getDDGridSetupCellSizeLimit(
-            mdlog_, ddSettings_.request1DAnd1Pulse, !isDlbDisabled(ddSettings_.initialDlbState),
-            options_.dlbScaling, ir_, systemInfo_.cellsizeLimit);
+    const real gridSetupCellsizeLimit =
+            getDDGridSetupCellSizeLimit(mdlog_, !isDlbDisabled(ddSettings_.initialDlbState),
+                                        options_.dlbScaling, ir_, systemInfo_.cellsizeLimit);
     ddGridSetup_ = getDDGridSetup(mdlog_, cr_, numRanksRequested, options_, ddSettings_, systemInfo_,
                                   gridSetupCellsizeLimit, mtop_, ir_, box, xGlobal, &ddbox_);
     checkDDGridSetup(ddGridSetup_, cr_, options_, ddSettings_, systemInfo_, gridSetupCellsizeLimit, ddbox_);
@@ -3109,12 +3101,12 @@ DomainDecompositionBuilder::DomainDecompositionBuilder(const MDLogger&      mdlo
                                                        t_commrec*           cr,
                                                        const DomdecOptions& options,
                                                        const MdrunOptions&  mdrunOptions,
-                                                       const bool           prefer1DAnd1Pulse,
+                                                       const bool           prefer1D,
                                                        const gmx_mtop_t&    mtop,
                                                        const t_inputrec&    ir,
                                                        const matrix         box,
                                                        ArrayRef<const RVec> xGlobal) :
-    impl_(new Impl(mdlog, cr, options, mdrunOptions, prefer1DAnd1Pulse, mtop, ir, box, xGlobal))
+    impl_(new Impl(mdlog, cr, options, mdrunOptions, prefer1D, mtop, ir, box, xGlobal))
 {
 }
 
@@ -3153,11 +3145,6 @@ static gmx_bool test_dd_cutoff(t_commrec* cr, const matrix box, gmx::ArrayRef<co
 
         np = 1 + static_cast<int>(cutoffRequested * inv_cell_size * ddbox.skew_fac[dim]);
 
-        if (dd->comm->ddSettings.request1DAnd1Pulse && np > 1)
-        {
-            return FALSE;
-        }
-
         if (!isDlbDisabled(dd->comm) && (dim < ddbox.npbcdim) && (dd->comm->cd[d].np_dlb > 0))
         {
             if (np > dd->comm->cd[d].np_dlb)
index 4fc03e3f4631c401f3489a76f838a63549a654a2..151e544adca0f4d834013d4584518769991144a1 100644 (file)
@@ -473,8 +473,8 @@ struct DDSettings
     //! Flop counter (0=no,1=yes,2=with (eFlop-1)*5% noise
     int eFlop = 0;
 
-    //! Request 1D domain decomposition with maximum one communication pulse
-    bool request1DAnd1Pulse;
+    //! Request 1D domain decomposition
+    bool request1D;
 
     //! Whether to order the DD dimensions from z to x
     bool useDDOrderZYX = false;
index 7799aec5ae25044b6f3384b7b8ff6ff58b9781f4..a22ef72b091fbda0a2707db25bce5bac54fef8de 100644 (file)
@@ -639,7 +639,7 @@ static gmx::IVec optimizeDDCells(const gmx::MDLogger& mdlog,
                                  const int            numRanksRequested,
                                  const int            numPmeOnlyRanks,
                                  const real           cellSizeLimit,
-                                 const bool           request1DAnd1Pulse,
+                                 const bool           request1D,
                                  const gmx_mtop_t&    mtop,
                                  const matrix         box,
                                  const gmx_ddbox_t&   ddbox,
@@ -716,24 +716,19 @@ static gmx::IVec optimizeDDCells(const gmx::MDLogger& mdlog,
 
     gmx::IVec itry       = { 1, 1, 1 };
     gmx::IVec numDomains = { 0, 0, 0 };
-    assign_factors(cellSizeLimit, request1DAnd1Pulse, systemInfo.cutoff, box, ddbox, mtop.natoms, ir,
-                   pbcdxr, numRanksDoingPmeWork, div.size(), div.data(), mdiv.data(), &itry, &numDomains);
+    assign_factors(cellSizeLimit, request1D, systemInfo.cutoff, box, ddbox, mtop.natoms, ir, pbcdxr,
+                   numRanksDoingPmeWork, div.size(), div.data(), mdiv.data(), &itry, &numDomains);
 
     return numDomains;
 }
 
 real getDDGridSetupCellSizeLimit(const gmx::MDLogger& mdlog,
-                                 const bool           request1DAnd1Pulse,
                                  const bool           bDynLoadBal,
                                  const real           dlb_scale,
                                  const t_inputrec&    ir,
-                                 const real           systemInfoCellSizeLimit)
+                                 real                 systemInfoCellSizeLimit)
 {
     real cellSizeLimit = systemInfoCellSizeLimit;
-    if (request1DAnd1Pulse)
-    {
-        cellSizeLimit = std::max(cellSizeLimit, ir.rlist);
-    }
 
     /* Add a margin for DLB and/or pressure scaling */
     if (bDynLoadBal)
@@ -918,11 +913,11 @@ DDGridSetup getDDGridSetup(const gmx::MDLogger&           mdlog,
 {
     int numPmeOnlyRanks = getNumPmeOnlyRanksToUse(mdlog, options, mtop, ir, box, numRanksRequested);
 
-    if (ddSettings.request1DAnd1Pulse && (numRanksRequested - numPmeOnlyRanks == 1))
+    if (ddSettings.request1D && (numRanksRequested - numPmeOnlyRanks == 1))
     {
         // With only one PP rank, there will not be a need for
         // GPU-based halo exchange that wants to request that any DD
-        // has only 1 dimension and 1 pulse.
+        // has only 1 dimension.
         return DDGridSetup{};
     }
 
@@ -940,7 +935,7 @@ DDGridSetup getDDGridSetup(const gmx::MDLogger&           mdlog,
         if (MASTER(cr))
         {
             numDomains = optimizeDDCells(mdlog, numRanksRequested, numPmeOnlyRanks, cellSizeLimit,
-                                         ddSettings.request1DAnd1Pulse, mtop, box, *ddbox, ir, systemInfo);
+                                         ddSettings.request1D, mtop, box, *ddbox, ir, systemInfo);
         }
     }
 
index 210fe44a5ca527afac5c2687e5f229bcaf00607d..6fbb50d283a76e92fa25920d884a39f9fff1e3a9 100644 (file)
@@ -92,7 +92,6 @@ void checkForValidRankCountRequests(int  numRanksRequested,
 
 /*! \brief Return the minimum cell size (in nm) required for DD */
 real getDDGridSetupCellSizeLimit(const gmx::MDLogger& mdlog,
-                                 bool                 request1DAnd1Pulse,
                                  bool                 bDynLoadBal,
                                  real                 dlb_scale,
                                  const t_inputrec&    ir,