DGX Monarch - Dual Spark Rendering w/ ComfyUI

For those of you who have been wanting to utilize your dual Spark cluster for image/video gen with ComfyUI - today is your day.

I started this personal project back in April of this year, and it’s at a point where I’m fine with a public release.

To put this as simply as possible - you can get nearly 2× render speeds with this repo. Results vary by model and settings. BF16/FP8/NVFP4/INT8/etc. supported, depending on the model. No GGUF.

Link to the repo: GitHub - Deen-Media/dgx-monarch: Distributed image and video generation in ComfyUI for two NVIDIA DGX Sparks. · GitHub (highly recommend reading the FAQ after the README)

The rest of this will be MUCH more boring, so you can skip if you just want to start using it. You’ve been warned, and I cannot refund any time spent reading what you already have thus far, and especially the rest of this post. More words. Four more pointless words. K just checking.

Before you ask - yes, I heavily used AI to develop this. But most of MY time was spent validating outputs and performance, and actually using this project.

In terms of maintainability, well, I have and will continue to do my best to keep the development workflows I’ve built up to date so that new models can be safely added without breaking anything. I do not intend on sharing these development workflows, as I personally do not see the value in doing so relative to the effort I would need to put into making sure they are even safe for me to share. To be clear, I mean my personal AI-agent development workflows, not the example ComfyUI workflows included in the repo. Workflows like this, in my opinion, should be something you craft and tailor/customize yourself.

I’m fully expecting AI-generated PRs, and I realize at the end of the day it’s my slop vs. yours. All I ask is that you actually sit down and validate/render/test your changes and include those results. I’ll need time to review and test them too, so please be patient. I really enjoy USING this tool and would like to continue to do so. Maintaining comes second to me personally, but ironically, using and maintaining go hand in hand.

It’s easy to vibe-code a small project. It is VERY difficult and costly (money, not just time) to vibe-maintain a large project.

For transparency, a project like this has depleted (and I mean 0%/flatline), on a weekly basis, the following subscriptions of mine since the start:

OpenAI:

- 1× Astra $200 account* (now Astra $500 account**)

- 1× Business Astra seat

*I took advantage of every single banked/global reset and got real lucky on the global ones.

**Strictly to close extra sloppy PRs hella fast with ultrafast (but really to utilize usage on spontaneous global resets that the community gets an hour or two heads up on). Plus I enjoy paying more than double to have roughly the same usage as I had before.

Anthropic:

- 1× Fable $200 account

- 1× Business Fable seat

Cursor:

- 1× Fable $200 account (Grok did not touch the working code - it had a different use case)

Google:

- 1× Ultra $250 account (don’t freak out - Gemini did not touch the working code)

(Note: Astra/Fable were not around when this project started. Was fun.)

I will maintain these subscriptions for as long as reasonably possible, as I do have other projects I intend on releasing (more DGX-specific ones) in the coming months here.

However, there WILL be a point where it won’t make sense to maintain all these subscriptions. Whether that’s due to local models finally being sufficient/effective enough to handle my workflows, frontier costs skyrocketing or usage allowances dwindling as the era of subsidization ends, or the projects simply no longer needing a high level of maintenance (unlikely).

That’s all, thanks for reading.

Oh that’s the first time I see someone doing this on 2 DGX sparks. That’s nice.
I am the maintainer of this repo GitHub - jdaln/ComfyUI-DGX-Spark-Docker-opinionated: This repo installs ComfyUI and auto-provisions 80+ workflows for your multimedia needs on the DGX-Spark or equivalent GB10 computers. Updated ~ once a month. This is a hobby project. · GitHub . I don’t have 2 Sparks and probably won’t have (tried to ask around for sponsorship at conferences but vendors did not have).
If you like the repo and you are interested in adding an optional 2 Sparks config, I’d be happy to see the perf improvement :)

Thanks, I’ll take a look at this repo :)

Oh nice someone else finally did this! I did this for minimax h3 when it first dropped so I could use TP=2 and got around a 1.7x speedup but never dropped the repo because I don’t have time for the PR’s, issues, and just flat out rude people bitching because It wasn’t coded by hand, in rust, bug free, with bi-weekly updates XD. Yours looks much better than mine because mine is just 2 comfyui nodes and if I cancel a gen in progress I get broken pipe spam that requires a kill -9 on the comfy process. You might be able to do this on non DGX GPU’s, maybe. There is a ton of demand for that I see in the diffusion space but for a version that splits a single model too big for 1 gpu onto many gpu’s for faster generations. To my knowledge that version doesnt exsist yet.

Thanks! Yea with H3 I average around 1.82x speed up (2.58x-2.7x with Sol-Attn).

And yes, you can do this distribution with non DGX GPU’s as long as NCCL is used otherwise Raylight would be the answer.

Single model splitting is supported here (FSDP) but the trade-off is speed. I made sure full support was included with FSDP just incase models get bigger but also for users wanting to have both an image/video model loaded AND an LLM at the same time (users being me lol). This project is a personal tool of mine I decided to release so obviously I will continue to maintain and improve upon it best I can (with secret hopes of ComfyUI or Nvidia swallowing this whole an natively implementing/supporting).

If you don’t mind spreading the word (try it out for yourself first) I would appreciate it!

P.S.: A tremendous amount of work went into the actual distribution system with this (Torch Monarch implementation) and there is a lot of mitigating tools/actors being utilized to prevent issues like you noted with your version and the broken pipe spam. That was another thing I focused on a lot as it drove me insane and was extremely disruptive to my workflow.

Just released v1.3.0 of DGX Monarch.

For anyone who hasn’t seen it, it’s my open-source ComfyUI extension for running image and video workflows across DGX Sparks. Depending on the model, you can split a render across two GPUs, run independent jobs on each, or shard model weights to fit larger checkpoints. It works with a single Spark too, and you still use ComfyUI for the rest of your graph.

The biggest addition is Studio, an optional browser workspace for choosing bundled workflows, entering prompts, queuing renders and keeping track of jobs. It includes Gallery, Queue, Grids, Fleet and Library views. After setup, dgxm studio launches it in your browser, with an optional persistent user service if you want to keep it running.

Also new in v1.3:

  • MOSS-Image SFT, Base and Kromoss support.

  • Five new example workflows, bringing the total to 71.

  • A Monarch Skip Layer Guidance node.

  • Clearer memory and network-rail reporting in dgxm top and the ComfyUI sidebar.

  • Compatibility updates for recent ComfyUI MOSS-Image and Qwen Image 2.1 changes.

Studio is still a draft. Full Worker/Fleet testing through Studio, live updates and broader end-to-end testing are still unfinished. The release notes link the test results and remaining gaps so you can see what’s been checked.

A couple of setup notes: Studio requires the optional studio extra, which the updater doesn’t install. MOSS-Image and Kromoss require ComfyUI 0.42.0 or newer on the driver and every Worker. Check the upgrade notes if you’re updating an existing install, particularly one using Worker release slots.

GitHub and setup
v1.3.0 release notes

If you give it a try, I’d appreciate feedback on setup, the workflows and Studio. Especially anything that’s confusing or gets in the way.

@Balaxxe I wanted to let you know that I really appreciated your work on this. Most of the people here focused only on the LLM side of this AI revolution, but the AI-art side is just as interesting. I’ve been learning the ComfyUI workflow, model, LoRA and stuff lately, and your DGX Monarch made it possible to use sparks to do it easily and fast. Now I can turn my 4 nodes into 2 pair render clusters during the night and TP4 LLM during the day, the best of both worlds!

Please keep it coming. You’re doing great work!

Thanks for the kind words :)

Just focused on optimizations and keeping up to pace with latest model releases.

If you have any thoughts or suggestions let me know - that was 50% of the reason why I chose to open source it as I figured there would be some cool ideas out there that would make my tool even more enjoyable for me to use personally hah.

I’ve been communicating with the PyTorch Monarch team on some suggestions and looks like they have added them to their tracker for the 8.0 release so things should get even more interesting here shortly.

Also, though I do not have 4 sparks so I can’t build it out and test, this can scale performance wise where more nodes provide even more speed increases and throughput.

@balaxxe Hello! Thanks for building this .. we have a four spark cluster. Willing to run some tests for the cause, let me know what you’d like to see specifically. Planning to load this up over the weekend.

This looks very useful. I will have to give it a try on my 4x spark cluster.

I am currently using spark-comfyui and it works great on a single spark. If I am understanding correctly, since one of the prerequisites is that you already have ComfyUI installed I can continue to use that repo for the base install on all 4 nodes then layer this on top of it.

Either way, looks like something that will be fun to experiment with. I always feel like I am wasting my hardware when I have to unload LLMs serving across all 4 sparks to experiment with image gen on only a single spark. This would solve that and make things run faster at the same time.

Try to measure how many tflops your getting with the comfy kitchen int8 kernel. I found that on my ga100 I was only getting 120 tflops and have since gotten it up to 208 tflops int8 on dense attention and 368 tflops on GEMMS. And the ga100 chip is quite well documented so I am pretty sure the gb10 will face this same issue if not even worse since the gb10 is a lot newer. I’ll try to get it measured later. The tflop gap is a big performance gap because when it was 120 tflops time per step on a 6s 0.4 mp video was 10.28s and after the kernel work 7.9s per step. Might be a lot of performance left on the table but we shall see.

Following @corbett_korbett pointer, I managed to tracked down the problem on comfy-kitchen, on default it sends INT8 to CUTLASS, which on GB10 sustains about 72 TOPS, slower than BF16. The INT8 peak on gb10 is about 196 TOPS (clock capped at 2000 Mhz). A fused Triton kernel reaches about 170 TOPS and the output is bit-identical to the CUTLASS kernel. These translate to 18% faster render time on ref2va H3 INT8 convrot with the same exact result.

I’ve made several tunings for comfyui on gb10 detail here GitHub - kanthai/gb10-comfyui-tuning: Measured performance tuning of ComfyUI + DGX Monarch on NVIDIA DGX Spark (GB10): Triton INT8 GEMM, pageable-memory trap, split VAE decode, quantization, gotchas · GitHub

With the tuning I got H3 video ~1.45× faster, image models ~1.5-2× faster, same output.

I did similar earlier. Had a opus 5.5 agent work on it for many hours and measured 85 TFLOPS for the stock comfy kitchen int8 GEMMS. After the custom kernel work the int8 linear GEMMS are now 178–183 TFLOPS bit identical output to the stock un-tuned kernel. FP4 sageattention3 fork for the spark brought FP4 TFLOPS on attention from 196 TFLOPS to 290 TFLOPS but I chose not to use it since FP4 attention causes a large loss in quality. Generation time is now about 8.9s/step on the int8 fl2va model when doing a 5s 0.4 MP generation. Much faster than the 15s/step+ it used to take. Out of the box the kernels are very unoptimized and leave soo much performance on the table even on the ga100 which has been around forever.

Nice — our numbers line up (stock 72, custom 174–176 bit-identical; you’re a bit ahead at 178–183). What tile/schedule did you land on? Ours is a fused-dequant Triton GEMM, 128×128×64, 8 warps, 4 stages, with unmasked K loops. Same experience with FP4 Sage3 here: faster, but the error was ~5× Sage2 at H3 shapes, so we stayed on Sage2. I opened Comfy-Org/comfy-kitchen#280 for the sm_121 INT8 path — your measurements would make a strong second data point there.

Below is written by my agent.

Nice, that lines up. Our kitchen baseline measured 85 TOPS rather than 72, probably shape mix or clocks; we used H3’s four linear shapes at M=8336.

Triton (what we ship): fused-dequant GEMM with autotune keyed on (M, N, K), grouped rasterization with GROUP_M=8. Masked K loop, nothing fancy. The autotuner settled on 4 warps, not 8:

qkv (21504×5376): 128×128×64, 4 warps, 4 stages → ~176–183 TOPS
out_proj / fc1 / fc2: 128×128×128, 4 warps, 2 stages → ~178–186 TOPS
128×256 and 256×128 tiles (8 warps, 3 stages) and a persistent/flattened tile loop never won.
Bit-exact with kitchen as long as the epilogue is (acc·x_scale)·w_scale (+bias) in fp32. For the residual variant, kitchen rounds the linear result to bf16 before residual + scale·lin; we matched that.

Hand-written CUDA (for comparison): 128×128×64, 8 warps (2×4, 64×32 warp tiles), 3-stage cp.async, XOR-swizzled 64-byte smem rows, ldmatrix fragments double-buffered across k32 steps, 2 CTAs/SM. Lands at 168–184 TOPS, no better than Triton. Everything we tried converged at ~180, about 77% of the 236 TOPS mma.sync peak we measured. cuBLASLt int8 does 168 with int32 output, and kitchen’s NVFP4 GEMM sits at the same ~75% of its own peak.

Two things that might save you time:

Raster group size matters a lot because of the 24 MB L2. GROUP_M 8–16 was best (16 for K ≤ 8192, 8 for fc2’s K=14336). At 32 and above the in-flight A/B working set overflows L2 and throughput collapses to ~67 TOPS.
If you touch CUTLASS/TMA pipelines on sm_121: the mbarrier try_wait with a suspend hint lowers to NANOSLEEP.SYNCS, and the wake-ups are late enough to stall the pipeline by thousands of cycles. Switching to test_wait polling bought ~5% in our attention kernel. We saw no clock throttling (steady 2.4 GHz).
FP4 Sage3: same conclusion here. On real H3 activations the attention error was ~7.5% relL1 vs ~0.8% for 8-bit, and a real generation showed visible degradation for an ~11% faster step, so we dropped it. Hadamard-rotating Q/K before FP4 quantization cut the Q·Kᵀ error by ~30%, still nowhere near 8-bit.

I’ll take a peak at your repo and validate/test and if all works out well, I will add this as a streamlined option within DGX Monarch (with credit to you).

Results look promising - great work :)

Got this up and running on a 4-spark cluster backed by 2x100GbE links per node and reproduced all of the benchmark sweeps from the git repo I could easily accomplish, testing different 4-node layout combinations along the way to determine how the performance varied for each setting.

It is noted that my 1 and 2 node tests finish a few percentage points faster than the published benchmarks. This is likely because I do not have my GPU clock speeds capped where the reference numbers were capped at 2100MHz.

DGX Monarch 4-node benchmark on DGX Sparks

On four DGX Sparks, the uly2+cfg2 layout is fastest for every model that uses CFG: large video models run about 3× faster than on one Spark and 1.8–2× faster than on two. MiniMax H3 and LTX run only on uly4 at world 4 and gain 1.14–1.65× over 2 nodes. The full matrix covered 40 rows × 4 layouts (160 results) in about 14½ hours.

  • CFG models → uly2+cfg2. Fastest for every CFG model where it renders correctly. Video: 1.77–1.97× over the best 2-node result. Stills: 1.25–1.62×.
  • MiniMax H3 and LTX → uly4. Monarch refuses every other world-4 layout for them. MiniMax gains about 1.6× over 2 nodes; LTX gains 1.14–1.44× because its renders are short.
  • Don’t use auto at world 4. It was never the fastest layout. It is refused on 9 still-image models and on every LTX and MiniMax row. On Wan SCAIL2 it picks the layout with the worst output.
  • Small or fast models gain nothing: Flux Schnell, PixelDiT, PiD and FlowRVS. Flux is slower on 4 nodes (20 s) than on 2 (18 s).
  • Quality: every successful 4-node render matched the 1-GPU render within the 0.10 NRMS limit, except Wan SCAIL2 on ring4, uly2+cfg2 and auto. Monarch gives no warning for those.

Setup and method

The four Sparks ran DGX Monarch v1.3.0 on a native venv, with all tensor traffic over Mellanox SN2100 100GbE RoCE fabric. spark-1 is the driver; spark-2 to spark-4 are workers.

ItemValue
Nodesspark-1 to spark-4
FabricMellanox SN2100, 4 RoCE functions per Spark, lossless priority 3 (NCCL_IB_TC=104)
torch2.12.0+cu132, torchvision 0.27.0+cu132 (the pin used by every Monarch hardware record)
NCCL2.29.7
ComfyUIa071826f (0.42.0), clean checkout
DGX Monarch5433e05 (v1.3.0)
Python3.12.3 (system), venv at ~/dgx-monarch/venv
NVIDIA driver580.178.04, CUDA 13.0 ptxas
Clocks / swapNo clock cap (reference benchmarks were capped at 2100MHz); swap left on
  • Workflows and settings come from Monarch’s own benchmark sweep (benchmark/sweep). Its cell IDs match the published BENCHMARKS.md tables 1:1.
  • Timing is the warm leg’s wall time (cold = seed+0, warm = seed+1). It is reported in 2 s steps, so a 2 s gap on a short still is within noise.
  • 1 GPU and 2-node columns are our own runs reproducing the published tables. 2-node is spark-1 + spark-2.
  • 4-node layouts tested: auto, uly4, ring4 and uly2+cfg2. These are the layouts that divide world 4 at batch 1. uly2+ring2 is reachable only through auto; when auto resolved to an explicit layout, that result was reused.
  • Quality check: each run also renders a 1-step probe. It is compared with the 1-GPU probe by NRMS; above 0.10 counts as a failed render.

Results: every layout tested

Times are warm seconds. The fastest valid result in each row is bold, and ties are all bold.

  • 2N / 4N = 2 nodes / 4 nodes. Fastest 4N is the fastest 4-node layout that renders correctly.
  • vs 1 GPU and vs 2N are that layout’s speedups over one Spark and over the best 2-node result.
  • — = not run: there is no published cell to reproduce. For video, the published tables list only 2-node auto.
  • refused = Monarch rejected the layout up front. crash = it accepted the layout and the render failed.
  • ✗ = rendered, but the probe misses the 1-GPU render (NRMS > 0.10), so it doesn’t count as fastest.

Still images

Model1 GPU2N uly22N cfg22N ring24N auto4N uly44N ring44N uly2+cfg2Fastest 4Nvs 1 GPUvs 2N
Anima20.014.010.014.0refused8.010.08.0uly4 / uly2+cfg22.50×1.25×
Boogu46.132.224.030.1refused20.022.018.0uly2+cfg22.56×1.33×
Chroma1-HD62.140.030.040.0refused24.026.020.0uly2+cfg23.10×1.50×
Ernie48.130.026.030.018.016.018.016.0uly4 / uly2+cfg23.01×1.62×
Flux Schnell26.018.0—18.020.020.020.0refusedany (tie)1.30×0.90×
HunyuanImage 204876.152.142.050.132.136.034.032.0uly2+cfg22.38×1.31×
Ideogram434.024.020.022.214.0crash16.0refusedauto (uly2+ring2)2.43×1.43×
Kandinsky5 Image78.150.140.148.132.030.034.026.0uly2+cfg23.00×1.54×
Krea2 153664.140.134.038.1refused24.0refused22.0uly2+cfg22.91×1.55×
Lens Turbo34.024.018.020.0refused16.0refused14.0uly2+cfg22.43×1.29×
LongCat30.020.016.020.0refused12.012.110.0uly2+cfg23.00×1.60×
OmniGen224.0—14.016.0refusedrefusedrefusedrefusednone——
PixelDiT10.010.0—10.08.08.08.0refusedauto / uly4 / ring41.25×1.25×
PiD 4K upscale32.034.1—32.032.032.032.0refusedany (tie)1.00×1.00×
Qwen-Image252.3196.2130.1178.2refused196.2186.2100.1uly2+cfg22.52×1.30×
Radiance88.162.144.160.1refused42.042.032.0uly2+cfg22.75×1.38×
Z-Image18.014.0—14.010.0refused10.0refusedauto / ring41.80×1.40×

Video

Model1 GPU2N auto4N auto4N uly44N ring44N uly2+cfg2Fastest 4Nvs 1 GPUvs 2N
HunyuanVideo 720p3229.11907.51050.71060.81066.91016.8uly2+cfg23.18×1.88×
Wan SCAIL22754.31629.1920.8 ✗892.7939.0 ✗838.7 ✗uly43.09×1.82×
Wan Bernini-R1443.1906.8524.4508.5528.5460.4uly2+cfg23.13×1.97×
MiniMax H3 guides1074.9660.7refused402.4refusedrefuseduly42.67×1.64×
MiniMax H3 guide1050.9640.6refused388.4refusedrefuseduly42.71×1.65×
CogVideoX 1.5 I2V977.1616.6362.4374.4356.4336.3uly2+cfg22.91×1.83×
Wan 2.2 T2V fp16928.6604.6392.3346.2402.4334.3uly2+cfg22.78×1.81×
Wan 2.1 I2V888.5542.5314.3318.3322.3288.3uly2+cfg23.08×1.88×
Kandinsky5 Video882.7546.5306.3314.2314.3296.3uly2+cfg22.98×1.84×
Wan 2.1 T2V 14B872.7542.4314.3310.3322.4280.2uly2+cfg23.11×1.94×
MiniMax H3 t2va838.8538.4refused332.4refusedrefuseduly42.52×1.62×
Wan 2.2 I2V748.7468.4276.3266.3280.2246.2uly2+cfg23.04×1.90×
CogVideoX 1.5 T2V246.3156.2100.196.1106.188.1uly2+cfg22.80×1.77×
LTX 2.5 guide mask114.190.1refused70.1refusedrefuseduly41.63×1.29×
LTX 2.5 FLF2V112.188.1refused66.1refusedrefuseduly41.70×1.33×
LTX 2.5 I2V guide108.286.1refused64.1refusedrefuseduly41.69×1.34×
LTX 2.5 I2V104.182.1refused64.1refusedrefuseduly41.62×1.28×
LTX 2.5 multishot100.178.1refused62.1refusedrefuseduly41.61×1.26×
LTX 2.5 T2V96.274.2refused60.1refusedrefuseduly41.60×1.23×
LTX 2.3 I2V AV94.178.1refused54.1refusedrefuseduly41.74×1.44×
LTX 2.5 two-stage76.164.1refused56.1refusedrefuseduly41.36×1.14×
LTX 2.3 T2V74.152.040.038.140.0refuseduly41.94×1.36×
Wan FlowRVS (1 step)4.04.04.04.04.0refusedany (tie)1.00×1.00×

Wan SCAIL2’s uly2+cfg2 was the fastest render (838.7 s) but failed the quality check, so its speedups use uly4. LTX 2.5 two-stage on uly4 scored 0.089 against 1 GPU (pass) and 0.112 against the 2-node render, which was itself the one borderline result in the reproduction.

Reproduction of the published tables

1-GPU and 2-node runs reproduced Monarch’s published BENCHMARKS.md tables within a few percent: median 5.5% faster than published. The published tables have no 4-node numbers, so the 4-node results above are new.

MeasureResult
Cells run69 on the pair (spark-1 + spark-2) and 40 single-GPU (spark-3); 0 wedged, 0 blocked
Published cells compared109 of 117 (the 4 Chroma fp8mixed-final and 4 Ideogram4 bf16 rows have no public files)
Quality108 PASS, 1 CHECK: LTX 2.5 two-stage auto, NRMS 0.120 vs the 0.10 limit
Speed vs publishedMedian −5.5%; 94 of 109 within ±10%, 104 within ±15%
OutliersAll faster than published: Wan SCAIL2 auto −31%, Ernie cfg2 −28%, LTX 2.5 FLF2V auto −19%

Monarch cluster config (~/.config/dgx-monarch/cluster.toml, spark-1)

The stock dgx-spark-pair profile assumes a direct cable. On the switched fabric, NCCL must use all four RoCE functions and the lossless class:

client_bind = "tcp://172.16.1.15:0"
fabric_profile = "dgx-spark-pair"
transport_security = "trusted_fabric"
nccl_master_addr = "172.16.1.15"
nccl_master_port = 29777

[fabric.dgx-spark-pair]
NCCL_IB_HCA = "rocep1s0f0,roceP2p1s0f1,roceP2p1s0f0,rocep1s0f1"
NCCL_IB_TC = 104

With this override, all four rails carried balanced traffic (~10–17 GB per rail per render).
NCCL_IB_TC=104 puts the traffic on the switch’s lossless class.
Re-running dgxm setup --apply deletes this block, so add it back afterwards.

I wonder would this work by reclaiming some of the RAM available across 4xDGX that are running another model and use it to serve one of these visual generation models?

Interesting results! For the 2 node speed results, your speed increases could be due to being uncapped but also could be due to the fact that certain benchmarks are slightly outdated.

To run the full runbook in the repo it requires roughly 1 week plus. I only use that for major architectural changes in the code where I would want to validate every model I advertise as supported and at every quant.

This does give me some ideas for the gating process and some optimizations.

Good data.

Yes this was the intent behind utilizing FSDP at the cost of speed. I would imagine those with 4 nodes+ would benefit more so.

Also, with the release of the 64gig variants for the sparks - this mode could possible be the ONLY option valuable to those trying to utilize BF16 via two 64gig variants (assuming that’s all they have). For some models at least.

Not sure why one would get 2x 64 gig variants over 128 but I’m sure additional future pricing changes will make that clearer here soon :/