parfor does not uns parallel pool when a parfeval process is still running
12 ビュー (過去 30 日間)
in my code I use parallel pool on a local machine and execute a longer function with 'parfeval'. In the main code I shortly later want to use 'parfor', but checking CPU work load, 'parfor' does not use any worker since 'parfeval' still uses one worker when executing 'parfor'.
Is this behaviour expected?
How to check, if there are still running processes at the parallel pool?
How to wait until all processes at the parallel pool are finished?
Thanks in advance
I am using Win10 64bit, Matlab R2020a, Parallel Computing Toolbox 7.2.
Edric Ellis 2020 年 5 月 1 日
Yes, this behaviour is expected - the different parallel language features parfor, parfeval, and spmd do not share the pool. You can wait for all parfeval requests like so:
p = gcp('nocreate');
q = p.FevalQueue;
% First wait for any queued futures
% Then wait for any running futures
(The calls to wait need to be in that order - in the other order, any queued futures will start running after the first wait).