-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
CUDA_VISIBLE_DEVICES environ setting not work in ver. 0.5.0 #2161
Comments
Hi @ChenglongWang what metric are you using to determine which GPU is being used? Are you simply using |
Also I think it's unlikely that MONAI is the cause of your problem, since MONAI doesn't (and I don't think ever has) use the variable If you think I've missed something, would it be possible to create a minimum example that highlights your point? Preferably using all the same versions for the dependencies and simply switching between |
See this slightly related issue: #2167. I think if you add to the top of your script: import os
os.environ["CUDA_VISIBLE_DEVICES"] = x and then have the rest of your script as normal will work. If you set |
Hi @rijobro . Thank you for your kind help. Put the For reproduction, you can simply test on one tutorial (ex. https://github.com/Project-MONAI/tutorials/blob/master/2d_segmentation/torch/unet_training_array.py).
BTW, put the
This will also fix the problem in the v0.5.0. So I'm considering the problem is caused by MONAI. |
Think i found the bug and fixed it, see #2174. |
Describe the bug
I'm using
os.environ["CUDA_VISIBLE_DEVICES"] = '0'
to set available GPU instead of specifing device likecuda:0
.Everthing works fine until updating to ver. 0.5.0. Maybe some GPU-related operations were added in the latest version during import phase.
To Reproduce
Steps to reproduce the behavior:
os.environ["CUDA_VISIBLE_DEVICES"] = '0'
afterdef main(tempdir):
on line 31.Environment
MONAI version: 0.5.0
Numpy version: 1.19.4
Pytorch version: 1.6.0
MONAI flags: HAS_EXT = False, USE_COMPILED = False
MONAI rev id: 2707407
Optional dependencies: Pytorch Ignite version: 0.4.4
Nibabel version: 3.2.1
scikit-image version: 0.17.2
Pillow version: 8.0.1
Tensorboard version: 2.5.0a20201221
gdown version: NOT INSTALLED or UNKNOWN VERSION. TorchVision version: 0.7.0
ITK version: 5.1.2
tqdm version: 4.54.1
lmdb version: NOT INSTALLED or UNKNOWN VERSION.
psutil version: 5.7.3
The text was updated successfully, but these errors were encountered: