Skip to content

Fix issue #556 - #557

Merged
lohedges merged 1 commit into
develfrom
fix_556
Dec 2, 2026
Merged

lohedges merged 1 commit into
develfrom
fix_556

Conversation

@lohedges

@lohedges lohedges commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Closes #556.

OpenMM platform properties (device, precision, threads, CPU PME and OpenCL platform index) were set with platform.setPropertyDefaultValue. The platform object is shared by the whole process, so when dynamics objects were created concurrently, one thread could overwrite another's DeviceIndex and put its context on the wrong GPU. SOMD2 replica exchange does this whenever it rebuilds contexts in its thread pool after minimisation or equilibration. For MM runs this only caused load imbalance across GPUs, but GPU-resident ML/MM runs failed with a device mismatch between the model and OpenMM's buffers.

The properties are now passed to the openmm.Context constructor, so they apply only to that context and the platform defaults are left unchanged. As a side effect, a context created without device (or the other properties) no longer inherits the value set by a previous context.

A test checks that the requested property is applied to the context and that the platform's default is unchanged. The fix was also confirmed with a multi-GPU ML/MM replica-exchange run that previously failed.

  • I confirm that I have merged the latest version of devel into this branch before issuing this pull request (e.g. by running git pull origin devel): [y]
  • I confirm that I have added a changelog entry to the changelog (we will add a link to this PR as part of the review): [y]
  • I confirm that I have permission to release this code under the MIT license (the Python API) or the LGPLv3+ license (everything else), as described in the LICENSE file: [y]

@lohedges lohedges added the bug Something isn't working label Dec 2, 2026
@lohedges
lohedges merged commit 93f85c1 into devel Dec 2, 2026
5 checks passed
@lohedges
lohedges deleted the fix_556 branch December 2, 2026 15:44

This branch was previously deployed

1 inactive deployment
sire-build — 6cae3a1c Deployed Dec 2, 2026 by lohedges via build (3.12, linux) #486
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Concurrent dynamics creation can put OpenMM contexts on the wrong GPU

1 participant