Slight improvements to decideWhetherToUseGpuForUpdate(...)
authorArtem Zhmurov <zhmurov@gmail.com>
Tue, 22 Oct 2019 11:54:55 +0000 (13:54 +0200)
committerBerk Hess <hess@kth.se>
Wed, 23 Oct 2019 10:00:22 +0000 (12:00 +0200)
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

src/gromacs/mdrun/runner.cpp
src/gromacs/taskassignment/decidegpuusage.cpp
src/gromacs/taskassignment/decidegpuusage.h

index 2cc4d69b08e269d3ca79b914f8641ac4bb2912af..0a5dca3b8b52c6bd3ec14280c3d61ccb25b77b11 100644 (file)
@@ -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(
index e759b2c5db179cf964f323009583bb1c746c12f3..71ca58d1584f1f5647bc5b584a0fcf0190337b81 100644 (file)
@@ -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";
     }
index 7a3ea2ca8614addc6b50349d96bb748092724c81..c74ca0a197ce96071b0a9001a8b7152e0fa4f39c 100644 (file)
@@ -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