Skip to content
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

_cumsum moves the data to default GPU when deterministic flag is on #2608

Closed
KubaMichalczyk opened this issue Jun 23, 2024 · 1 comment · Fixed by #2636
Closed

_cumsum moves the data to default GPU when deterministic flag is on #2608

KubaMichalczyk opened this issue Jun 23, 2024 · 1 comment · Fixed by #2636

Comments

@KubaMichalczyk
Copy link

If you're working with multiple GPUs and the input tensor x is not on cuda:0, the following line causes the tensor to land on the default GPU. This causes a mismatch in any later call on x, as other tensors are likely still on the original GPU.

return x.cpu().cumsum(dim=dim, dtype=dtype).cuda()

A simple reference to x.device can solve this problem:

return x.cpu().cumsum(dim=dim, dtype=dtype).cuda(x.device)

Copy link

Hi! thanks for your contribution!, great first issue!

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 a pull request may close this issue.

1 participant