Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
8e369f22
Unverified
Commit
8e369f22
authored
Sep 01, 2023
by
Peter Eastman
Committed by
GitHub
Sep 01, 2023
Browse files
Flush queue less frequently (#4177)
parent
7e6ecf71
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
31 deletions
+30
-31
platforms/common/src/CommonKernels.cpp
platforms/common/src/CommonKernels.cpp
+30
-31
No files found.
platforms/common/src/CommonKernels.cpp
View file @
8e369f22
...
@@ -35,6 +35,7 @@
...
@@ -35,6 +35,7 @@
#include "openmm/internal/CustomCompoundBondForceImpl.h"
#include "openmm/internal/CustomCompoundBondForceImpl.h"
#include "openmm/internal/CustomHbondForceImpl.h"
#include "openmm/internal/CustomHbondForceImpl.h"
#include "openmm/internal/CustomManyParticleForceImpl.h"
#include "openmm/internal/CustomManyParticleForceImpl.h"
#include "openmm/internal/timer.h"
#include "CommonKernelSources.h"
#include "CommonKernelSources.h"
#include "lepton/CustomFunction.h"
#include "lepton/CustomFunction.h"
#include "lepton/ExpressionTreeNode.h"
#include "lepton/ExpressionTreeNode.h"
...
@@ -98,6 +99,19 @@ static pair<ExpressionTreeNode, string> makeVariable(const string& name, const s
...
@@ -98,6 +99,19 @@ static pair<ExpressionTreeNode, string> makeVariable(const string& name, const s
return make_pair(ExpressionTreeNode(new Operation::Variable(name)), value);
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) {
void CommonApplyConstraintsKernel::initialize(const System& system) {
}
}
...
@@ -5382,9 +5396,7 @@ void CommonIntegrateVerletStepKernel::execute(ContextImpl& context, const Verlet
...
@@ -5382,9 +5396,7 @@ void CommonIntegrateVerletStepKernel::execute(ContextImpl& context, const Verlet
// Reduce UI lag.
// Reduce UI lag.
#ifdef WIN32
flushPeriodically(cc);
cc.flushQueue();
#endif
}
}
double CommonIntegrateVerletStepKernel::computeKineticEnergy(ContextImpl& context, const VerletIntegrator& integrator) {
double CommonIntegrateVerletStepKernel::computeKineticEnergy(ContextImpl& context, const VerletIntegrator& integrator) {
...
@@ -5469,9 +5481,7 @@ void CommonIntegrateLangevinStepKernel::execute(ContextImpl& context, const Lang
...
@@ -5469,9 +5481,7 @@ void CommonIntegrateLangevinStepKernel::execute(ContextImpl& context, const Lang
// Reduce UI lag.
// Reduce UI lag.
#ifdef WIN32
flushPeriodically(cc);
cc.flushQueue();
#endif
}
}
double CommonIntegrateLangevinStepKernel::computeKineticEnergy(ContextImpl& context, const LangevinIntegrator& integrator) {
double CommonIntegrateLangevinStepKernel::computeKineticEnergy(ContextImpl& context, const LangevinIntegrator& integrator) {
...
@@ -5563,9 +5573,7 @@ void CommonIntegrateLangevinMiddleStepKernel::execute(ContextImpl& context, cons
...
@@ -5563,9 +5573,7 @@ void CommonIntegrateLangevinMiddleStepKernel::execute(ContextImpl& context, cons
// Reduce UI lag.
// Reduce UI lag.
#ifdef WIN32
flushPeriodically(cc);
cc.flushQueue();
#endif
}
}
double CommonIntegrateLangevinMiddleStepKernel::computeKineticEnergy(ContextImpl& context, const LangevinMiddleIntegrator& integrator) {
double CommonIntegrateLangevinMiddleStepKernel::computeKineticEnergy(ContextImpl& context, const LangevinMiddleIntegrator& integrator) {
...
@@ -5755,9 +5763,8 @@ void CommonIntegrateNoseHooverStepKernel::execute(ContextImpl& context, const No
...
@@ -5755,9 +5763,8 @@ void CommonIntegrateNoseHooverStepKernel::execute(ContextImpl& context, const No
cc.reorderAtoms();
cc.reorderAtoms();
// Reduce UI lag.
// Reduce UI lag.
#ifdef WIN32
cc.flushQueue();
flushPeriodically(cc);
#endif
}
}
double CommonIntegrateNoseHooverStepKernel::computeKineticEnergy(ContextImpl& context, const NoseHooverIntegrator& integrator) {
double CommonIntegrateNoseHooverStepKernel::computeKineticEnergy(ContextImpl& context, const NoseHooverIntegrator& integrator) {
...
@@ -6319,9 +6326,7 @@ void CommonIntegrateBrownianStepKernel::execute(ContextImpl& context, const Brow
...
@@ -6319,9 +6326,7 @@ void CommonIntegrateBrownianStepKernel::execute(ContextImpl& context, const Brow
// Reduce UI lag.
// Reduce UI lag.
#ifdef WIN32
flushPeriodically(cc);
cc.flushQueue();
#endif
}
}
double CommonIntegrateBrownianStepKernel::computeKineticEnergy(ContextImpl& context, const BrownianIntegrator& integrator) {
double CommonIntegrateBrownianStepKernel::computeKineticEnergy(ContextImpl& context, const BrownianIntegrator& integrator) {
...
@@ -6402,9 +6407,7 @@ double CommonIntegrateVariableVerletStepKernel::execute(ContextImpl& context, co
...
@@ -6402,9 +6407,7 @@ double CommonIntegrateVariableVerletStepKernel::execute(ContextImpl& context, co
// Reduce UI lag.
// Reduce UI lag.
#ifdef WIN32
flushPeriodically(cc);
cc.flushQueue();
#endif
// Update the time and step count.
// Update the time and step count.
...
@@ -6511,9 +6514,7 @@ double CommonIntegrateVariableLangevinStepKernel::execute(ContextImpl& context,
...
@@ -6511,9 +6514,7 @@ double CommonIntegrateVariableLangevinStepKernel::execute(ContextImpl& context,
// Reduce UI lag.
// Reduce UI lag.
#ifdef WIN32
flushPeriodically(cc);
cc.flushQueue();
#endif
// Update the time and step count.
// Update the time and step count.
...
@@ -7289,9 +7290,7 @@ void CommonIntegrateCustomStepKernel::execute(ContextImpl& context, CustomIntegr
...
@@ -7289,9 +7290,7 @@ void CommonIntegrateCustomStepKernel::execute(ContextImpl& context, CustomIntegr
// Reduce UI lag.
// Reduce UI lag.
#ifdef WIN32
flushPeriodically(cc);
cc.flushQueue();
#endif
}
}
bool CommonIntegrateCustomStepKernel::evaluateCondition(int step) {
bool CommonIntegrateCustomStepKernel::evaluateCondition(int step) {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment