Skip to content

CUDA_VISIBLE_DEVICES setting ignored after import monai #7407

Description

@KumoLiu

Describe the bug
CUDA_VISIBLE_DEVICES setting ignored after import monai

To Reproduce

import os
import torch
print('before import monai:', torch.cuda.device_count())
import monai

os.environ["CUDA_VISIBLE_DEVICES"] = "0"
print('after import monai:')
torch.cuda.set_device(1) # should failed

Expected behavior
CUDA_VISIBLE_DEVICES setting should not ignored after import monai

Activity

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

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