Skip to content

CUDA_VISIBLE_DEVICES environ setting not work in ver. 0.5.0 #2161

@ChenglongWang

Description

@ChenglongWang

Describe the bug
I'm using os.environ["CUDA_VISIBLE_DEVICES"] = '0' to set available GPU instead of specifing device like cuda: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:

  1. Use one tutorial for example.
  2. Default behavior: All GPUs are detected and only one gpu is actually used
  3. Add os.environ["CUDA_VISIBLE_DEVICES"] = '0' after def main(tempdir): on line 31.
  • ver. 0.4.x : Only GPU-0 is detected and used.
  • ver. 0.5.0 : All GPUs are detected.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions