# GPU update flag enables GPU update+constraints as well as buffer ops (dependency)
if context.opts.gpuupdate:
context.env.set_env_var('GMX_USE_GPU_BUFFER_OPS', "1")
- context.env.set_env_var('GMX_UPDATE_CONSTRAIN_GPU', "1")
+ context.env.set_env_var('GMX_FORCE_UPDATE_DEFAULT_GPU', "1")
regressiontests_path = context.workspace.get_project_dir(Project.REGRESSIONTESTS)
{
/*! \brief Structure that holds boolean flags corresponding to the development
- * features present enabled through environemnt variables.
+ * features present enabled through environment variables.
*
*/
struct DevelopmentFeatureFlags
{
- ///! True if the Buffer ops development feature is enabled
+ //! True if the Buffer ops development feature is enabled
// TODO: when the trigger of the buffer ops offload is fully automated this should go away
- bool enableGpuBufferOps = false;
- ///! True if the update-constraints development feature is enabled
- // TODO This needs to be reomved when the code gets cleaned up of GMX_UPDATE_CONSTRAIN_GPU
- bool useGpuUpdateConstrain = false;
- ///! True if the GPU halo exchange development feature is enabled
- bool enableGpuHaloExchange = false;
- ///! True if the PME PP direct commuinication GPU development feature is enabled
- bool enableGpuPmePPComm = false;
+ bool enableGpuBufferOps = false;
+ //! If true, forces 'mdrun -update auto' default to 'gpu'
+ bool forceGpuUpdateDefaultOn = false;
+ //! True if the GPU halo exchange development feature is enabled
+ bool enableGpuHaloExchange = false;
+ //! True if the PME PP direct communication GPU development feature is enabled
+ bool enableGpuPmePPComm = false;
};
/*! \brief Manage any development feature flag variables encountered
// getenv results are ignored when clearly they are used.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-result"
- devFlags.enableGpuBufferOps = (getenv("GMX_USE_GPU_BUFFER_OPS") != nullptr) && (GMX_GPU == GMX_GPU_CUDA) && useGpuForNonbonded;
- devFlags.useGpuUpdateConstrain = (getenv("GMX_UPDATE_CONSTRAIN_GPU") != nullptr);
- devFlags.enableGpuHaloExchange = (getenv("GMX_GPU_DD_COMMS") != nullptr && GMX_THREAD_MPI && (GMX_GPU == GMX_GPU_CUDA));
- devFlags.enableGpuPmePPComm = (getenv("GMX_GPU_PME_PP_COMMS") != nullptr && GMX_THREAD_MPI && (GMX_GPU == GMX_GPU_CUDA));
+ devFlags.enableGpuBufferOps = (getenv("GMX_USE_GPU_BUFFER_OPS") != nullptr) && (GMX_GPU == GMX_GPU_CUDA) && useGpuForNonbonded;
+ devFlags.forceGpuUpdateDefaultOn = (getenv("GMX_FORCE_UPDATE_DEFAULT_GPU") != nullptr);
+ devFlags.enableGpuHaloExchange = (getenv("GMX_GPU_DD_COMMS") != nullptr && GMX_THREAD_MPI && (GMX_GPU == GMX_GPU_CUDA));
+ devFlags.enableGpuPmePPComm = (getenv("GMX_GPU_PME_PP_COMMS") != nullptr && GMX_THREAD_MPI && (GMX_GPU == GMX_GPU_CUDA));
#pragma GCC diagnostic pop
if (devFlags.enableGpuBufferOps)
}
}
- if (devFlags.useGpuUpdateConstrain)
+ if (devFlags.forceGpuUpdateDefaultOn)
{
GMX_LOG(mdlog.warning).asParagraph().appendTextFormatted(
- "NOTE: This run uses the 'GPU update/constraints' feature, enabled by the GMX_UPDATE_CONSTRAIN_GPU environment variable.");
+ "NOTE: This run will default to '-update gpu' as requested by the GMX_FORCE_UPDATE_DEFAULT_GPU environment variable.");
}
if (devFlags.enableGpuPmePPComm)
}
// Before we start the actual simulator, try if we can run the update task on the GPU.
- useGpuForUpdate = decideWhetherToUseGpuForUpdate(DOMAINDECOMP(cr),
+ useGpuForUpdate = decideWhetherToUseGpuForUpdate(devFlags.forceGpuUpdateDefaultOn,
+ DOMAINDECOMP(cr),
useGpuForPme,
useGpuForNonbonded,
devFlags.enableGpuBufferOps,
"Membrane embedding is not supported by the modular simulator.");
// TODO: Change this to the boolean passed when we merge the user interface change for the GPU update.
isInputCompatible = isInputCompatible && conditionalAssert(
- getenv("GMX_UPDATE_CONSTRAIN_GPU") == nullptr,
+ getenv("GMX_FORCE_UPDATE_DEFAULT_GPU") == nullptr,
"Integration on the GPU is not supported by the modular simulator.");
// Modular simulator is centered around NS updates
// TODO: think how to handle nstlist == 0
return gpusWereDetected && usingOurCpuForPmeOrEwald;
}
-bool decideWhetherToUseGpuForUpdate(bool isDomainDecomposition,
- bool useGpuForPme,
- bool useGpuForNonbonded,
- bool useGpuForBufferOps,
- TaskTarget updateTarget,
- bool gpusWereDetected,
- const t_inputrec &inputrec,
- const MDAtoms &mdatoms,
- bool useEssentialDynamics,
- bool doOrientationRestraints,
- bool doDistanceRestraints,
- bool useReplicaExchange)
+bool decideWhetherToUseGpuForUpdate(bool forceGpuUpdateDefaultOn,
+ bool isDomainDecomposition,
+ bool useGpuForPme,
+ bool useGpuForNonbonded,
+ bool useGpuForBufferOps,
+ TaskTarget updateTarget,
+ bool gpusWereDetected,
+ const t_inputrec &inputrec,
+ const MDAtoms &mdatoms,
+ bool useEssentialDynamics,
+ bool doOrientationRestraints,
+ bool doDistanceRestraints,
+ bool useReplicaExchange)
{
+
if (updateTarget == TaskTarget::Cpu)
{
return false;
}
return false;
}
- return (updateTarget == TaskTarget::Gpu);
+
+ return ((forceGpuUpdateDefaultOn && updateTarget == TaskTarget::Auto) || (updateTarget == TaskTarget::Gpu));
}
} // namespace gmx
/*! \brief Decide whether to use GPU for update.
*
+ * \param[in] forceGpuUpdateDefaultOn If the update should be offloaded by default.
* \param[in] isDomainDecomposition Whether there more than one domain.
* \param[in] useGpuForPme Whether GPUs will be used for PME interactions.
* \param[in] useGpuForNonbonded Whether GPUs will be used for nonbonded interactions.
* \throws std::bad_alloc If out of memory
* InconsistentInputError If the user requirements are inconsistent.
*/
-bool decideWhetherToUseGpuForUpdate(bool isDomainDecomposition,
- bool useGpuForPme,
- bool useGpuForNonbonded,
- bool useGpuForBufferOps,
- TaskTarget updateTarget,
- bool gpusWereDetected,
- const t_inputrec &inputrec,
- const MDAtoms &mdatoms,
- bool useEssentialDynamics,
- bool doOrientationRestraints,
- bool doDistanceRestraints,
- bool useReplicaExchange);
+bool decideWhetherToUseGpuForUpdate(bool forceGpuUpdateDefaultOn,
+ bool isDomainDecomposition,
+ bool useGpuForPme,
+ bool useGpuForNonbonded,
+ bool useGpuForBufferOps,
+ TaskTarget updateTarget,
+ bool gpusWereDetected,
+ const t_inputrec &inputrec,
+ const MDAtoms &mdatoms,
+ bool useEssentialDynamics,
+ bool doOrientationRestraints,
+ bool doDistanceRestraints,
+ bool useReplicaExchange);
} // namespace gmx