Skip to content

Fix incorrect reshape for multi-device evaluation in evaluate_observable#93

Open
glagnese wants to merge 1 commit into
markusschmitt:masterfrom
glagnese:mybranch
Open

Fix incorrect reshape for multi-device evaluation in evaluate_observable#93
glagnese wants to merge 1 commit into
markusschmitt:masterfrom
glagnese:mybranch

Conversation

@glagnese
Copy link
Copy Markdown

Hi all.

While running simulations on multiple GPUs using pmap, I encountered incorrect behavior in evaluate_observable. The issue comes from a hard-coded reshape(1, ...), which implicitly assumes that only a single device is used.

When more than one device is available, the current implementation reshapes arrays as "reshape(1, -1, L, L)". However, this breaks when more than one device is available. So I propose to add "ndev = global_defs.myDeviceCount" to read the number of available devices and reshape accordingly : "reshape(ndev, -1, ...)"

On the basis of the tests I made this solution leads to the correct expectation values for the desired observables.

Best,

Gianluca Lagnese

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant