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
"platforms/vscode:/vscode.git/clone" did not exist on "630bdd40e9c65fb22e471712fd378f98473c3456"
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 @@
#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
)
{
...
...
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