IndexerThreadPool: Bind to GPU NUMA node

This commit is contained in:
2025-10-04 09:22:43 +02:00
parent 0563f15a23
commit a15aa4eaa7
7 changed files with 83 additions and 2 deletions
@@ -67,9 +67,17 @@ std::future<std::optional<CrystalLattice> > IndexerThreadPool::Run(const Diffrac
return result;
}
void IndexerThreadPool::Worker(size_t threadIndex, const NUMAHWPolicy &numa_policy, const IndexingSettings &settings) {
void IndexerThreadPool::Worker(int32_t threadIndex, const NUMAHWPolicy &numa_policy, const IndexingSettings &settings) {
try {
#ifdef JFJOCH_USE_CUDA
auto gpu_count = get_gpu_count();
if (gpu_count > 0)
NUMAHWPolicy::SelectGPUAndItsNUMA(threadIndex % gpu_count);
else
numa_policy.Bind(threadIndex);
#else
numa_policy.Bind(threadIndex);
#endif
} catch (...) {
// NUMA policy errors are not critical and should be ignored for the time being.
}