thisRankHasDuty(cr, DUTY_PME) &&
(pme_run_mode(fr->pmedata) == PmeRunMode::CPU);
- const bool haveEwaldSurfaceTerms =
- EEL_PME_EWALD(fr->ic->eeltype) &&
- (ir->ewald_geometry != eewg3D || ir->epsilon_surface != 0);
+ const bool haveEwaldSurfaceTerm = haveEwaldSurfaceContribution(*ir);
/* Do long-range electrostatics and/or LJ-PME
* and compute PME surface terms when necessary.
*/
if (computePmeOnCpu ||
fr->ic->eeltype == eelEWALD ||
- haveEwaldSurfaceTerms)
+ haveEwaldSurfaceTerm)
{
int status = 0;
real Vlr_q = 0, Vlr_lj = 0;
if (EEL_PME_EWALD(fr->ic->eeltype) || EVDW_PME(fr->ic->vdwtype))
{
- /* Calculate Ewald surface terms, when necessary */
- if (haveEwaldSurfaceTerms)
+ /* Calculate the Ewald surface force and energy contributions, when necessary */
+ if (haveEwaldSurfaceTerm)
{
wallcycle_sub_start(wcycle, ewcsEWALD_CORRECTION);
// We assume we have local force work if there are CPU
// force tasks including PME or nonbondeds.
domainWork.haveCpuLocalForceWork = domainWork.haveSpecialForces || domainWork.haveCpuListedForceWork || domainWork.haveFreeEnergyWork ||
- simulationWork.useCpuNonbonded || simulationWork.useCpuPme ||
- (EEL_PME_EWALD(inputrec.coulombtype) && (inputrec.ewald_geometry == eewg3DC ||
- inputrec.epsilon_surface != 0)) ||
+ simulationWork.useCpuNonbonded || simulationWork.useCpuPme || simulationWork.haveEwaldSurfaceContribution ||
inputrec.nwall > 0;
+
return domainWork;
}
useGpuForUpdate,
devFlags.enableGpuBufferOps,
devFlags.enableGpuHaloExchange,
- devFlags.enableGpuPmePPComm);
+ devFlags.enableGpuPmePPComm,
+ haveEwaldSurfaceContribution(*inputrec));
std::unique_ptr<gmx::StatePropagatorDataGpu> stateGpu;
if (gpusWereDetected && ((useGpuForPme && thisRankHasDuty(cr, DUTY_PME)) || runScheduleWork.simulationWork.useGpuBufferOps))
return maxTemperature;
}
+
+bool haveEwaldSurfaceContribution(const t_inputrec &ir)
+{
+ return EEL_PME_EWALD(ir.coulombtype) && (ir.ewald_geometry == eewg3DC ||
+ ir.epsilon_surface != 0);
+}
*/
real maxReferenceTemperature(const t_inputrec &ir);
+/*! \brief Returns whether there is an Ewald surface contribution
+ */
+bool haveEwaldSurfaceContribution(const t_inputrec &ir);
+
#endif /* GMX_MDTYPES_INPUTREC_H */
bool useGpuPmePpCommunication = false;
//! If direct GPU-GPU communication is enabled.
bool useGpuDirectCommunication = false;
+ //! If there is an Ewald surface (dipole) term to compute
+ bool haveEwaldSurfaceContribution = false;
};
class MdrunScheduleWorkload
namespace gmx
{
-SimulationWorkload createSimulationWorkload(bool useGpuForNonbonded,
- PmeRunMode pmeRunMode,
- bool useGpuForBonded,
- bool useGpuForUpdate,
- bool useGpuForBufferOps,
- bool useGpuHaloExchange,
- bool useGpuPmePpComm)
+SimulationWorkload createSimulationWorkload(bool useGpuForNonbonded,
+ PmeRunMode pmeRunMode,
+ bool useGpuForBonded,
+ bool useGpuForUpdate,
+ bool useGpuForBufferOps,
+ bool useGpuHaloExchange,
+ bool useGpuPmePpComm,
+ bool haveEwaldSurfaceContribution)
{
SimulationWorkload simulationWorkload;
- simulationWorkload.useCpuNonbonded = !useGpuForNonbonded;
- simulationWorkload.useGpuNonbonded = useGpuForNonbonded;
- simulationWorkload.useCpuPme = (pmeRunMode == PmeRunMode::CPU);
- simulationWorkload.useGpuPme = (pmeRunMode == PmeRunMode::GPU || pmeRunMode == PmeRunMode::Mixed);
- simulationWorkload.useGpuPmeFft = (pmeRunMode == PmeRunMode::Mixed);
- simulationWorkload.useGpuBonded = useGpuForBonded;
- simulationWorkload.useGpuUpdate = useGpuForUpdate;
- simulationWorkload.useGpuBufferOps = useGpuForBufferOps || useGpuForUpdate;
- simulationWorkload.useGpuHaloExchange = useGpuHaloExchange;
- simulationWorkload.useGpuPmePpCommunication = useGpuPmePpComm;
- simulationWorkload.useGpuDirectCommunication = useGpuHaloExchange || useGpuPmePpComm;
+ simulationWorkload.useCpuNonbonded = !useGpuForNonbonded;
+ simulationWorkload.useGpuNonbonded = useGpuForNonbonded;
+ simulationWorkload.useCpuPme = (pmeRunMode == PmeRunMode::CPU);
+ simulationWorkload.useGpuPme = (pmeRunMode == PmeRunMode::GPU || pmeRunMode == PmeRunMode::Mixed);
+ simulationWorkload.useGpuPmeFft = (pmeRunMode == PmeRunMode::Mixed);
+ simulationWorkload.useGpuBonded = useGpuForBonded;
+ simulationWorkload.useGpuUpdate = useGpuForUpdate;
+ simulationWorkload.useGpuBufferOps = useGpuForBufferOps || useGpuForUpdate;
+ simulationWorkload.useGpuHaloExchange = useGpuHaloExchange;
+ simulationWorkload.useGpuPmePpCommunication = useGpuPmePpComm;
+ simulationWorkload.useGpuDirectCommunication = useGpuHaloExchange || useGpuPmePpComm;
+ simulationWorkload.haveEwaldSurfaceContribution = haveEwaldSurfaceContribution;
return simulationWorkload;
}
#include <vector>
+#include "gromacs/mdtypes/inputrec.h"
#include "gromacs/mdtypes/simulation_workload.h"
enum class PmeRunMode;
* Build datastructure that contains decisions whether to run different workload
* task on GPUs.
*
- * \param[in] useGpuForNonbonded If we have short-range nonbonded interactions
+ * \param[in] useGpuForNonbonded Whether we have short-range nonbonded interactions
* calculations on GPU(s).
* \param[in] pmeRunMode Run mode indicating what resource is PME execured on.
- * \param[in] useGpuForBonded If bonded interactions are calculated on GPU(s).
- * \param[in] useGpuForUpdate If coordinate update and constraint solving is performed on
+ * \param[in] useGpuForBonded Whether bonded interactions are calculated on GPU(s).
+ * \param[in] useGpuForUpdate Whether coordinate update and constraint solving is performed on
* GPU(s).
- * \param[in] useGpuForBufferOps If buffer ops / reduction are calculated on GPU(s).
- * \param[in] useGpuHaloExchange If GPU direct communication is used in halo exchange.
- * \param[in] useGpuPmePpComm If GPu direct communication is used in PME-PP communication.
+ * \param[in] useGpuForBufferOps Whether buffer ops / reduction are calculated on GPU(s).
+ * \param[in] useGpuHaloExchange Whether GPU direct communication is used in halo exchange.
+ * \param[in] useGpuPmePpComm Whether GPU direct communication is used in PME-PP communication.
+ * \param[in] haveEwaldSurfaceContribution Whether there is an Ewald surface contribution
* \returns Simulation lifetime constant workload description.
*/
-SimulationWorkload createSimulationWorkload(bool useGpuForNonbonded,
- PmeRunMode pmeRunMode,
- bool useGpuForBonded,
- bool useGpuForUpdate,
- bool useGpuForBufferOps,
- bool useGpuHaloExchange,
- bool useGpuPmePpComm);
-
+SimulationWorkload createSimulationWorkload(bool useGpuForNonbonded,
+ PmeRunMode pmeRunMode,
+ bool useGpuForBonded,
+ bool useGpuForUpdate,
+ bool useGpuForBufferOps,
+ bool useGpuHaloExchange,
+ bool useGpuPmePpComm,
+ bool haveEwaldSurfaceContribution);
} // namespace gmx