MATLAB: Parallel calculations on matlab

MATLABparallel computing

Hello,
As discussed in other posts, I understood that some functions are parallelized in Matlab, so they are fast in serial calculations ( like normxcorr2 which uses FFT functions and conv2).
I used this code
parfor( i=1:1000,20) % To do calculations on 20 cores only
y1= function_1(image1, template,....)
. % other lines
.
.
end
If inside function_1 I have FFT functions (like conv2 fft2 ,etc) and I allocate to this calculation the remaining cores
function y= function_1(image1,template,...)
parfor( i=1:41,24) % I allocated 24 cores to the child function
t=template{i};
correlation{i}=normxcorr2(image1,t),
%etc

end
%etc
end
Why when I open the task manager , in the section " performance" the percent of memory used is only 40% ?
I thought that when i have 44 cores and I allocate 20 to the global calculation and 24 to the functions inside , it will be 99% of memory used.
Thank you in advance !

Best Answer

As documented, nested parfor loops do not run in parallel. There is a graphical depiction of which loop runs, in the context of optimization solvers, here.
Alan Weiss
MATLAB mathematical toolbox documentation