From: Artem Zhmurov Date: Tue, 22 Oct 2019 11:54:55 +0000 (+0200) Subject: Slight improvements to decideWhetherToUseGpuForUpdate(...) X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=6e60797b68071796fd5294656aaacf004072ce21;p=alexxy%2Fgromacs.git Slight improvements to decideWhetherToUseGpuForUpdate(...) 1. The boolean is passed for vsites instead of entire mdatoms structure. 2. Arguments are taken as const. 3. Whether or not the position/orientation restraints are enabled is now taken from topology. Change-Id: I9d299b5e46c39af07a17af1a639907d1dd11a9bc --- diff --git a/src/gromacs/mdrun/runner.cpp b/src/gromacs/mdrun/runner.cpp index 2cc4d69b08..0a5dca3b8b 100644 --- a/src/gromacs/mdrun/runner.cpp +++ b/src/gromacs/mdrun/runner.cpp @@ -1562,10 +1562,10 @@ int Mdrunner::mdrunner() updateTarget, gpusWereDetected, *inputrec, - *mdAtoms, + mdAtoms->mdatoms()->haveVsites, doEssentialDynamics, - fcd->orires.nr != 0, - fcd->disres.nsystems != 0, + gmx_mtop_ftype_count(mtop, F_ORIRES) > 0, + gmx_mtop_ftype_count(mtop, F_DISRES) > 0, replExParams.exchangeInterval > 0); const bool inputIsCompatibleWithModularSimulator = ModularSimulator::isInputCompatible( diff --git a/src/gromacs/taskassignment/decidegpuusage.cpp b/src/gromacs/taskassignment/decidegpuusage.cpp index e759b2c5db..71ca58d158 100644 --- a/src/gromacs/taskassignment/decidegpuusage.cpp +++ b/src/gromacs/taskassignment/decidegpuusage.cpp @@ -57,7 +57,6 @@ #include "gromacs/hardware/hardwaretopology.h" #include "gromacs/hardware/hw_info.h" #include "gromacs/mdlib/gmx_omp_nthreads.h" -#include "gromacs/mdlib/mdatoms.h" #include "gromacs/mdtypes/commrec.h" #include "gromacs/mdtypes/inputrec.h" #include "gromacs/mdtypes/md_enums.h" @@ -491,19 +490,19 @@ bool decideWhetherToUseGpusForBonded(const bool useGpuForNonbonded, return gpusWereDetected && usingOurCpuForPmeOrEwald; } -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) +bool decideWhetherToUseGpuForUpdate(const bool forceGpuUpdateDefaultOn, + const bool isDomainDecomposition, + const bool useGpuForPme, + const bool useGpuForNonbonded, + const bool useGpuForBufferOps, + const TaskTarget updateTarget, + const bool gpusWereDetected, + const t_inputrec &inputrec, + const bool haveVSites, + const bool useEssentialDynamics, + const bool doOrientationRestraints, + const bool doDistanceRestraints, + const bool useReplicaExchange) { if (updateTarget == TaskTarget::Cpu) @@ -544,7 +543,7 @@ bool decideWhetherToUseGpuForUpdate(bool forceGpuUpdateDefaultOn { errorMessage += "Only Parrinello-Rahman pressure control is supported.\n"; } - if (mdatoms.mdatoms()->haveVsites) + if (haveVSites) { errorMessage += "Virtual sites are not supported.\n"; } diff --git a/src/gromacs/taskassignment/decidegpuusage.h b/src/gromacs/taskassignment/decidegpuusage.h index 7a3ea2ca86..c74ca0a197 100644 --- a/src/gromacs/taskassignment/decidegpuusage.h +++ b/src/gromacs/taskassignment/decidegpuusage.h @@ -239,7 +239,7 @@ bool decideWhetherToUseGpusForBonded(bool useGpuForNonbonded, * \param[in] updateTarget User choice for running simulation on GPU. * \param[in] gpusWereDetected Whether compatible GPUs were detected on any node. * \param[in] inputrec The user input. - * \param[in] mdatoms Information about simulation atoms. + * \param[in] haveVSites If there are virtual sites in the system. * \param[in] useEssentialDynamics If essential dynamics is active. * \param[in] doOrientationRestraints If orientation restraints are enabled. * \param[in] doDistanceRestraints If distance restraints are enabled. @@ -249,19 +249,19 @@ bool decideWhetherToUseGpusForBonded(bool useGpuForNonbonded, * \throws std::bad_alloc If out of memory * InconsistentInputError If the user requirements are inconsistent. */ -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); +bool decideWhetherToUseGpuForUpdate(bool forceGpuUpdateDefaultOn, + bool isDomainDecomposition, + bool useGpuForPme, + bool useGpuForNonbonded, + bool useGpuForBufferOps, + TaskTarget updateTarget, + bool gpusWereDetected, + const t_inputrec &inputrec, + bool haveVSites, + bool useEssentialDynamics, + bool doOrientationRestraints, + bool doDistanceRestraints, + bool useReplicaExchange); } // namespace gmx