ComfyUI Node

Distributed Batch

The quiet integer node that sizes every GPU in your farm

By doubletwisted·Created about a year ago·Updated 3 months ago· 9
Distributed Batch
    • batch_size
    default_batch1

    This is the node that answers a question you won't think to ask until your render farm is live: how many images should each GPU make? In a normal ComfyUI workflow you type batch_size straight into an Empty Latent node and it stays the same everywhere. The moment one master is fanning work out to half a dozen worker machines, "the same everywhere" is exactly wrong - your master might render a couple of images itself, your 3090 worker can chew through a bigger chunk, and your Deadline farm node is only alive for one task at a time. DistributedBatch is the little integer provider that lets each participant compute its own batch size instead of inheriting one.

    It's about as simple as a node gets on the surface. One input, default_batch, an integer from 1 to 64 (default 1). One output, batch_size, also an integer. You wire that output into the batch slot of an Empty Latent (or wherever else your workflow consumes a batch count) and the framework does the rest.

    The mechanism is where it gets interesting, and it's worth understanding because it explains the whole pack. When you queue a distributed job, the master prunes the graph and sends each worker only the slice it needs, injecting hidden values along the way. On a worker, this node reads the injected worker batch multiplier and returns default_batch times that. On the master, it reads batch_size from the pack's gpu_config.json and does the same. The same node, two different answers, because it knows which role it's playing. Set default_batch to your per-GPU baseline and let the configs scale it per machine.

    Two things people trip on. First, default_batch is a baseline, not a total - if you want 20 images and you have five workers, don't set it to 20, set it to the per-worker count you actually want, or you'll get 20 per machine. Second, the batch multiplier comes from gpu_config.json (master.batch_size) and the worker config in the Distributed panel, so if the output number looks wrong, that's the file to check.

    Realistically you only reach for this when you're already running the pack's master/worker setup - the Deadline-named twin DeadlineDistributedBatch is the same class under a Deadline-consistent name. On a single machine it just outputs default_batch, harmless. But once you have a farm, this node is what stops one GPU idling while another renders a hundred frames. It's plumbing, and it's the right kind.

    Categoryutils

    Inputs (1)

    NameTypeDefaultDescription
    default_batchINT11–64

    Outputs (1)

    NameTypeDescription
    batch_sizeINT