Why is Parpool Restarting Repeatedly?
3 views (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Namnendra
on 19 Jun 2022
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.
0 Comments
See Also
Categories
Find more on Parallel Computing Fundamentals 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!