From 470fc4e4791bc545dd3be725fad03dbd46644ca0 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Mon, 26 Oct 2026 15:22:22 +0100 Subject: [PATCH] ffbidx (vendored): INDEXER_GPU_DEVICE is not read, the indexer stays on the thread's pinned GPU The environment variable overrode the current device that ScopedGpuPin sets, so a stray value moved an indexing thread to another card. Recorded in the file header as a local modification, together with the deterministic tie-break of c982ba4f6. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_015CeEGgpKdfkCTJb3YNMJcu (cherry picked from commit 89acdeef939ee82cf15ee9c5fb52a016fb1441f8) --- .../fast-feedback-indexer/indexer_gpu.cu | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/image_analysis/indexing/fast-feedback-indexer/indexer_gpu.cu b/image_analysis/indexing/fast-feedback-indexer/indexer_gpu.cu index 750fdfbc9..5f44be5ed 100644 --- a/image_analysis/indexing/fast-feedback-indexer/indexer_gpu.cu +++ b/image_analysis/indexing/fast-feedback-indexer/indexer_gpu.cu @@ -1,5 +1,7 @@ // Vendored from https://github.com/paulscherrerinstitute/fast-feedback-indexer, commit a94fd4f5c55289e70860feea358182d2072e02b5 // (indexer/src/indexer_gpu.cu), BSD-3-Clause - see LICENSE.md in this directory. +// Local modifications: a deterministic tie-break in the candidate ordering; the INDEXER_GPU_DEVICE environment +// variable is not read (the indexer runs on the calling thread's current device, the one Jungfraujoch pins). /* Copyright 2022 Paul Scherrer Institute @@ -47,7 +49,6 @@ using logger::stanza; namespace { - constexpr char INDEXER_GPU_DEVICE[] = "INDEXER_GPU_DEVICE"; constexpr char INDEXER_GPU_DEBUG[] = "INDEXER_GPU_DEBUG"; constexpr unsigned n_threads = 1024; // num cuda threads per block for find_candidates kernel constexpr unsigned warp_size = 32; // number of threads in a warp @@ -186,24 +187,12 @@ namespace { } } - // Get a CUDA device - // Take the device given with INDEXER_GPU_DEVICE if set, - // otherwise take the current device. + // Get a CUDA device: the current device (local modification: no INDEXER_GPU_DEVICE override) static int get() { int dev{-1}; CU_CHECK(cudaGetDevice(&dev)); - char* dev_string = std::getenv(INDEXER_GPU_DEVICE); - if (dev_string != nullptr) { - std::istringstream iss{dev_string}; - iss >> dev; - if (!iss || !iss.eof()) - throw FF_EXCEPTION_OBJ << "wrong format for " << INDEXER_GPU_DEVICE << ": " << dev_string << " (should be an integer)"; - if ((dev < 0) || (dev >= (int)list.size())) - throw FF_EXCEPTION_OBJ << "illegal value for " << INDEXER_GPU_DEVICE << ": " << dev << " (should be in [0.." << list.size() << "[)"; - } - LOG_START(logger::l_info) { logger::info << stanza << "using GPU device " << dev << '\n'; } LOG_END;