The source code for the parfor-loop that is trying to execute on the worker could not be found.
23 views (last 30 days)
Show older comments
Hi. I have compiled my code and I'm trying to run it by matlab runtime on a linux HPC server. The code has been parallelized by parfor and it works well in matlab, but when I try to run it with matlabruntime I get this error while I don't use "nanmean" in my code.
The source code (parallelized_closedLoopSimulation) for the parfor-loop that is trying to execute on the worker could not be found.
Caused by:
Undefined function 'nanmean' for input arguments of type 'double'.
Error using remoteParallelFunction (line 84)
Worker unable to find file.
Undefined function 'nanmean' for input arguments of type 'double'.
MATLAB:parfor:SourceCodeNotAvailable.
Here is part of my parfor loop:
parfor run = 1: nbRun
fprintf(['%%%%****** RUN NUM: ' num2str(run) '******%%%%%'])
%% ===== Step 3 - starting of 26 chunks of consequitive trials =======
for chunk = 1:length(chunks)
fprintf(['START chunk number: ' num2str(chunk) '/n']);
current_chunk = chunks{1,chunk}{1,1};
sCfg = [];
sCfg.dataset = currentSessionPath;
sCfg.trialdef.eventtype = cTRIGTYPE;
sCfg.trialdef.eventvalue = ceTRIG;
sCfg.trialdef.prestim = PRESTIM;
sCfg.trialdef.poststim = POSTSTIM;
sCfg.trialfun = cTRIALFUN;
...
end
1 Comment
Christopher McCausland
on 12 Dec 2023
Hi Sina,
nanmean() is an inbuilt function which calculates the mean value, ignoring NaN's. I believe it is depreciated and mean() with pairwise inputs to specify the NaN behaviour is preferred.
That being said, this is beside the point. Your worker nodes cannot see these inbuilt functions. Are you sure that the root folder of MATLAB installation to cluster ClusterMatlabRoot is set to the correct path?
Kind regards,
Christopher
Answers (0)
See Also
Categories
Find more on Parallel for-Loops (parfor) in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!