-/*! \brief Return whether the simulation described can run a 1D 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
- * whether such a DD is possible.
- *
- * This function works like init_domain_decomposition(), but will not
- * give a fatal error, and only uses \c cr for communicating between
- * ranks.
- *
- * It is safe to call before thread-MPI spawns ranks, so that
- * thread-MPI can decide whether and how to trigger the GPU halo
- * exchange code path. The number of PME ranks, if any, should be set
- * in \c options.numPmeRanks.
- */
-static bool canMake1DDomainDecomposition(const DDSettings& ddSettingsOriginal,
- DDRole ddRole,
- MPI_Comm communicator,
- 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, ddRole, communicator, options, mtop, ir, box, xGlobal);
-
- 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, ddRole, communicator, numRanksRequested, options, ddSettings,
- systemInfo, gridSetupCellsizeLimit, mtop, ir, box, xGlobal, &ddbox);
-
- const bool canMake1DDD = (ddGridSetup.numDomains[XX] != 0);
-
- return canMake1DDD;
-}
-
-bool is1D(const gmx_domdec_t& dd)
-{
- const int maxDimensionSize = std::max(dd.numCells[XX], std::max(dd.numCells[YY], dd.numCells[ZZ]));
- const int productOfDimensionSizes = dd.numCells[XX] * dd.numCells[YY] * dd.numCells[ZZ];
- const bool decompositionHasOneDimension = (maxDimensionSize == productOfDimensionSizes);
-
- return decompositionHasOneDimension;
-}
-