Auto Device Router (MultiGPU)
A one-wire node that picks the best GPU at runtime
- multigpu_device
- device_str
AutoDeviceRouter is the plumbing node of the ComfyUI-AutoMultiGPU pack: it does one thing, does it at runtime, and outputs a device name. You pick a routing rule, it probes your GPUs' free VRAM right then, and it hands back the winning device - either as a MULTIGPUDEVICE (a type this pack uses internally) or as a plain device_str string. The STRING output is the one you'll actually use; the other is there for other AutoMultiGPU nodes that speak its custom type.
Why bother? Most device choices in ComfyUI are frozen at the moment you configure a widget. If a node in your workflow has a cuda:0 / cuda:1 / cpu dropdown and you want it to re-decide every run based on whichever card actually has the free VRAM, that's what this does. Think "which card should the VAE decode on, given what the sampler just used." It's a niche tool - most people never need it - but in the handful of workflows that mix several AutoMultiGPU nodes, it's how you stop hard-coding devices.
The one input
routing_rule, with four options:
- Auto (Least Used GPU / Most Free VRAM) - the default; sorts live VRAM stats and returns the card with the most free memory.
- Primary Compute GPU (cuda:0)
- Secondary Offload GPU (cuda:1) - falls back to
cuda:0if there's no second card. - CPU Fallback
That's the whole thing. No optional inputs, no tuning. If a chosen device doesn't exist, it degrades gracefully - a single-GPU machine just never returns cuda:1 from the auto rule.
How it works
Straightforward and honest: it calls the pack's get_gpu_status() (which reads torch.cuda.mem_get_info() per card), sorts by free VRAM, and returns the top pick. Both outputs are the same string, just typed differently. There's no magic, and no cache-busting - it fires each time the graph executes, so "auto" really does mean at-runtime.
Installing it
Same pack, same install:
cd ComfyUI/custom_nodes
git clone https://github.com/nexusfinancial-dev/ComfyUI-AutoMultiGPU.git
cd ComfyUI-AutoMultiGPU
pip install -r requirements.txt
Or ComfyUI Manager → search ComfyUI-AutoMultiGPU. Dependencies are just torch, accelerate, and safetensors.
Where people get burned
Expectation management, mostly. The MULTIGPUDEVICE output only plugs into other nodes from this same pack - it is not a type ComfyUI's stock nodes accept. If you're trying to feed a generic cuda:0-style widget, use device_str. And if you're a beginner, don't add this to a workflow just because it exists: unless something upstream actually consumes the output, this node is decoration. It earns its keep in a multi-GPU pipeline that rebalances devices mid-run; everywhere else it's a fancier way to type "cuda:0".
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| routing_rule | COMBO | Auto (Least Used GPU / Most Free VRAM) | 4 options: Auto (Least Used GPU / Most Free VRAM), Primary Compute GPU (cuda:0), Secondary Offload GPU (cuda:1), CPU Fallback |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| multigpu_device | MULTIGPUDEVICE | — |
| device_str | STRING | — |