Hello,
I've read in there : http://www.mathworks.com/matlabcentral/newsreader/view_thread/328054#901620
that it's better to use intrinsically multithreaded matlab functions than casting them explicitly in a par-for loop.
Can we combine ? Say i have 4 cores, and this piece of code :
parfor pp=1:2,
[out1{pp},out2{pp}]=myfun(var1{pp},var2{pp})
end
and within "myfun" there are some multithreaded matlab function (built-in), like "histc" or "convolve2".
When i use "matlabpool open local 4" with this parfor, the time spent in these multithreaded functions are slower, as each iteration of pp is single-threaded.
However, with 4 workers, as this loop would only involve 2 cores, it would leave 2 cores available. Can't we use them to multithread the functions within each "pp-iteration" of the parfor loop ?
I wonder if using "matlabpool open local 2" would do it ? leaving 2 cores "available" for multithreading ?
Thanks
I've read in there : http://www.mathworks.com/matlabcentral/newsreader/view_thread/328054#901620
that it's better to use intrinsically multithreaded matlab functions than casting them explicitly in a par-for loop.
Can we combine ? Say i have 4 cores, and this piece of code :
parfor pp=1:2,
[out1{pp},out2{pp}]=myfun(var1{pp},var2{pp})
end
and within "myfun" there are some multithreaded matlab function (built-in), like "histc" or "convolve2".
When i use "matlabpool open local 4" with this parfor, the time spent in these multithreaded functions are slower, as each iteration of pp is single-threaded.
However, with 4 workers, as this loop would only involve 2 cores, it would leave 2 cores available. Can't we use them to multithread the functions within each "pp-iteration" of the parfor loop ?
I wonder if using "matlabpool open local 2" would do it ? leaving 2 cores "available" for multithreading ?
Thanks