"wrappers/vscode:/vscode.git/clone" did not exist on "12ff40ef0a7474b1dad89d8e7eb25292a055d2db"
Unverified Commit 8e369f22 authored by Peter Eastman's avatar Peter Eastman Committed by GitHub
Browse files

Flush queue less frequently (#4177)

parent 7e6ecf71
......@@ -35,6 +35,7 @@
#include "openmm/internal/CustomCompoundBondForceImpl.h"
#include "openmm/internal/CustomHbondForceImpl.h"
#include "openmm/internal/CustomManyParticleForceImpl.h"
#include "openmm/internal/timer.h"
#include "CommonKernelSources.h"
#include "lepton/CustomFunction.h"
#include "lepton/ExpressionTreeNode.h"
......@@ -98,6 +99,19 @@ static pair<ExpressionTreeNode, string> makeVariable(const string& name, const s
return make_pair(ExpressionTreeNode(new Operation::Variable(name)), value);
}
static void flushPeriodically(ComputeContext& cc) {
#ifdef WIN32
// When running on Windows, we periodically flush the queue to keep the UI responsive.
static double lastTime = getCurrentTime();
double currentTime = getCurrentTime();
if (currentTime-lastTime > 0.025) {
cc.flushQueue();
lastTime = currentTime;
}
#endif
}
void CommonApplyConstraintsKernel::initialize(const System& system) {
}
......@@ -5382,9 +5396,7 @@ void CommonIntegrateVerletStepKernel::execute(ContextImpl& context, const Verlet
// Reduce UI lag.
#ifdef WIN32
cc.flushQueue();
#endif
flushPeriodically(cc);
}
double CommonIntegrateVerletStepKernel::computeKineticEnergy(ContextImpl& context, const VerletIntegrator& integrator) {
......@@ -5469,9 +5481,7 @@ void CommonIntegrateLangevinStepKernel::execute(ContextImpl& context, const Lang
// Reduce UI lag.
#ifdef WIN32
cc.flushQueue();
#endif
flushPeriodically(cc);
}
double CommonIntegrateLangevinStepKernel::computeKineticEnergy(ContextImpl& context, const LangevinIntegrator& integrator) {
......@@ -5563,9 +5573,7 @@ void CommonIntegrateLangevinMiddleStepKernel::execute(ContextImpl& context, cons
// Reduce UI lag.
#ifdef WIN32
cc.flushQueue();
#endif
flushPeriodically(cc);
}
double CommonIntegrateLangevinMiddleStepKernel::computeKineticEnergy(ContextImpl& context, const LangevinMiddleIntegrator& integrator) {
......@@ -5755,9 +5763,8 @@ void CommonIntegrateNoseHooverStepKernel::execute(ContextImpl& context, const No
cc.reorderAtoms();
// Reduce UI lag.
#ifdef WIN32
cc.flushQueue();
#endif
flushPeriodically(cc);
}
double CommonIntegrateNoseHooverStepKernel::computeKineticEnergy(ContextImpl& context, const NoseHooverIntegrator& integrator) {
......@@ -6319,9 +6326,7 @@ void CommonIntegrateBrownianStepKernel::execute(ContextImpl& context, const Brow
// Reduce UI lag.
#ifdef WIN32
cc.flushQueue();
#endif
flushPeriodically(cc);
}
double CommonIntegrateBrownianStepKernel::computeKineticEnergy(ContextImpl& context, const BrownianIntegrator& integrator) {
......@@ -6402,9 +6407,7 @@ double CommonIntegrateVariableVerletStepKernel::execute(ContextImpl& context, co
// Reduce UI lag.
#ifdef WIN32
cc.flushQueue();
#endif
flushPeriodically(cc);
// Update the time and step count.
......@@ -6511,9 +6514,7 @@ double CommonIntegrateVariableLangevinStepKernel::execute(ContextImpl& context,
// Reduce UI lag.
#ifdef WIN32
cc.flushQueue();
#endif
flushPeriodically(cc);
// Update the time and step count.
......@@ -7289,9 +7290,7 @@ void CommonIntegrateCustomStepKernel::execute(ContextImpl& context, CustomIntegr
// Reduce UI lag.
#ifdef WIN32
cc.flushQueue();
#endif
flushPeriodically(cc);
}
bool CommonIntegrateCustomStepKernel::evaluateCondition(int step) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment