- 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.
4 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Raymond Norris
2020-10-29
编辑:Raymond Norris
2020-10-29
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 个评论
Raymond Norris
2020-10-29
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
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Parallel Computing Fundamentals 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!