From 23b432f570e4d3bdaf23a657106616b8acf1d7c5 Mon Sep 17 00:00:00 2001 From: Felix Weiglhofer Date: Tue, 1 Jul 2025 16:55:10 +0200 Subject: [PATCH] OpenCL: Propagate number of host threads to PoCL runtime. --- GPU/GPUTracking/Base/opencl/GPUReconstructionOCL.cxx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/GPU/GPUTracking/Base/opencl/GPUReconstructionOCL.cxx b/GPU/GPUTracking/Base/opencl/GPUReconstructionOCL.cxx index ce05e159461e5..49533216869d2 100644 --- a/GPU/GPUTracking/Base/opencl/GPUReconstructionOCL.cxx +++ b/GPU/GPUTracking/Base/opencl/GPUReconstructionOCL.cxx @@ -63,6 +63,13 @@ int32_t GPUReconstructionOCL::GPUChkErrInternal(const int64_t error, const char* int32_t GPUReconstructionOCL::InitDevice_Runtime() { + // Propagate processing settings to PoCL runtime. + // Won't affect other OpenCL runtimes. + if (int nThreads = mProcessingSettings->nHostThreads; nThreads > 0) { + auto nThreadsStr = std::to_string(nThreads); + setenv("POCL_CPU_MAX_CU_COUNT", nThreadsStr.c_str(), 1); + } + if (mMaster == nullptr) { cl_int ocl_error; cl_uint num_platforms;