From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

array allocating more memory

Hi all,

 i am using action engines in my project to store and execute any kind of processing to be done on the data.

So that means i am using all my data in the shift registers. 

Now, when i used "Memory Buffer allocation" tool to look at where the LV will make copies data i got bit surprised by seeing that on some shift regiters the dots were blinking and on some they were not present.

How can this haapen?? how can LV makes copy of data on some shift reg and not on the rest??

 

I am attaching my VI here. Pls have a loot at it and let me know where can i make it more memory efficient.

 

 

Thanks,

Ritesh 

0 Kudos
Message 11 of 24
(732 Views)

THe dots do not show copies but buffers. I took a quick glance at your AE and it looks like all of your work is being done in-place (in the buffers of the SRs).

 

The exception is for values passed in and then wired to the SR where an additional copy is not required since LV will then work in the buffer "up stream".

 

If I missed something let me know and post an image of the case and detail whcich buffer is confusing.

 

Take care,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 12 of 24
(726 Views)

There must be a buffer allocation, because the content of the shift register changes size. Some turn empty in some states and e.g. the top two start out empty, but then get initialized.

 

If the size does not change between iteration, there will be no new allocation at that iteration so you shold be OK most of the time.

 

A better way would be to eliminate the while loop and use globally iniailized feedback nodes instead. Now the content is truly fixed size from compile time on and there is no longer a bufffer allocation (there is one at "initialize array, but as you can see from the fuzzy wires, all this is folded into a constant and does not pose any performance penalty.

 

Here's how the top part would look like, for example.

Message Edited by altenbach on 05-20-2009 12:47 PM
0 Kudos
Message 13 of 24
(719 Views)

Hi Ben,

Thanks for your comments.

There are cases "Make Average Zero" and "Record" where the buffer allocation doesn't seem to be behaving as expected.

In that case, i have a cluster of 6 arrays and i replace only 2 arrays in the cluster and it shows buffer for all the elements in the cluster(which are not even being touched). and same in the Record case.

 

 

Ritesh 

0 Kudos
Message 14 of 24
(717 Views)
Actually, the top two arrays are "read-only" in the rest of the code, so they don't even belong in shift registers! Just initialize outside the structure (they will be folded) and use plain tunnels to where they are needed.
Message 15 of 24
(715 Views)

Actually, the top two arrays are "read-only" in the rest of the code, so they don't even belong in shift registers! Just initialize outside the structure (they will be folded) and use plain tunnels to where they are needed.

Is that sure they wont make extra copies when ever they are called and only make a copy when called First ?

 

 

You mentioned about removing the while loop. How will i handle the rest of the data in SRs then ? Should i use FB Node for all the data that i am accessing through SRs? 

 

 

Ritesh

 

0 Kudos
Message 16 of 24
(689 Views)

Please investigate Christian's suggestion to see if that helps.

 

Before I re-invent the wheel maybe this thread where Shane and I investigated a similar Q some time ago will help.

 

Sorry if I am sound "stand-offish" but these performance Q can go on for days so I try to only step in when there is an apparent bug or something similar.

 

Curious, and cautious, but still trying to help,

 

Ben

 

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 17 of 24
(686 Views)

One more thing, What do you guys mean by "In Place" ??

Is it simply "In Place Element Structure" or something else ?

I have gone through many posts and found it a very common term, but could't get it in the right context.

 

0 Kudos
Message 18 of 24
(685 Views)

ritesh024 wrote:

Is that sure they wont make extra copies when ever they are called and only make a copy when called First ?


If you use all constants for the initialization as you do, the allocation will be done at compile time and everything folded into a constant. THere will be no extra copies.

 

In newer LabVIEW versions, you no longer need a loop once you replace the shift registers with globally initialized feedback nodes as I showed in the image earlier.

Message 19 of 24
(684 Views)

In newer LabVIEW versions, you no longer need a loop once you replace the shift registers with globally initialized feedback nodes as I showed in the image earlier.

OK. But how will it be more efficient on using FB node over the USR?

0 Kudos
Message 20 of 24
(678 Views)