From a5ba1f8e955c7587c42eadead980dd94f7b363b1 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Sat, 12 Sep 2026 23:48:49 +0200 Subject: [PATCH] docs: what a rugnux run costs in host and device memory Measured on rc.169 over rotation sweeps from 2.5 to 18 megapixels: both peaks fall in scaling and merging, and both track the number of integrated observations rather than the detector size - two sweeps on the same detector differ five-fold. Device memory is linear in -N at about 8 bytes per detector pixel per worker over a fixed floor, so the 16 GB card that fits four light runs fits one heavy one. --no-merge and -N lower the peak; --no-export-unmerged was measured and does not - it saves disk, not RAM. Also records what happens when the card is too small: device decode, the beam-stop projection and an indexer thread degrade to the host, everything else fails the run with a non-zero exit rather than returning a short dataset. --- docs/HARDWARE.md | 5 +++++ docs/RUGNUX.md | 4 ++++ docs/RUGNUX_INSTALL.md | 46 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+) diff --git a/docs/HARDWARE.md b/docs/HARDWARE.md index e1be8bb0c..24e55706e 100644 --- a/docs/HARDWARE.md +++ b/docs/HARDWARE.md @@ -42,6 +42,11 @@ Operating fast-feedback indexer code requires operation of a graphic processing For practical reasons, i.e. power consumption and cost, we choose inference grade card Nvidia L4. In the past we have also used T4 cards. So, in principle any recent CUDA compatible GPU should work. +Offline processing with [`rugnux`](RUGNUX.md) has a requirement of its own, unrelated to the frame +rate the acquisition side is sized for: one run wants 3-7 GB on the card and up to 14 GB of host +RAM, so a server that also reprocesses data needs headroom beyond the online pipeline's. The +sizing table is in [Installing rugnux ▸ Memory](RUGNUX_INSTALL.md#memory). + ## Network switch Small detectors (up to 4M pixel) can be in principle operated without switch. In this case one needs `8x10g` variant of the Jungfraujoch FPGA image, which allows to directly connect 4 JUNGFRAU modules to one U55C card. diff --git a/docs/RUGNUX.md b/docs/RUGNUX.md index c19febc56..368ff7923 100644 --- a/docs/RUGNUX.md +++ b/docs/RUGNUX.md @@ -107,6 +107,10 @@ A few things worth knowing before reaching for more flags: intensities are usable at all. - **`--scaling-high-resolution `**, where the resolution is already known, sharpens both the space-group search and the error model. +- **A run wants memory in proportion to what it integrates**, not to the detector: 2.5-14 GB of + host RAM and 3-7 GB on the card over the datasets measured, both peaking in scaling and + merging. [Installing rugnux ▸ Memory](RUGNUX_INSTALL.md#memory) has the table and the two + flags that lower it. - Everything else is in [Running rugnux](RUGNUX_TUTORIAL.md#running-rugnux) and the full [Command-line options](RUGNUX_ADVANCED.md#command-line-options). diff --git a/docs/RUGNUX_INSTALL.md b/docs/RUGNUX_INSTALL.md index 7f6e16de3..d4e701b1f 100644 --- a/docs/RUGNUX_INSTALL.md +++ b/docs/RUGNUX_INSTALL.md @@ -106,3 +106,49 @@ newer for the CUDA 13 ones (RHEL 9, Ubuntu, the aarch64 and Windows `rugnux` arc generations each artefact supports — a V100 in particular works only with the CUDA 12 build — is in [Release contents ▸ GPU generations and the NVIDIA driver](RELEASE_CONTENTS.md#gpu-generations-and-the-nvidia-driver). +### Memory + +A run's memory is set by **how many reflection observations it integrates**, not by how many pixels +the detector has. Measured on rc.169 at `-N 6`, over rotation sweeps of 1200-1800 frames: + +| Detector | Observations integrated | Host (peak RSS) | Device | +| --- | --- | --- | --- | +| 1679 x 1475 (2.5 MP) | 25 M | 7.8 GB | 3.8 GB | +| 2527 x 2463 (6.2 MP) | 13 M | 4.9 GB | 3.1 GB | +| 3262 x 3108 (10.1 MP) | 7 M | 2.5 GB | 3.0 GB | +| 4371 x 4150 (18.1 MP) | 13 M | 4.3 GB | 3.2 GB | +| 4371 x 4150 (18.1 MP) | 20 M | 6.0 GB | 4.4 GB | +| 3262 x 3108 (10.1 MP) | 50 M | 14.2 GB | 7.0 GB | + +Two sweeps on the same detector differ by a factor of five, so size the machine on the observation +count rather than on the detector. As a rule, **0.6 GB + 0.3 GB of host memory per million +observations, and 2.4 GB + 0.1 GB of device memory per million**. The run reports what it actually +integrated — `RotationScaleMerge: ingested ... partial observations`. **32 GB of host RAM and an +8 GB card** cover every dataset measured here at `-N 6`; an ordinary sweep needs 16 GB and 6 GB. + +Both peaks fall in **scaling and merging**, not in the per-image loop: the loop alone stays under +3.2 GB on the device whatever the detector. The stage that needs the most is the 3D combine. + +`-N` multiplies the per-image loop only — about **8 bytes of device memory per detector pixel per +worker** (150 MB per worker at 18 MP, 87 MB at 6 MP) on top of a fixed ~2.6 GB, and it is linear +with no ceiling: the same 18 MP sweep takes 2.7 GB of device memory at `-N 1`, 3.2 GB at `-N 6` and +8.0 GB at `-N 32`. Host memory does not move with `-N`, and neither does the merge's own device +memory. Where several runs share one card, `-N` is the knob that decides how many fit. + +To use less: + +- **`-N`** — the only flag that lowers the per-image loop's device memory. Lowering it is what + rescues a run on a card that is otherwise full. +- **`--no-merge`** — on the heaviest sweep measured it took the host peak from 14.2 to 8.3 GB and + the device peak from 7.0 to 2.9 GB. It also gives up the merged output. +- **`--no-export-unmerged`** does **not** save memory. `_unmerged.mtz` is the largest file a + run writes, but its observations are resident either way; the flag saves disk, not RAM. + +Nothing measures the free memory on the card before allocating. A run that does not fit degrades +where it can — device decompression falls back to the host, the beam-stop projection falls back to +the host, an indexer thread that cannot allocate reports the frame as not indexed — and **fails the +run otherwise**, with `Processing failed: CUDA (GPU) error (Failed to allocate device memory)` and a +non-zero exit status. That is deliberate: a CUDA out-of-memory says nothing about the frame in +flight and everything about the machine, so skipping frames would leave a run that looks complete +with quietly different merged numbers. A run is never silently short; it either completes or fails. +On a GPU shared with another job, lower `-N` or wait for the card.