From 0df7663286b9e6bed531f9441bc1eafe06f59cc3 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Sat, 7 Nov 2026 23:20:32 +0100 Subject: [PATCH] jfjoch_broker keeps FFT indexers and cuFFT plans for its life, not the rotation receiver The two never-destroyed FFTIndexerReuse and FFTPlanReuse objects move from the JFJochReceiverRugnuxRotation constructor into the broker's main. In the broker nothing changes. In jfjoch_test the first rotation receiver no longer keeps indexers and plans for the rest of the process: with Catch2's random order, the GPU memory tests that ran after one found 37 plans kept and the indexer memory already taken (CudaFFTPlan_SharedAndKept, IndexerThreadPool_ReleaseIndexersGivesTheCardBack, IndexerThreadPool_FFTIndexerKeptAcrossPools, the three CI failures on 0d26ecd13). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01HVeDQsU5a8AJUdJPgWevAK --- broker/jfjoch_broker.cpp | 3 +++ receiver/JFJochReceiverRugnuxRotation.cpp | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/broker/jfjoch_broker.cpp b/broker/jfjoch_broker.cpp index 0f4606848..00e891094 100644 --- a/broker/jfjoch_broker.cpp +++ b/broker/jfjoch_broker.cpp @@ -70,6 +70,9 @@ int main(int argc, char **argv) { // cuFFT's initialisation, and card 0's context, ahead of the first collection; the plan it times shows // whether the CUDA JIT cache works - without one, every plan the analysis makes is compiled again. LogCudaJitCache(logger, WarmUpCuFFT()); + // Indexers and cuFFT plans kept for the life of the broker; never destroyed, the CUDA runtime may be gone at exit + [[maybe_unused]] static const FFTIndexerReuse *fft_indexers = new FFTIndexerReuse; + [[maybe_unused]] static const FFTPlanReuse *fft_plans = new FFTPlanReuse; org::openapitools::server::model::Jfjoch_settings settings; std::ifstream file(argv[1]); diff --git a/receiver/JFJochReceiverRugnuxRotation.cpp b/receiver/JFJochReceiverRugnuxRotation.cpp index 4645da057..df00ab297 100644 --- a/receiver/JFJochReceiverRugnuxRotation.cpp +++ b/receiver/JFJochReceiverRugnuxRotation.cpp @@ -107,9 +107,6 @@ JFJochReceiverRugnuxRotation::JFJochReceiverRugnuxRotation(const DiffractionExpe model(std::move(in_model)), deadline_s(in_deadline_s), live_status(in_live_status) { - // Indexers and cuFFT plans kept for the life of the broker; never destroyed, the CUDA runtime may be gone at exit - [[maybe_unused]] static const FFTIndexerReuse *fft_indexers = new FFTIndexerReuse; - [[maybe_unused]] static const FFTPlanReuse *fft_plans = new FFTPlanReuse; logger.Info("rugnux live: starting {} forward threads; rugnux runs on {} threads while the images arrive, " "planning against {:.1f} GB of host memory", nthreads, rugnux_nthreads, static_cast(host_budget) / 1e9);