Closed MasterChief1O7 closed 1 year ago
This is not a bug, it is documented behavior. The local snapshot provides zero-copy access to internal memory buffers which are 1) Split across domains and 2) sorted on a space filling curve (not randomly) to improve performance.
Description
When using
sim.state.cpu_local_snapshot
, it is changing particle typeid of random particles rather than of what I have defined. For example in the test script, it should change particle typeid of first 150 particles to 1 (from 0) but it changed randomly. However, if I usesim.state.get_snapshot
method it works fine, as expected. But, if I usesim.state.get_snapshot
method at least once before usingsim.state.cpu_local_snapshot
, it also starts working as expected!I tried it with both CPU and GPU as device but the problem remains the same. And the output are consistent on multiple runs, i.e. which particles get modified typeid is also fixed.
Also I tried
sim.state.gpu_local_snapshot
but I'm always getting the error:TypeError: 'HOOMDGPUArray' object does not support item assignment
, which I guess could be a different and unrelated issue?Script
Input files
No response
Output
Expected output
I'd expect the particles typeid (
snapshot.particles.typeid
) should be after usingsim.state.cpu_local_snapshot
as in the test script:[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
Platform
GPU, Linux
Installation method
Conda package
HOOMD-blue version
3.7.0
Python version
3.9.16