# GPU update flag enables GPU update+constraints as well as buffer ops (dependency)
if context.opts.gpuupdate:
context.env.set_env_var('GMX_FORCE_UPDATE_DEFAULT_GPU', "1")
+ context.env.set_env_var('GMX_GPU_DD_COMMS', "1")
+ context.env.set_env_var('GMX_GPU_PME_PP_COMMS', "1")
regressiontests_path = context.workspace.get_project_dir(Project.REGRESSIONTESTS)
// Note: GPU update + DD without direct communication is not supported,
// a waitCoordinatesReadyOnHost() should be issued if it will be.
GMX_ASSERT(!simulationWork.useGpuUpdate,
- "GPU update is not supported with halo exchange");
+ "GPU update is not supported with CPU halo exchange");
dd_move_x(cr->dd, box, x.unpaddedArrayRef(), wcycle);
}
const bool useUpdateGroups = cr->dd ? ddUsesUpdateGroups(*cr->dd) : false;
useGpuForUpdate = decideWhetherToUseGpuForUpdate(
- devFlags.forceGpuUpdateDefault, useDomainDecomposition, useUpdateGroups, useGpuForPme,
- useGpuForNonbonded, updateTarget, gpusWereDetected, *inputrec, mtop, doEssentialDynamics,
- gmx_mtop_ftype_count(mtop, F_ORIRES) > 0, replExParams.exchangeInterval > 0, doRerun);
+ devFlags.forceGpuUpdateDefault, useDomainDecomposition, useUpdateGroups, pmeRunMode,
+ domdecOptions.numPmeRanks > 0, useGpuForNonbonded, updateTarget, gpusWereDetected,
+ *inputrec, mtop, doEssentialDynamics, gmx_mtop_ftype_count(mtop, F_ORIRES) > 0,
+ replExParams.exchangeInterval > 0, doRerun);
}
GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR
bool decideWhetherToUseGpuForUpdate(const bool forceGpuUpdateDefault,
const bool isDomainDecomposition,
const bool useUpdateGroups,
- const bool useGpuForPme,
+ const PmeRunMode pmeRunMode,
+ const bool havePmeOnlyRank,
const bool useGpuForNonbonded,
const TaskTarget updateTarget,
const bool gpusWereDetected,
// Using the GPU-version of update if:
// 1. PME is on the GPU (there should be a copy of coordinates on GPU for PME spread), or
// 2. Non-bonded interactions are on the GPU.
- if (!(useGpuForPme || useGpuForNonbonded))
+ if (pmeRunMode == PmeRunMode::CPU && !useGpuForNonbonded)
{
errorMessage +=
"Either PME or short-ranged non-bonded interaction tasks must run on the GPU.\n";
}
+ // Since only direct GPU communications are supported with GPU update, PME should be fully offloaded in DD and PME only cases.
+ if (pmeRunMode != PmeRunMode::GPU && (isDomainDecomposition || havePmeOnlyRank))
+ {
+ errorMessage += "PME should run on GPU.\n";
+ }
if (!gpusWereDetected)
{
errorMessage += "Compatible GPUs must have been found.\n";
struct gmx_hw_info_t;
struct gmx_mtop_t;
struct t_inputrec;
+enum class PmeRunMode;
namespace gmx
{
* \param[in] forceGpuUpdateDefault If update should run on GPU by default.
* \param[in] isDomainDecomposition Whether there more than one domain.
* \param[in] useUpdateGroups If the constraints can be split across domains.
- * \param[in] useGpuForPme Whether GPUs will be used for PME interactions.
+ * \param[in] pmeRunMode PME running mode: CPU, GPU or mixed.
+ * \param[in] havePmeOnlyRank If there is a PME-only rank in the simulation.
* \param[in] useGpuForNonbonded Whether GPUs will be used for nonbonded interactions.
* \param[in] updateTarget User choice for running simulation on GPU.
* \param[in] gpusWereDetected Whether compatible GPUs were detected on any node.
bool decideWhetherToUseGpuForUpdate(bool forceGpuUpdateDefault,
bool isDomainDecomposition,
bool useUpdateGroups,
- bool useGpuForPme,
+ PmeRunMode pmeRunMode,
+ bool havePmeOnlyRank,
bool useGpuForNonbonded,
TaskTarget updateTarget,
bool gpusWereDetected,