-
Notifications
You must be signed in to change notification settings - Fork 503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Non-deterministic execution order in CustomIntegrator #4038
Comments
The steps should always be executed in exactly the order listed. Can you create a complete test case that demonstrates the problem you're seeing? |
Will see what I can do tomorrow. Brief description of the simulation cycle
in the meantime:
{
10 steps of variable timestep integrator
1-step CustomIntegrator counting fast-moving atoms (break loop if any
found) - reads only, doesn’t affect sim. This also prints a message to
stderr when it finds any issues, so I’m pretty sure it’s not involved.
1-step Smoother - reads only, doesn’t affect sim
} x 5 loops
read coordinates from Smoother, update GUI, repeat.
What I see on repeat fresh starts from an identical starting point is one
of two things:
(a) everything runs exactly as expected, before I made these changes.
(b) the model “grows” into position from a very small starting size (which
is immediately apparent because it plays merry hell with the
crystallographic structure factor calculations, exploding the map into
junk). It’s clear the underlying simulation is still running fine, since if
I wait for a few dozen graphics updates the molecule display converges back
to what it should look like.
…On Thu, 20 Apr 2023 at 18:24, Peter Eastman ***@***.***> wrote:
The steps should always be executed in exactly the order listed. Can you
create a complete test case that demonstrates the problem you're seeing?
—
Reply to this email directly, view it on GitHub
<#4038 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFM54YE5ENEFPC5S3BVP7JLXCFWMRANCNFSM6AAAAAAXFZER34>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Here you go. The edit: corrected logic fail on my part (doesn't affect the bug existence, just my explanation of it). |
Also happens in Windows on both OpenCL and CUDA platforms. Doesn't appear to affect the CPU platform. |
The fix is in #4043. It was a problem with uninitialized memory. Thanks for creating such a clear test case! |
Awesome, thanks for tracking it down so fast! Could I lean on you for a peace-of-mind check on the alternative |
I think it's just a coincidence. That version could be affected just as easily. But there's an easy workaround. Immediately after creating the Context, call |
Awesome, thanks!
…On Mon, 24 Apr 2023 at 19:09, Peter Eastman ***@***.***> wrote:
I think it's just a coincidence. That version could be affected just as
easily. But there's an easy workaround. Immediately after creating the
Context, call setGlobalVariable() on the integrator to set a variable.
You only need to set one, and it doesn't matter which. That will ensure
that deviceGlobalsAreCurrent is false. But you need to wait until *after*
the Context is created.
—
Reply to this email directly, view it on GitHub
<#4038 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFM54YGJP5D2GRE5UTYX52TXC26WXANCNFSM6AAAAAAXFZER34>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Following on from #2489 (comment)... this may be just my misunderstanding of the documentation, but if I define a
CustomIntegrator
(whose purpose is to generate a moving average of the simulation coordinates) as follows:... then the behaviour on startup is non-deterministic. If the order of operations goes as written, what should happen is that on first run the
select
function simply fills thesmoothed
variable with the current coordinates, then the followingaddComputeGlobal('reset_smooth', '0')
ensures that subsequent calls use the actual smoothing function. That sometimes happens, but in other cases it seems thatreset_smooth
is set to zero first, so the first set of coordinates fed to the smoothing function is all zeros. This happens on the Mac OpenCL and Metal platforms - haven't tried others.This alternative approach appears to work fully reliably:
The text was updated successfully, but these errors were encountered: