// and report those features that are enabled.
const DevelopmentFeatureFlags devFlags = manageDevelopmentFeatures(mdlog, useGpuForNonbonded, useGpuForPme);
+ // NOTE: The devFlags need decideWhetherToUseGpusForNonbonded(...) and decideWhetherToUseGpusForPme(...) for overrides,
+ // decideWhetherToUseGpuForUpdate() needs devFlags for the '-update auto' override, hence the interleaving.
+ // NOTE: When the simulationWork is constructed, the useGpuForUpdate overrides the devFlags.enableGpuBufferOps.
+ try
+ {
+ useGpuForUpdate = decideWhetherToUseGpuForUpdate(devFlags.forceGpuUpdateDefaultOn,
+ useDomainDecomposition,
+ useGpuForPme,
+ useGpuForNonbonded,
+ updateTarget,
+ gpusWereDetected,
+ *inputrec,
+ gmx_mtop_interaction_count(mtop, IF_VSITE) > 0,
+ doEssentialDynamics,
+ gmx_mtop_ftype_count(mtop, F_ORIRES) > 0,
+ gmx_mtop_ftype_count(mtop, F_DISRES) > 0,
+ replExParams.exchangeInterval > 0);
+ }
+ GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
+
+
// Build restraints.
// TODO: hide restraint implementation details from Mdrunner.
// There is nothing unique about restraints at this point as far as the
// TODO remove need to pass local stream into GPU halo exchange - Redmine #3093
if (havePPDomainDecomposition(cr) && prefer1DAnd1PulseDD && is1DAnd1PulseDD(*cr->dd))
{
- GMX_RELEASE_ASSERT(devFlags.enableGpuBufferOps, "Must use GMX_GPU_BUFFER_OPS=1 to use GMX_GPU_DD_COMMS=1");
+ GMX_RELEASE_ASSERT(devFlags.enableGpuBufferOps, "Must use GMX_USE_GPU_BUFFER_OPS=1 to use GMX_GPU_DD_COMMS=1");
void *streamLocal = Nbnxm::gpu_get_command_stream(fr->nbv->gpu_nbv, InteractionLocality::Local);
void *streamNonLocal = Nbnxm::gpu_get_command_stream(fr->nbv->gpu_nbv, InteractionLocality::NonLocal);
void *coordinatesOnDeviceEvent = fr->nbv->get_x_on_device_event();
fr->cginfo_mb);
}
- // Before we start the actual simulator, try if we can run the update task on the GPU.
- useGpuForUpdate = decideWhetherToUseGpuForUpdate(devFlags.forceGpuUpdateDefaultOn,
- DOMAINDECOMP(cr),
- useGpuForPme,
- useGpuForNonbonded,
- devFlags.enableGpuBufferOps,
- updateTarget,
- gpusWereDetected,
- *inputrec,
- mdAtoms->mdatoms()->haveVsites,
- doEssentialDynamics,
- gmx_mtop_ftype_count(mtop, F_ORIRES) > 0,
- gmx_mtop_ftype_count(mtop, F_DISRES) > 0,
- replExParams.exchangeInterval > 0);
-
const bool inputIsCompatibleWithModularSimulator = ModularSimulator::isInputCompatible(
false,
inputrec, doRerun, vsite.get(), ms, replExParams,
const bool useModularSimulator = inputIsCompatibleWithModularSimulator && !(getenv("GMX_DISABLE_MODULAR_SIMULATOR") != nullptr);
+ // TODO This is not the right place to manage the lifetime of
+ // this data structure, but currently it's the easiest way to
+ // make it work.
+ MdrunScheduleWorkload runScheduleWork;
+ // Also populates the simulation constant workload description.
+ runScheduleWork.simulationWork = createSimulationWorkload(useGpuForNonbonded,
+ pmeRunMode,
+ useGpuForBonded,
+ useGpuForUpdate,
+ devFlags.enableGpuBufferOps,
+ devFlags.enableGpuHaloExchange,
+ devFlags.enableGpuPmePPComm);
+
std::unique_ptr<gmx::StatePropagatorDataGpu> stateGpu;
- if (gpusWereDetected && ((useGpuForPme && thisRankHasDuty(cr, DUTY_PME)) || devFlags.enableGpuBufferOps))
+ if (gpusWereDetected && ((useGpuForPme && thisRankHasDuty(cr, DUTY_PME)) || runScheduleWork.simulationWork.useGpuBufferOps))
{
const void *pmeStream = pme_gpu_get_device_stream(fr->pmedata);
const void *localStream = fr->nbv->gpu_nbv != nullptr ? Nbnxm::gpu_get_command_stream(fr->nbv->gpu_nbv, InteractionLocality::Local) : nullptr;
fr->stateGpu = stateGpu.get();
}
- // TODO This is not the right place to manage the lifetime of
- // this data structure, but currently it's the easiest way to
- // make it work.
- MdrunScheduleWorkload runScheduleWork;
- // Also populates the simulation constant workload description.
- runScheduleWork.simulationWork = createSimulationWorkload(useGpuForNonbonded,
- pmeRunMode,
- useGpuForBonded,
- useGpuForUpdate,
- devFlags.enableGpuBufferOps,
- devFlags.enableGpuHaloExchange,
- devFlags.enableGpuPmePPComm);
-
-
GMX_ASSERT(stopHandlerBuilder_, "Runner must provide StopHandlerBuilder to simulator.");
SimulatorBuilder simulatorBuilder;
const bool isDomainDecomposition,
const bool useGpuForPme,
const bool useGpuForNonbonded,
- const bool useGpuForBufferOps,
const TaskTarget updateTarget,
const bool gpusWereDetected,
const t_inputrec &inputrec,
{
errorMessage += "Domain decomposition is not supported.\n";
}
- // Using the GPU-version of update makes sense if forces are already on the GPU, i.e. if at least:
- // 1. PME is on the GPU (there should be a copy of coordinates on a GPU in rvec format for PME spread).
- // 2. Non-bonded interactions and buffer ops are on the GPU.
- if (!(useGpuForPme || (useGpuForNonbonded && useGpuForBufferOps)))
+ // 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))
{
errorMessage += "Either PME or short-ranged non-bonded interaction tasks must run on the GPU.\n";
}