ComfyUI_ExtraModels icon indicating copy to clipboard operation
ComfyUI_ExtraModels copied to clipboard

override device doesnt show all options

Open yggdrasil75 opened this issue 1 year ago • 3 comments

I have 3 gpus, a 3090, 3080, and p40. the force/set clip device shows only "cpu" and "cuda:0". when I set the comfy device to cuda:0 it shows cuda:1 instead. I do not see cuda:2 ever.

yggdrasil75 avatar Dec 20 '24 12:12 yggdrasil75

What does launching without the cuda cli flag or cuda_visible_devices set do?

Also, what do you get if you just run this in a standalone console:

import torch
print(torch.cuda.device_count())

city96 avatar Dec 22 '24 16:12 city96

running that in console works right (get 3), and I dont use cuda_visible_devices, but rather the comfyui --cuda-device 0 without --cuda-device it works. looks like it might be a comfyui issue I guess because comfyui sets the environment instead of just setting device. sorry for posting to the wrong place.

yggdrasil75 avatar Dec 22 '24 17:12 yggdrasil75

I think the problem might be that the --cuda-device flag in comfy just sets cuda_visible_devices internally here.

You could try edit it to use torch.set_default_device instead I guess. Something like this: (untested)

    if args.cuda_device is not None:
        torch.set_default_device(f"cuda:{args.cuda_device}")

city96 avatar Dec 22 '24 17:12 city96