ComfyUI icon indicating copy to clipboard operation
ComfyUI copied to clipboard

Unable to Specify NPU Device – Always Using NPU:0 Environment

Open Ading163 opened this issue 9 months ago • 0 comments

Expected Behavior

The script should respect the device specification and run on NPU:1, not default to NPU:0.

Actual Behavior

When trying to run a program with the option --cuda-device 1, I expected it to utilize NPU:1. However, the program always runs on NPU:0, regardless of the command-line flag or manual device selection in code.

Output from npu-smi info confirms that both NPUs are available and healthy:

Steps to Reproduce

OS: Ubuntu 22.04

Python: 3.10

PyTorch: 2.4.0

torch_npu: 2.4.0.post2

CANN: 8.0.0.RC2

NPUs: 2× Ascend 910B

Run Command: python main.py --cuda-device 1 --force-fp16

Debug Logs

## ComfyUI-Manager: installing dependencies done.
** ComfyUI startup time: 2025-04-25 00:23:42.870
** Platform: Linux
** Python version: 3.10.16 (main, Dec 11 2024, 16:18:56) [GCC 11.2.0]
** Python executable: /data/anaconda3/envs/comfyui_3.10.x/bin/python
** ComfyUI Path: /apps/ComfyUI
** ComfyUI Base Folder Path: /apps/ComfyUI
** User directory: /apps/ComfyUI/user
** ComfyUI-Manager config path: /apps/ComfyUI/user/default/ComfyUI-Manager/config.ini
** Log path: /apps/ComfyUI/user/comfyui.log

Prestartup times for custom nodes:
   3.0 seconds: /apps/ComfyUI/custom_nodes/ComfyUI-Manager

Set cuda device to: 2
Checkpoint files will always be loaded safely.
Total VRAM 62432 MB, total RAM 1544279 MB
pytorch version: 2.4.0
Set vram state to: NORMAL_VRAM
Device: npu
Using pytorch attention
Python version: 3.10.16 (main, Dec 11 2024, 16:18:56) [GCC 11.2.0]
ComfyUI version: 0.3.29
ComfyUI frontend version: 1.16.9

Other

Both NPUs are listed correctly in npu-smi.

No other processes are occupying the NPUs.

Framework used is compatible with multi-device (e.g., Transformers or standard PyTorch).

Device memory usage and logs clearly indicate only NPU:0 is used.

Ading163 avatar Apr 24 '25 17:04 Ading163