Graceful exit from a parfor loop

If I detect an error while processing data within a parfor loop, I would like to gracefully exit the program. Can I delete the parallel pool object using "delete" to shut down all of the workers before exiting?

Réponses (1)

Matt J
Matt J il y a environ 3 heures

1 vote

It sounds like a job for onCleanup.

1 commentaire

Clay Fulcher
Clay Fulcher il y a environ une heure
Modifié(e) : Clay Fulcher il y a environ une heure
Thanks Matt. I'll give this a try. I'm not sure it will destroy all the independent workers in a parallel loop, but I'll give it a try. Do you know if simply deleting the parallel pool object will accomplish the destruction of the tasks being performed by all the independent workers in the parfor loop?

Connectez-vous pour commenter.

Catégories

Produits

Version

R2025b

Question posée :

il y a environ 13 heures

Modifié(e) :

il y a environ 9 heures

Community Treasure Hunt

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

Start Hunting!

Translated by