ni.com is currently experiencing unexpected issues.

Some services may be unavailable at this time.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

For loop iteration parallelism

Am I wrong to expect numeric to be 0 when autoindexing an empty array? turns out enabling iteration parallelism outputs a 1 instead.
0 Kudos
Message 1 of 7
(292 Views)

Hi Lucian,

 

this effect seems to be connected with your "last value" output tunnel.

Outputting a default array seems to work correctly… (tested with LV2021)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(273 Views)

yes, I would also expect that.

But personally I don't trust this. If it is possible that there is an empty array at a for loop with auto indexing, I always place the for loop it inside a case structure and wire the selector to the output of array size function, so I can exclude arrays with size 0 and set default values manually.

_________________________
using LV 2025 Q3
0 Kudos
Message 3 of 7
(268 Views)

Interesting, never noticed this as I always implement a array size-based case structure to execute the content without the for loop in the case of size = 1 for high optimization.

It looks like for loop with iteration parallelism always runs once when auto-iteration enabled.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 4 of 7
(262 Views)

It only happens with "Last Value" tunnels. Auto-indexing are empty as they should.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 7
(246 Views)

From the LabVIEW Discord: Darren has filed this as Bug 3432120.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 6 of 7
(209 Views)

"Lasts value" tunnels would confuse me in a parallel FOR loop, because execution order of iterations is random and there is no predictable "last" in a chronological sense. Of course it is probably defined as the output from iteration N, and maybe the authors made an OBOE. 😄

0 Kudos
Message 7 of 7
(181 Views)