How to restart a worker in parpool?
Mostra commenti meno recenti
I want to run a parfor loop which looks like this:
parfor i=1:10000
my_func_output = my_function;
end
The problem with my_function is, that it sometimes terminates, sometimes however doesn't and keeps running for an indefinite time. If ther function does not terminate within one minute, chances are it won't terminate at all. The function is from third-party software which I cannot edit.
I need to run the function 500 times and I have 10 workers at my disposal. However, when I start the loop, eventually all the workers get cluttered with functions which do not terminate and I do not get my results.
My idea was to run the parfor loop above, i.e. run the function on each of my 10 workers in parallel. If the worker should need more than one minute for the function, it should restart and start running the function again. Or in this case, just execute continue and move onto the next iteration of the parfor loop.
Is there a way to do this in Matlab?
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Parallel Computing Fundamentals in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!