Why is Parpool Restarting Repeatedly?

3 次查看(过去 30 天)
I am having some difficulty running parfor loops on a cluster. The parfor loop is within a while loop. When I run the script on the cluster, the parallel pool is restarted at each iteration of the for loop. However when I run the code on my machine, the parallel pool is only initialized a single time. Some example code is below. The output from the below code shows "Starting parallel pool (parpool) using the 'local' profile ..." at each iteration of the while loop when run on the cluster. Any thoughts why the parallel pool is being restarted over and over?
while it<=maxit & diff>tol;
it=it+1;
Prev_It=S_e_vfun;
%k loops through the candidate transitions
parfor k=1:(2*nsearch+1)^3
for i=1:nz
for ii=1:nw
S_e_vfun(ii,:,i,k)= MATRIX CALCULATIONS..
end
end
end
diff=max(max(max(max(abs(S_e_vfun(:,:,:,:)-Prev_It(:,:,:,:))))))
end

回答(1 个)

Namnendra
Namnendra 2022-6-19
You can try starting the parallel pool using parpool command before the start of the while loop. That may set the parallel pool to run continuously. Also check the idle time of parpool by navigating to Home->Parallel->Parallel Preferences. It should be significantly higher than the computation time of your program.
I hope this helps.

类别

Help CenterFile Exchange 中查找有关 Parallel Computing Fundamentals 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by