LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

For Loops - Possibly Not Parallelizable

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

0 Kudos
Message 1 of 7
(2,917 Views)

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?

0 Kudos
Message 2 of 7
(2,911 Views)

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...

 

for_loop.png 

0 Kudos
Message 3 of 7
(2,877 Views)

@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...

 

for_loop.png 

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


 


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 7
(2,870 Views)

"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.)

Message 5 of 7
(2,838 Views)

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. 🙂

0 Kudos
Message 6 of 7
(2,822 Views)

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.

0 Kudos
Message 7 of 7
(2,817 Views)