mirror of
https://github.com/shinyobjectz/raea.git
synced 2026-12-01 21:03:47 -10:00
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).
44 lines
1.4 KiB
Python
44 lines
1.4 KiB
Python
# Modal's list prices (modal.com/pricing, read 2026-11-17), in dollars per second, and what a container cost. A GPU
|
|
# container also pays for its CPU (per physical core, two vCPUs) and memory, which on an L4 is most of the price again
|
|
# at 8 cores and 32 GiB: why bench/gpus.py's numbers come with the container's size.
|
|
|
|
import re
|
|
|
|
GPU = {
|
|
"B300": 0.001972,
|
|
"B200": 0.001736,
|
|
"H200": 0.001261,
|
|
"H100": 0.001097,
|
|
"RTX-PRO-6000": 0.000842,
|
|
"A100-80GB": 0.000694,
|
|
"A100-40GB": 0.000583,
|
|
"L40S": 0.000542,
|
|
"A10": 0.000306,
|
|
"L4": 0.000222,
|
|
"T4": 0.000164,
|
|
}
|
|
CORE = 0.0000131 # one physical core
|
|
GIB = 0.00000222 # one GiB of memory
|
|
|
|
|
|
def per_hour(kind, cpu, memory_gib):
|
|
return round(3600 * (GPU.get(kind, 0) + cpu * CORE + memory_gib * GIB), 4)
|
|
|
|
|
|
def cost(kind, cpu, memory_gib, seconds):
|
|
return round(seconds * per_hour(kind, cpu, memory_gib) / 3600, 4)
|
|
|
|
|
|
def kind_of(name):
|
|
"""nvidia-smi's name for a GPU (NVIDIA L40S, Tesla T4, NVIDIA RTX PRO 6000 Blackwell Server Edition, NVIDIA
|
|
A100-SXM4-40GB) as its name here, or "" when it isn't one."""
|
|
n = name.upper()
|
|
if "RTX PRO 6000" in n:
|
|
return "RTX-PRO-6000"
|
|
if "A100" in n:
|
|
return "A100-80GB" if "80GB" in n else "A100-40GB"
|
|
for k in ("B300", "B200", "H200", "H100", "L40S", "A10", "L4", "T4"):
|
|
if re.search(rf"\b{k}\b", n):
|
|
return k
|
|
return ""
|