What do ComfyUI --cuda-device and --default-device do, and what does the Windows single-GPU default mean?
Problem: choosing which GPU(s) a ComfyUI process sees. Conditions: NVIDIA, AMD ROCm (env vars set for both), Ascend NPU (third var); commit fb3befd. Method: --cuda-device takes a comma-separated id list or 'all'; main.py writes it to CUDA_VISIBLE_DEVICES, HIP_VISIBLE_DEVICES and ASCEND_RT_VISIBLE_DEVICES before torch loads, so unlisted devices become invisible. --default-device N keeps every device visible but rebuilds the visibility list (range 0-31) with N first, so N becomes cuda:0 inside the process; it is skipped when --cuda-device all is given. Failure modes: on Windows, if neither flag nor CUDA_VISIBLE_DEVICES is set, main.py forces CUDA_VISIBLE_DEVICES=0 and logs a warning; pass --cuda-device all to undo. Ids refer to the driver's numbering, so they follow whatever ordering the driver reports. Limitations: reading of code, not run on a multi-GPU machine. Version: fb3befd.
Structured fields
{
"citations": [
{
"url": "https://raw.githubusercontent.com/comfyanonymous/ComfyUI/fb3befd168731438f88bc96e0920a538e8649878/comfy/cli_args.py",
"note": "--cuda-device argument; --default-device argument; main.py __main__ block; main.py __main__ block; pre-start block; researcher reasoning"
},
{
"url": "https://raw.githubusercontent.com/comfyanonymous/ComfyUI/fb3befd168731438f88bc96e0920a538e8649878/main.py",
"note": "--cuda-device argument; --default-device argument; main.py __main__ block; main.py __main__ block; pre-start block; researcher reasoning"
}
]
}Evidence claims
- [sourced_fact] Problem: choosing which GPU(s) a ComfyUI process sees. Conditions: NVIDIA, AMD ROCm (env vars set for both), Ascend NPU (third var); commit fb3befd. Method: --cuda-device takes a comma-separated id list or 'all'; main.py writes it to CUDA_VISIBLE_DEVICES, HIP_VISIBLE_DEVICES and ASCEND_RT_VISIBLE_DEVICES before torch loads, so unlisted devices become invisible. --default-device N keeps every device visible but rebuilds the visibility list (range 0-31) with N first, so N becomes cuda:0 inside the process; it is skipped when --cuda-device all is given. Failure modes: on Windows, if neither flag nor CUDA_VISIBLE_DEVICES is set, main.py forces CUDA_VISIBLE_DEVICES=0 and logs a warning; pass --cuda-device all to undo. Ids refer to the driver's numbering, so they follow whatever ordering the driver reports. Limitations: reading of code, not run on a multi-GPU machine. Version: fb3befd. · locator: --cuda-device argument; --default-device argument; main.py __main__ block; main.py __main__ block; pre-start block; researcher reasoning source
Rights
| component | license | hosting | redistribution | modification | training | Evidence and notes |
|---|---|---|---|---|---|---|
| documentation | unknown | permitted | permitted | unknown | unknown | Applies to this original summary only, not to the cited sources. |