How can I debug parfor loop to find out where an error comes from?

2 次查看(过去 30 天)
Hi. I am trying to run a specific code 15 times, each time for a new set of data so my iterations are not sequential. I use SPM toolbox and am trying to speed up the calculations using matlabpool and parfor. In each iteration, a temporary structure variable (DCM) is initialised then sent to a function to return the output to the same variable (DCM). At the end of each parfor iteration, the estimated DCM is saved on the disk as DCM_i and it is worth mentioning that the analysis time for different datasets is different. When I ran the code for 15 datasets, it loaded 8 datasets randomly and I could see (according to the script I have written) when one of the sets was finished in a lab, another one would be loaded. So, after 7 of datasets were analysed and their DCM's were saved on the disk, suddenly I got a similar error to the following:
Error in converting struct to double => It is not possible to change struct to double
Now I have no idea where this error happens. All my datasets are exactly the same and the same code has been applied on all of them using for loop. As my parfor loop is working now and it has given me the results of some of the datasets, I don't get it why I would receive such a basic error. I feel I should have received the same error for all datasets if there was a coding mistake.
Best, Pegah
  5 个评论
Walter Roberson
Walter Roberson 2012-8-30
When the pool is not open, "for" is used instead of "parfor". Except that the iterations might not be done in the same order as if "parfor" had not been specified.
Pegah Hosseini
Pegah Hosseini 2012-8-30
So is it possible that the way I define the parameters in the above code is not suitable for parfor?

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Parallel for-Loops (parfor) 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by