Image-loop workers per card bounded by the card's memory
A worker of the full-analysis image loop holds about 24 bytes a detector pixel on its card (sixteen held 6.3 GB on a 16.8 Mpx detector, measured with nsys). The workers now keep to half of the card's total memory: on a 16 GB card that is still the sixteen of before for detectors up to ~21 Mpx; on an 8 GB card with a 16.8 Mpx detector it is ten, where sixteen ran out of memory with ~7 GB free. How many workers there are changes only the loop's speed. An explicit -N is obeyed as before. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
beba8f0301
commit
c1b745fdfc
1 file changed
+11
-1
@@ -368,9 +368,19 @@ void Rugnux::ImagePass(PipelineLocals &p) {
|
||||
// which is what a previous attempt at this got wrong.
|
||||
// Only the full-analysis worker drives a card; the azimuthal one preprocesses and integrates on
|
||||
// the CPU and wants every thread it can have, so the cap must not reach it.
|
||||
// A worker also holds about 24 bytes a detector pixel of its card - sixteen held 6.3 GB on a 16.8 Mpx
|
||||
// detector - and the workers keep to half of the card, so a small card gets fewer of them. How many
|
||||
// there are changes only how fast the loop runs, never what it computes.
|
||||
const int gpus = get_gpu_count();
|
||||
int workers_per_card = 16;
|
||||
if (gpus > 0) {
|
||||
constexpr int64_t WORKER_BYTES_PER_PIXEL = 24;
|
||||
const auto fit = static_cast<int64_t>(get_gpu_total_memory(0) / 2)
|
||||
/ (WORKER_BYTES_PER_PIXEL * experiment_.GetPixelsNum());
|
||||
workers_per_card = static_cast<int>(std::clamp<int64_t>(fit, 1, 16));
|
||||
}
|
||||
const int image_workers = (per_image_analysis && config_.nthreads_auto && gpus > 0)
|
||||
? std::min(config_.nthreads, std::max(16, 16 * gpus))
|
||||
? std::min(config_.nthreads, workers_per_card * gpus)
|
||||
: config_.nthreads;
|
||||
if (image_workers < config_.nthreads)
|
||||
logger.Info("Per-image loop: {} of {} threads ({} GPUs) - past what a card can take queue "
|
||||
|
||||
Reference in new issue
Block a user