LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to parallellize a loop with arrays?

Solved!
Go to solution

Hi,

 

Trying to improve the performance of a program i want to parallellize a loop. This loop uses a vi which returns an array, and i assume this can be of different lengths each iteration. The current solution is a classic Concatenate arrays via shift register disallowing parallellization, but there should be some workaround, right?

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 1 of 6
(2,875 Views)
Solution
Accepted by topic author Yamaeda

Hi Yamaeda,

 

whenever you need to concat elements in an array in a loop you need a shift register, either by BuildArray or ReplaceArraySubset (with a predefined array)...

 

One possible workaround: When the arrays from your subVI differ in length you should put them in a cluster. So you can use autoindexing to build an array of cluster of array - with the disadvantage of needing another loop to concatenate the subArrays later on...

check.png

Is it worth it?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 6
(2,870 Views)

Yeah, that's a good solution, i'll give it a try! If it's worth it? Well the sub-vi does some analysis which should take some time, this is more of a check for possible routes to speed it up. 🙂

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 3 of 6
(2,852 Views)

@Yamaeda wrote:

The current solution is a classic Concatenate arrays via shift register disallowing parallellization, but there should be some workaround, right?


 

If you use the concatenating tunnel, the second loop can be parallelized just fine. 😄

 

 

 

0 Kudos
Message 4 of 6
(2,816 Views)

Hi,

 

ok, that seems to be a good reason to finally upgrade from LV2011...

 

When the tunnel supports parallelization you could fulfill the task with just one loop (and without the bundle/unbundle step in between)!

Best regards,
GerdW


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

Good point Old creek. However i'm sitting with 2010 right now. It sure improves parallellizability in general though!

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 6
(2,779 Views)