Files
raea/sdk/cloud/bench/frame.py
shinyobjectz 775469dbac raea cloud render farm: one render split across Modal GPUs, a bench of every GPU kind, and an agent box on a Fly Sprite
deploy/modal/farm.py (app raea-farm) serves sdk/cloud's jobs protocol on many GPUs. A raea render to a video or a folder is probed on one GPU (frame 0 and the manifest), timed on 8 frames, then split into contiguous runs on as many GPUs as pay for their start (a start at most a fifth of the work, farm_plan.gpus_for), with an optional price ceiling (max_usd, exit 3). Video runs are H.264 parts that the coordinator joins by stream copy while it renders the sound on its CPU; Blender scenes (Cycles on OptiX) split the same way and encode their parts on their own GPUs. raea asks for T4, A10, then L4 (its frames are bound by the CPU); Blender asks for L40S, RTX PRO 6000, then L4 (the most samples a dollar). GPUs render without the clipping check, with 4 cores and 16 GiB, a 2 s idle window (at 60 s a job billed several times its GPU work), shader and kernel caches on the volume, and raea's models from the raea-models volume (deploy/modal/models.sh). Each job's log ends with its bill per container.

bench/gpus.py runs raea (edit.tsx, Solari, clip check on and off) and Blender's Open Data benchmark on every Modal GPU kind at once; bench/results holds the 11-17 run and bench/report.py prints its tables. deploy/sprites/box.sh puts raea, the ACP agents and the server on a Sprite with its renders sent to the farm; it reads the org only from ~/.config/raea-cloud/sprites.env and refuses orgs listed under private/cloud. The client and offload.ts pass gpus, gpu and max_usd.

Checked: test/farm_plan.py (7, stand-in GPUs) passes; test/farm.ts against the deployed farm returned edit.tsx as 90 frames at 1080p in 70 s on a T4, and Blender's classroom as 20 frames at 1080p and 256 samples on up to 10 GPUs (frames 3.1x faster than on one).
2026-11-17 19:52:34 -08:00

51 lines
2.3 KiB
Python

# One Blender frame timed end to end (bench/gpus.py): the Open Data benchmark's classroom scene at 1920x1080 with its
# own samples, denoised, on the launcher's Blender. Blender's start and the scene's load and BVH build are timed apart
# from the render, since a frame split across many GPUs pays them once per container.
import os
import re
import subprocess
import time
SETUP = """
import bpy, time
s = bpy.context.scene
s.render.resolution_x, s.render.resolution_y, s.render.resolution_percentage = 1920, 1080, 100
s.cycles.use_denoising = True
p = bpy.context.preferences.addons["cycles"].preferences
p.compute_device_type = "{kind}" if "{kind}" != "CPU" else "NONE"
p.get_devices()
for d in p.devices:
d.use = d.type == "{kind}"
s.cycles.device = "GPU" if "{kind}" != "CPU" else "CPU"
print("RAEA_SAMPLES", s.cycles.samples, "RAEA_LOADED", time.time())
"""
def classroom(version, kind):
# the launcher keeps them in its cache folder, wherever its build put it
hits = subprocess.run(["find", "/", "-xdev", "(", "-name", "blender", "-type", "f", "-o", "-name", "*.blend", ")"], capture_output=True, text=True).stdout.split()
exe = next((h for h in hits if h.endswith("/blender") and version in h), None) or next((h for h in hits if h.endswith("/blender")), None)
blend = next((h for h in hits if h.endswith("/classroom.blend")), None)
if not exe or not blend:
return {"error": "the launcher's Blender or classroom scene isn't in the image", "exe": exe, "blend": blend, "found": hits[:20]}
t = time.time()
r = subprocess.run(
[exe, "-b", blend, "-E", "CYCLES", "--python-expr", SETUP.format(kind=kind), "-o", "/tmp/frame_####", "-F", "PNG", "-f", "1"],
capture_output=True, text=True, timeout=1800,
)
total = time.time() - t
out = r.stdout + r.stderr
loaded = re.search(r"RAEA_LOADED ([\d.]+)", out)
samples = re.search(r"RAEA_SAMPLES (\d+)", out)
render = re.findall(r"Time: (\d+):([\d.]+)", out)
render_s = int(render[-1][0]) * 60 + float(render[-1][1]) if render else None
return {
"ok": r.returncode == 0 and os.path.exists("/tmp/frame_0001.png"),
"samples": int(samples.group(1)) if samples else None,
"load_s": round(float(loaded.group(1)) - t, 2) if loaded else None,
"render_s": render_s,
"total_s": round(total, 2),
"out": out[-2000:],
}