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

torch.cuda.device() does not seem to have an effect #1393

Open
c0redumb opened this issue Apr 19, 2024 · 1 comment
Open

torch.cuda.device() does not seem to have an effect #1393

c0redumb opened this issue Apr 19, 2024 · 1 comment

Comments

@c0redumb
Copy link

🐛 Describe the bug

Using torch.cuda.device() to select the GPU, and it has no effect. GPU0 is always used, expecting GPU selected to be used. On the other hand, torch.cuda.set_device() works well. PyTorch documentation advice using torch.cuda.device() over set_device().

Versions

Found when using ROCm PyTorch 6.0.2 official docker container on node with MI-60 GPUs. Other systems not tested.

@zichguan-amd
Copy link

Hi @c0redumb, torch.cuda.device() is a context manager, see pytorch#1608 (comment)

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

No branches or pull requests

3 participants