From f3e55b8600529ee213eb53b3e2a1628d44210b24 Mon Sep 17 00:00:00 2001 From: Niklas Neubrand <38315848+niklasneubrand@users.noreply.github.com> Date: Thu, 7 Nov 2024 14:12:38 +0100 Subject: [PATCH] Do not update nMaxThreads automatically nMaxThreads is given to the c code at the compilation time. It should not be changed without regenerating the c code. Therefore, I remove this line from arSetParallelThreads. --- arFramework3/Advanced/arSetParallelThreads.m | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/arFramework3/Advanced/arSetParallelThreads.m b/arFramework3/Advanced/arSetParallelThreads.m index 2a205736..06875c66 100644 --- a/arFramework3/Advanced/arSetParallelThreads.m +++ b/arFramework3/Advanced/arSetParallelThreads.m @@ -19,7 +19,14 @@ function arSetParallelThreads(n, silent) % get correct number of cores and max threads ar.config.nCore = feature('numCores'); -ar.config.nMaxThreads = 2*ar.config.nCore; +if ~isfield(ar.config, 'nMaxThreads') + ar.config.nMaxThreads = 2*ar.config.nCore; +% else: +% do not overwrite nMaxThreads. Reason: +% The value also appears as a hard-coded value in the c code. +% If you change nMaxThreads manually, use arCompile (arRecompile or arCompileAll) +% with option forcedCompile=1 to regenerate the c code. +end % set default values if ~exist('silent','var') || isempty(silent)