Error thrown in a parlor loop
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Truman
am 9 Jul. 2014
Kommentiert: Truman
am 10 Jul. 2014
I am trying to speed up some computations using the parallel toolbox - particularly replacing a far loop with a parfor loop. I have made each iteration of the loop independent and debugged it using a normal for instead of parlor. There are 8 captured signal buffers. I want to find the time of arrival of a given signal in each buffer. The loop is 8 long - one for each buffer.
I first using a correlation procedure find the coarse TOA in a buffer and then using a different algorithm find the fine TOA and fill in the fields of a structure with the data. The results is an 8 dimensional structure array (already memory allocated). I have verbose debugging print out in the loop. When I run it with for - is is fine. When I run it with parfor it will do 3 and blow up one time and 6 and blow up the next time. The error is thrown during parfor gives me no clue to where the true error was. I put a try/catch around the contents of the loop but that did work either.
The specific error is "Subscripted assignment between dissimilar structures.
"Error in calc_SRS_pseudo_ranges_Ver_P (line 96) parfor n=1:num_int;"
Line 96 is the start of the parfor statement so this tells me nothing. Two questions - why will it work for some number properly and they blow up and any idea on how I better hone in on the actual line of code that is causing this?
Any help or suggestions will be appreciated.
Thank You Truman Prevatt
0 Kommentare
Akzeptierte Antwort
Edric Ellis
am 10 Jul. 2014
Have you tried debugging the loop when running it as a PARFOR? You can force the PARFOR to run locally in your desktop MATLAB instance by changing
parfor idx = 1:N
to
parfor (idx = 1:N, 0)
I suspect that the problem is that some structure that you're building inside the loop changes form somehow as the loop progresses.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!