You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using SubprocVecEnv with multiple environments, all subprocesses ignore the GPU device specified for the main process and default to GPU 0, regardless of which GPU was set with torch.cuda.set_device().
Reproduction
I created a minimal reproduction script that clearly shows the issue:
Hello,
this is the expected behavior because torch.cuda.set_device(3) was executed in the main thread, whereas the envs are run on other processes.
If you want the other processes to use the correct device, you would either need to set the CUDA env variable or to add a method to your env that sets the cuda device.
🐛 Bug
Description
When using
SubprocVecEnv
with multiple environments, all subprocesses ignore the GPU device specified for the main process and default to GPU 0, regardless of which GPU was set withtorch.cuda.set_device()
.Reproduction
I created a minimal reproduction script that clearly shows the issue:
Output
Environment
Checklist
The text was updated successfully, but these errors were encountered: