12-01-2011 01:11 PM
When working with For Loop Parallelism, what does the term "Possibly Not Parallelizable" mean (seen via the Tools>>Profile>>Find Parallelizable Loops)? I am confused as to what the compiler does in this situation.
Also, if a for loop is parallel does this mean LabVIEW break each loop into its own thread in order to acheive parallelism?
Thank you.
Craig
12-01-2011 01:39 PM
It basically means that it can't automatically determine that the result of running the loop in parallel would be identical to not running it in parallel. For example, if the order of the iterations would affect the result, then a loop would not be parallelizable (not sure if that's even a word). You can read more here: http://zone.ni.com/devzone/cda/tut/p/id/9393
What does your loop look like?
12-02-2011 12:46 PM
The article you supplied is certainly article to start with in order to understand for loop parallelism. I read it in full and like how it describes the way LabVIEW understand parallelism. It does mention Possibly not Parallelizable but has no comment on what the compiler actually does in this instance.
For simplicity, my for loop looks like this...
12-02-2011 02:12 PM
@craige wrote:
The article you supplied is certainly article to start with in order to understand for loop parallelism. I read it in full and like how it describes the way LabVIEW understand parallelism. It does mention Possibly not Parallelizable but has no comment on what the compiler actually does in this instance.
For simplicity, my for loop looks like this...
![]()
Then it is parralizable. no iterations touch the same array element- so you are good to go. Where did you get the 100 core machine! WOW
12-05-2011 10:11 AM
"Possibly not parallelizable" means that the loop may not produce the same results when it is parallel versus sequential. The compiler still makes the loop parallel; it's just a warning that you may not get the same answers.
In your example, LabVIEW says that the loop is possibly not safe to parallelize because the Random Number node would produce different results for the iterations if called in a different order. (If you open the error list and show warnings, you will see that the Random Number node causes a warning for the loop.)
12-05-2011 11:18 AM
I've had multiple customers ask me about this same issue...how hard would it be for us to exclude the Random Number function from the check about possibly not parallelizable loops? It seems it confuses people more than it helps...especially when they realize that the only concern is that they will get a different random number when running in parallel than they would have otherwise. 🙂
12-05-2011 11:27 AM
We have discussed being less conservative with warnings in the Parallel For Loop. We might stop reporting warnings for the Random Number node and some other nodes in the future. It would also be nice if LabVIEW didn't report a warning for every subVI call in the loop. Many subVIs do not cause side effects.