LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Running Sum with array functions only

Solved!
Go to solution

DaIn wrote:

  I only wanted to be sure, that there is no faster way to do this operation in Labview.


Maybe you want to flatten the loop code to the main diagram to avoid the subVI call overhead. Make sure to disable debugging.

 

If you want to keep it as a subVI, at least inline it.

0 Kudos
Message 11 of 17
(1,502 Views)

@Yamaeda wrote:

For a running sum, especially on a large array you'll only need to keep the previous sum and add the new number, no need to recalculate the previous values that'll be constant.


I think that's what the code shown in the first post is already doing. Right?

0 Kudos
Message 12 of 17
(1,501 Views)

@altenbach wrote:

@Yamaeda wrote:

For a running sum, especially on a large array you'll only need to keep the previous sum and add the new number, no need to recalculate the previous values that'll be constant.


I think that's what the code shown in the first post is already doing. Right?


Yes, i just got the impression the complete array was calculated each time, not just additions.

/Y

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

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 13 of 17
(1,487 Views)

I will need the function as a subVI.

Disabling debugging and inline the execution is a good hint. Thanks.

 

 

Message 14 of 17
(1,466 Views)

If you want this to be as fast as possible, why not do the running sum inside of the FPGA?  The FPGA can do it in a single cycle and it will always be up to date with the last value read.


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 15 of 17
(1,446 Views)

I need both data informations. 
Once i need the deltas and on another place i need the the running sum.

And transfering both arrays from FPGA to the Host requires more time or more DMA channels.

 

So this is no option. But thanks for your reply.

0 Kudos
Message 16 of 17
(1,438 Views)
Solution
Accepted by DaIn

Also remember that if this needs to be done very often, you could pipeline the execution such that multiple CPUs work on successive, overlapping problems, i.e. the next computation starts wile another CPU is still ading elements of the previous problem.

 

On a typical quad core processor, you could go up to 4x faster.

0 Kudos
Message 17 of 17
(1,426 Views)