Add environment variable that changes the meaning of '-update auto'
[alexxy/gromacs.git] / src / gromacs / taskassignment / decidegpuusage.cpp
index fbf0df5c322a22b14a7d7260d71424cc449fcfcd..e759b2c5db179cf964f323009583bb1c746c12f3 100644 (file)
@@ -491,19 +491,21 @@ bool decideWhetherToUseGpusForBonded(const bool       useGpuForNonbonded,
     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;
@@ -580,7 +582,8 @@ bool decideWhetherToUseGpuForUpdate(bool              isDomainDecomposition,
         }
         return false;
     }
-    return (updateTarget == TaskTarget::Gpu);
+
+    return ((forceGpuUpdateDefaultOn && updateTarget == TaskTarget::Auto) || (updateTarget == TaskTarget::Gpu));
 }
 
 }  // namespace gmx