- on your machine or a cluster
- if on a cluster, using MJS or a scheduler (e.g. PBS)
- how are you starting the parallel pool, explicitly (i.e. calling parpool) or automatically (e.g. by calling parfor)
- is the code a combination of a lot of serial code (i.e. outside of a parfor) and parallel code or just parallel code (i.e. the bulk of the time is running in a parfor/spmd block)?
how can I use the parallel computing for lsquarefit function.
14 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Sasidharan Subramani
le 29 Oct 2020
Commenté : Raymond Norris
le 29 Oct 2020
I run a image processing program and it has a data of matrix with size of (254*318*31). Each element represents a pixel and it takes approximately 0.5-1 second for one pixel so it takes around 3 days to get my results any faster method. I tried with the parallel computing but when I start the parallel computing it runs only for 30 mins and stops automatically. How do i make it run throughout the program.
0 commentaires
Réponse acceptée
Raymond Norris
le 29 Oct 2020
Modifié(e) : Raymond Norris
le 29 Oct 2020
Hi Sasidharan,
Could you provide a bit more context, at a high level, how you're running your code. That is
For starters, be aware that, by default, a parellel pool will be deleted after 30 minutes of inactivity. I could imagine that you've run your parallel code, but your (serial) code still runs in access of 30 minutes after the last parfor/spmd call so that MATLAB automatically shuts down your parallel pool, but continues to run your code.
If you want to disable/extend the time out, go to the MATLAB Preferences > Parallel Computing Toolbox. At the bottom is a checkbox to disable automatic timeout as well as an edit box to change the default if you do want it.
Thanks,
Raymond
2 commentaires
Raymond Norris
le 29 Oct 2020
And where do you call any parallel construct (e.g. parfor)? Are you trying to re-write any of the for loops as parfor?
parpool starts a pool of workers, which parfor, spmd, etc. can make use of, but parpool alone doesn't parallelize your code. You have several options, here are two:
- Rewrite one of your nested (most likely the outer) for loop as a parfor. At first glance, Pexp might cause some issues.
- When calling lsqcurvefit, there's an optional 'UseParallel' switch to help the solver. Try the following:
Param = lsqcurvefit(@layer_substrate, ... ,'UseParallel',true);
If you're not calling any parallel constructs, then that would explain why 30 minutes, the parallel pool was deleted (since it timed out from not running any parallel code).
Does that sound like what is happening?
Raymond
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Parallel Computing Fundamentals dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!