Files
leonarski_f 4809c1622c
Build Packages / build:portable:linux-x86_64:nocuda (push) Successful in 16m43s
Build Packages / build:jfjoch:ubuntu2404:nocuda (push) Successful in 28m46s
Build Packages / build:jfjoch:rocky8:cuda-sls9 (push) Successful in 32m5s
Build Packages / build:jfjoch:rocky9:cuda (push) Successful in 39m44s
Build Packages / build:portable:macos-arm64:nocuda (push) Successful in 5m7s
Build Packages / Create release (push) Successful in 8s
Build Packages / Build documentation (push) Successful in 49s
Build Packages / build:portable:linux-x86_64:cuda (push) Successful in 22m30s
Build Packages / build:jfjoch:rocky8:nocuda (push) Successful in 31m54s
Build Packages / build:rugnux:linux-aarch64:cuda (push) Successful in 11m29s
Build Packages / build:portable:windows-x86_64:nocuda (push) Successful in 23m51s
Build Packages / build:jfjoch:ubuntu2204:nocuda (push) Successful in 26m7s
Build Packages / build:jfjoch:ubuntu2204:cuda (push) Successful in 29m38s
Build Packages / build:portable:windows-x86_64:cuda (push) Successful in 28m6s
Build Packages / HDF5 consumer tests (DIALS, XDS) (push) Successful in 29m44s
Build Packages / build:jfjoch:rocky9:nocuda (push) Successful in 33m22s
Build Packages / Generate python client (push) Successful in 47s
Build Packages / build:jfjoch:rocky9:cuda-sls9 (push) Successful in 34m6s
Build Packages / Unit tests (push) Successful in 1h2m47s
Build Packages / build:jfjoch:rocky8:cuda (push) Successful in 35m59s
Build Packages / build:jfjoch:ubuntu2404:cuda (push) Successful in 34m8s
Build Packages / Validation Battery (push) Successful in 38m31s
v1.0.0-rc.187 (#98)
* Rugnux: Refinement several times faster, one protocol on the CPU and the GPU, parts of it on the Apple GPU; its random draws are the same on every platform.
* Rugnux: Refinement follows common practice: the free set decides only the restraint weights and the displacement model (isotropic, TLS or anisotropic, by Hamilton's test), everything else is decided on the working set; lower R-free for placed and predicted models.
* Rugnux: Restraint dictionaries via `--restraints` (or among the inputs) and more built-in ligands; a model whose space group is a subgroup of the data's is refined in its own group; reflections plus a model select `--mode refine` on their own.
* Rugnux: `-C` fixes the crystal system on the axes as typed; `-S` alone fixes the space group only, the cell is still found and reduced; a space group or cell stored in the input file is ignored, with a line in the log.
* Rugnux: More reliable multi-sweep merging; `--mode scale` merges several stills runs as one; `_plot.txt` and the report name each input; a second crystal form is reported for stills given a cell.
* jfjoch_broker (experimental): Live Rugnux on FPGA detectors (JUNGFRAU) takes the same path as a DECTRIS stream, rotation and serial alike, model step included, with analysis threads per GPU; frames waiting for the analysis can be viewed; no host stage drops a frame - a source faster than the analysis is held at the card.
* jfjoch_broker: Summation of more than 256 frames per image is split between the card and the host (`summation_mode` is then `hybrid`), and live Rugnux runs on such collections; pedestal runs take a receiver of their own.
* jfjoch_broker (experimental): `stills_downsample` analyses 1 of every N serial images (chosen by a hash; the first 2000 all; the others written without analysis; reset to 1 by `/initialize`); `max_spot_count` left out means 250 for per-image indexing and up to 1000 for live stills; the live status gives the merge before the model work, the fitted resolution and the anomalous peak height of each unexplained blob.
* jfjoch_broker: Without a `pcie` entry the broker runs on a mock of the card instead of the HLS simulation; its spot, ROI and azimuthal results are zero then.
* Web frontend: Redesigned Rugnux live page; Vite 8, TypeScript 6, Mol* 5.13 and dependency security updates.
* Tools: `jfjoch_fpga_stills_test` measures live stills on the cards with a stored dataset; `jfjoch_fpga_test` loses the HLS-simulation option.
* Other: FFTW no longer fetched or linked (the CPU FFT indexer keeps the name `FFTW`); PCIe driver now GPL-2.0-or-later and third-party notices complete; several crash fixes.

Reviewed-on: #98
Co-authored-by: Filip Leonarski <filip.leonarski@psi.ch>
2026-11-19 20:49:28 +01:00

13 KiB

Installing Rugnux

:local:
:depth: 2

rugnux is a single self-contained executable. It needs no CUDA toolkit, no Qt, and no Jungfraujoch service running anywhere; on a machine with an NVIDIA GPU it needs the NVIDIA driver, and without one it still runs on the CPU.

From the package repositories (RHEL / Rocky / Ubuntu)

On a distribution covered by the package repositories, rugnux is a package of its own:

sudo dnf install rugnux          # RHEL / Rocky 8 and 9
sudo apt install rugnux          # Ubuntu 22.04 / 24.04

It installs /usr/bin/rugnux and depends on nothing from the acquisition side — no broker, no detector libraries, no Qt — so it can go on a machine that only processes data.

From the release archive

For a machine no package manager covers — or for Windows, macOS and Arm, which have no repository — take the archive for your architecture from the download page or the Gitea release page:

Archive For
rugnux-<version>-linux-x86_64-cuda12.tgz 64-bit Intel/AMD Linux. Built on RHEL 8, so it runs on any newer Linux
rugnux-<version>-linux-aarch64-cuda13.tgz 64-bit Arm Linux — NVIDIA GH200 and DGX Spark. Built on Ubuntu 24.04, so it needs glibc 2.39 or newer. Tested on a DGX Spark (GB10)
rugnux-<version>-win64-cuda13.zip 64-bit Windows
rugnux-<version>-macos-arm64-cpu.tgz macOS 13 (Ventura) or newer on Apple Silicon (M1 and newer). No CUDA on macOS: CPU, with Bragg integration, the model density and the molecular-replacement rotation function on the Apple GPU (Metal). Tested on an Apple M-series Mac mini. Intel Macs are not supported

The archive has no top-level directory — it unpacks straight into bin/ and share/. Always give tar a destination of its own, or it will scatter those into whatever directory you are in:

VERSION=1.0.0
curl -L -O https://gitea.psi.ch/mx/jungfraujoch/releases/download/$VERSION/rugnux-$VERSION-linux-x86_64-cuda12.tgz
mkdir -p /opt/rugnux-$VERSION
tar xzf rugnux-$VERSION-linux-x86_64-cuda12.tgz -C /opt/rugnux-$VERSION
/opt/rugnux-$VERSION/bin/rugnux            # prints the usage

The archive is 268 MB, about 45 s to download at 50 Mbit/s. Nothing else is installed.

What you get is:

bin/rugnux                                  the program
share/doc/jfjoch_rugnux/LICENSE             GPLv3
share/doc/jfjoch_rugnux/THIRD_PARTY_NOTICES.md
share/doc/jfjoch_rugnux/ACKNOWLEDGEMENT.md
share/doc/jfjoch_rugnux/licenses/           verbatim licence texts of the bundled dependencies

Nothing is written outside that directory, nothing needs root, and several versions can sit side by side. To remove it, delete the directory. Put bin/ on your PATH if you want to type rugnux rather than the full path.

macOS: the binary is signed with the project's Apple Developer ID and notarized, so a .tgz downloaded with a browser runs without further steps; the first run of a freshly downloaded copy checks the notarization online. Unpacking into a directory under your home directory (~/rugnux-<version>) rather than /opt avoids needing sudo on a Mac.

Mixing the two. If a rugnux package is also installed, /usr/bin/rugnux will normally win on PATH. Put the archive's bin/ first, or call it by its full path, to be sure which one you are running — rugnux prints its version on every run.

A first run

To check the installation, run the 9ZLO example of the Quick start: a 10.8 GB download from Zenodo, one command, about 20 s on a desktop GPU. The expected numbers are given there and in A first run in detail.

GPU support

The released Linux and Windows archives are CUDA builds (the macOS one is CPU-only). They need only an NVIDIA driver on the host — 525.60.13 or newer for the CUDA 12 archive, 580.65.06 or newer for the CUDA 13 ones — and no CUDA toolkit, because everything CUDA is linked statically. With no GPU or no driver, rugnux reports zero CUDA devices and falls back to the CPU path, which works but is far slower: the FFT search runs on the CPU FFT (pocketfft) and ffbidx on its CPU implementation, and the refinement of a placed model takes minutes rather than seconds. A V100 needs the CUDA 12 archive; which generations each build covers is in Release contents ▸ GPU generations and the NVIDIA driver.

Building from source

rugnux alone, without the server stack or Qt:

cmake -S . -B build -DJFJOCH_RUGNUX_ONLY=ON -DCMAKE_BUILD_TYPE=Release \
      -DCMAKE_CXX_FLAGS="-march=x86-64-v3" -DCMAKE_C_FLAGS="-march=x86-64-v3"
cmake --build build -j$(nproc) --target rugnux

On RHEL / Rocky 8 the system GCC 8 configures but cannot build it (CUB requires at least C++17): install gcc-toolset-13, run source /opt/rh/gcc-toolset-13/enable before cmake, and start from a fresh build directory if one was configured with GCC 8. The binary lands in build/rugnux/rugnux. No library has to come from the system: every dependency is downloaded and built during the first configure, which therefore needs network access. cmake --build build --target package produces the same .tgz the release ships. The build system sets no -march flag of its own, so a plain build is slower than the released one on the CPU-bound stages but gives the same results: floating-point contraction is off, so the x86 level a binary targets changes its speed and not its answer.

On a Mac (Apple Silicon), leave the two -march flags out — they name an x86 level; the Apple compiler's default target is already the M1 — and use sysctl -n hw.ncpu for the job count. The build has no CUDA there and needs nothing installed beyond Xcode and CMake; its Bragg integration, the model density and the molecular-replacement rotation function run on the Apple GPU through Metal (GPU data analysis ▸ Apple GPUs).

Hardware

As with the rest of Jungfraujoch, serious performance requires an NVIDIA GPU. The CUDA build provides the GPU fast-feedback indexer (ffbidx) and the GPU FFT indexer (cufft); without CUDA ffbidx runs on its CPU implementation and -X fft on the CPU fftw indexer. With a GPU present most of the per-image pipeline runs on the device — bitshuffle+LZ4 decompression, miniCBF byte-offset decoding and marCCD widening, image preprocessing, azimuthal integration, spot finding, prediction and Bragg integration — as do the pre-scan (beam-stop mask, background beam-centre fit, spot widths, defective pixels; one accumulator per card), rotation scaling and merging from the ingest of the reflections onwards (sorting and the resolution cut included) with its correction surfaces, and --model: the structure factors, scale fits and rigid-body placement of the validation, the rotation and translation functions of molecular replacement, and the refinement of the placed model. The CPU implementations are the path where there is no GPU, and the two agree to rounding rather than bit for bit (parts of the scaling and the model fits round differently on the card), so a GPU and a CPU run can differ in the last digits of the merged data. The choice is automatic; a CUDA build runs on the CPU when told to (rugnux --no-gpu ...). The thread count (-N) governs the CPU side of all of it.

The released CUDA builds need only an NVIDIA driver on the host, no CUDA toolkit: 525.60.13 or newer for the CUDA 12 artefacts (RHEL 8 packages, the x86_64 rugnux archive) and 580.65.06 or newer for the CUDA 13 ones (RHEL 9, Ubuntu, the aarch64 and Windows rugnux archives). Which GPU 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.

Memory

A run's memory is set by how many reflection observations it integrates, not by how many pixels the detector has. Measured 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 in the table at -N 6; an ordinary sweep needs 16 GB and 6 GB. The device column is an upper bound.

Both peaks fall in scaling and merging, not in the per-image loop: the loop alone stays under 3.2 GB on the device at -N 6, 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 on top of a fixed 2.6 GB, linear with no ceiling: an 18 MP sweep takes about 3 GB of device memory at -N 6 and 8 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 — roughly halves both peaks. It also gives up the merged output.
  • --no-export-unmerged does not save memory. <prefix>_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. The steps that can be too large for a card decide between GPU and CPU before they touch it, from the card's total memory, so the same input on the same card always takes the same path: rotation scaling and merging runs on the CPU where it would take more than 80% of the card (and logs ... scaling on the CPU instead), --model validation and molecular replacement place each of their parts on the GPU or the CPU against a budget of 80% of the card, the beam-centre FFT runs on the CPU where it would take more than half of it, and on a small card the per-image workers are fewer. Past those decisions 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. 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.

Very large unit cells

The rule above holds for the cells in that table, and a very large cell sits far beyond it. A long axis, a dense pattern and many frames multiply together: each frame predicts more reflections, each reflection is split over more frames, and tens of millions of partial observations are normal for a big cell. The 400 Å virus capsid of the README's demo (PDB 4NWV) peaks at about 20 GB of host memory on a GPU build. A CPU-only build keeps in host RAM what a GPU build keeps on the card, so it is the one that needs the large machine. When such a set is too large for GPU scaling on the card, the run scales and merges it on the CPU instead, with a warning in the log — and then wants that much host memory for that step.

Out of host memory

Nothing estimates the host memory a run will need before it starts, so a set that does not fit runs until the memory is gone, and then ends in one of two ways.

Where the allocation is refused — under an address-space limit (ulimit -v, which some batch systems set), with strict overcommit, or for one request larger than the machine could ever grant — the run stops with

Processing failed: out of host memory (std::bad_alloc) - this data set needs more RAM than is available

and a non-zero exit status. The CUDA driver reserves a large address space of its own, so a GPU build under a tight ulimit -v can stop before reading anything, with CUDA (GPU) error (out of memory).

More often on Linux the allocation succeeds and the memory runs out as it is used. The kernel's OOM killer then ends the process with SIGKILL, which no program can catch: the run stops with no message of its own, the shell prints Killed (exit status 137), and dmesg or the batch system's log has an Out of memory: Killed process line. A job capped by a cgroup memory limit ends the same way. A run that disappears like this needs more RAM than the machine or the job was given, exactly as if it had said so. --no-merge lowers the host peak, as above; otherwise the run needs a larger machine.