Nodes/ComfyDL/Device Info
ComfyUI Node

Device Info

Which GPU does ComfyUI actually see? This node answers in two ints

By Cynthia-lxx·Created 2 months ago·Updated 2 days ago· 6
Device Info
    • num_gpus
    • has_cuda

    CdlDeviceInfo takes no inputs and answers one question: what does PyTorch see in your machine right now? It reports how many GPUs are visible and whether CUDA is available. It sounds almost too simple to exist, but it's genuinely useful as a first sanity check when a ComfyDL workflow runs slower than you expect or quietly lands on CPU - and it's the front door to the rest of ComfyDL's Device Utils nodes, which turn that answer into usable device strings.

    How it works

    Two lines of PyTorch under the hood:

    • torch.cuda.device_count() → how many GPUs PyTorch can see.
    • torch.cuda.is_available() → whether CUDA is usable at all, reported as 1 for yes, 0 for no.

    That's the whole mechanism. No model downloads, no API calls, no configuration - it's a probe. The two outputs are plain INTs, which you can wire anywhere ComfyDL accepts a number, or just read off the node as a health check.

    Inputs and output

    • No inputs at all - drag it in and it runs.

    Outputs:

    • num_gpus - INT, the number of visible GPUs.
    • has_cuda - INT, 1 if CUDA is available, 0 if not.

    Where it fits

    ComfyDL's device story continues from here: CdlTryGpu and CdlTryAllGpus take the same underlying availability check and hand you the device string ("cuda:0" or "cpu") you'd feed to nodes that place tensors on a device. So CdlDeviceInfo is the "look before you place" node - check that your GPUs are visible, then route accordingly. It's also the fastest way to tell whether a machine you're setting up will run any of the pack's examples with acceleration, and the README's own guidance is that the whole pack is meant to be playable - this node tells you where it's actually running.

    Installing it

    It ships with ComfyDL, one install for all 106 nodes:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Cynthia-lxx/ComfyDL
    pip install -r ./ComfyDL/requirements.txt
    

    Restart ComfyUI, or search "ComfyDL" in ComfyUI Manager. No extra dependency - it's pure torch.

    Gotchas

    • has_cuda is an INT (1/0), not a boolean, even though it reads like one. If you're feeding it into logic, convert it.
    • num_gpus counts visible GPUs. If you've set CUDA_VISIBLE_DEVICES, this reflects that filtering, not your physical hardware - useful to remember when a box "has 4 GPUs" but reports 1.
    • CUDA-only check. On a Mac or a CUDA-less Linux box you'll get 0 for has_cuda even though MPS/CPU could still do useful work - the node doesn't report those, it's specifically the CUDA probe.
    Categoryd2l/Device Utils

    Inputs (0)

    No inputs

    Outputs (2)

    NameTypeDescription
    num_gpusINT
    has_cudaINT