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: 

No option for Acquire Read Region method

I can't bring up the Acquire Read Region Method from the Invoke Method in my PXI-7842R project. I haven't been able to find a list of targets that have this method; is it unavailable for this card?

 

I've built an application that transfers 800kB/sec from a PXI-7842R FPGA to the host application. On the FPGA side I take a 16 bit analog sample and 16 bits of digital samples every 5 us and combine them into a U32 --> 4 bytes every 5us for 800kB/s. The U32s are loaded to a Target-to-Host DMA FIFO that's read on the host side every 5ms.  On the host side I read all the elements in the FIFO and split the elements in the array into 2 U16s to separate the analog sample from the digital values. The digital values are then converted to graphs for display.

 

According to the profiler this acquisition block uses the most memory. The application crashes every once in a while due to out-of-memory errors; this can take a few minutes or a few hours. I'm using a PXIe-8840 controller with 4GB of RAM, and LabVIEW alone takes up about 1.2GB. I'm trying to reduce the memory footprint and came across the Acquire Read Region method, but it doesn't show up as an option when selecting a method. If I create a new VI outside of any project, open an FPGA reference to my bitfile, and connect to the Invoke Method then the Acquire Read Region option does show up. Any idea what's going on?

 

The only other memory issue I can think of is that I am updating front panel indicators programmatically from within subVIs; I open one refererence to each indicator, leave it open throughout the program run for updates, and then close it when exiting the program. I don't think this should result in a memory leak, right?

0 Kudos
Message 1 of 21
(3,826 Views)

Some more information:

 

In my normal program I'm using a typedef FPGA reference and have disabled dynamic mode.

 

In my test VI that opened a reference to the bitfile, I played around with the Open FPGA VI Reference settings. Acquire Read Region is only available when Dynamic Mode is enabled; once this is disabled, LabVIEW tries (and fails) to load <LabVIEW install directory>\vi.lib\FPGAPlugInAG\PXI-7842R\niLvFpga_AcquireReadRegionFifo_PXI-7842R.vi". Once I press Ignore to skip the search, the Invoke Method function becomes invalid. 

0 Kudos
Message 2 of 21
(3,821 Views)

Hey,

 

To use the Acquire Read Region method, you first need to have a FIFO that is configured to be "Target to Host -- DMA".  To access the method, you create a reference to your FPGA target in a Real-Time VI and wire that reference into an FPGA Invoke Method node. Click on the word "Method" in the node to select "FIFO >> Acquire Read Region".

 

It should be available with a 7842R.

Britton C.
Senior Software Engineer
National Instruments
0 Kudos
Message 3 of 21
(3,791 Views)

Thanks Britton. I did have a Target-to-Host DMA FIFO. I did open a reference and connect it to the Invoke Method node. The Target-to-Host DMA FIFO did show up in the selection, but the Acquire Read Region option was not there.

 

I've done a few more things since then. I have been using a static reference linked to a typedef throughout my project. The Acquire Read Region is apparently not available for static references. Once I switched to a dynamic reference (breaking all my subVIs), the option was available.

 

I changed all my typedef references to dynamic references, and the Acquire Read Region option became available. I rewrote my subVI according to the relevant application note and ran my application. Then I got an error (-63195 I think; can't find where I wrote it down) that told me that this function was unavailable for the selected target.

 

Any ideas about that one? Any ideas about why I'm required to have a dynamic reference? I didn't see that in the documentation anywhere.

0 Kudos
Message 4 of 21
(3,786 Views)

Some more info:

 

I created a new project; kept all the FPGA stuff the same, but stripped out everything in the host except for the acquisition. When running, I got the following message:

 

"Error -63193 occured at Invoke Method: FIFO.Acquire Read Region in _AcqSamples.vi->AcqTest.vi

  Possible reason: NI-RIO: (Hex 0xFFFF0927) The requested feature is not supported"

 

When I switch the Invoke Method to a normal Read and connect my subVIs accordingly, it works fine.

 

_AcqSamples SubVI with the Invoke Method node:

subVI snippet.png

 

 

 

Host VI that calls _AcqSamples:

hostVI snippet.png

 

 

 

0 Kudos
Message 5 of 21
(3,774 Views)

Hello NickDngc

 

Unfortunately, Acquire Read Region is not supported on the PXI-7842R. Depending on how your block diagram is written (dynamic mode, etc...) LabVIEW may or may not be able to detect the use of an unsupported method at edit time, which is why you sometimes can't access the method and at other times you get a runtime error.

 

That being said, using Acquire Read Region will only save, at most, as much memory as you've allocated for your host side DMA buffer, which based on the rates you've described I'm guessing is a relatively small size compared to the 1.2 GB LV is using and the 4GB available on the system. Am I right about that? What size have you configured your FIFOs for? That is, I suspect an issue somewhere else and that even if Acquire Read Region was available, it wouldn't make much of a difference.

 

Sebastian

 

 

0 Kudos
Message 6 of 21
(3,751 Views)

Nuts. Wish I had seen that in the documentation.


That being said, using Acquire Read Region will only save, at most, as much memory as you've allocated for your host side DMA buffer, which based on the rates you've described I'm guessing is a relatively small size compared to the 1.2 GB LV is using and the 4GB available on the system. Am I right about that? What size have you configured your FIFOs for? That is, I suspect an issue somewhere else and that even if Acquire Read Region was available, it wouldn't make much of a difference.

I've used either 5000 or 10,000 elements for the host buffer, which corresponds to 20kB or 40kB. That's pretty small, so I can only assume that LabVIEW is not releasing the memory it used to read the DMA FIFOs. Without the Acquire Read Region, I just use a normal Read method and feed it to the same subVI. The block for that subVI is shown below. I've turned on Show Buffer Allocations, and nothing shows up inside this VI. All it does is convert an array of U32s to an array of U16s and then interpret those U16s as a set of digital waveforms. No changes are performed on the array elements. The white paper on Acquire Read Region said it may improve memory usage, but you're right - my memory usage should be benign anyway!

 

The only other hint for a memory leak I've been able to find out has to do with rapid updates of the display. I'm running the Acquisition loop at 5ms, but the display can only update at around 33ms. There is another forum post where someone suggests updating an indicator faster than the display refresh rate could lead to a memory buildup. However, the indicator is NOT in synchronous mode, so it's not trying to display every update.

 

I'm pretty stumped, and I'm about to have to disable the entire Acquisition display. That makes my boss unhappy as I just upgraded the controller in order to handle the processor demands of the Acquisition block.

 

Here's a snippet for the subVI that converts FIFO data to a graph:

ExtractData.png

0 Kudos
Message 7 of 21
(3,740 Views)

If I understand correctly, LV starts using about 1.2 GB of the 4 GB available on the system, but after some time you start getting out of memory errors. Do I understand correctly?

 

Exactly what errors are you seeing? Do you see that LV is using substantially more memory? Is there anything else running on the system?

 

Sebastian

0 Kudos
Message 8 of 21
(3,733 Views)

That's correct. When the Acquisition VI is running, the memory increases steadily from about 1.1GB to about 3.8GB; at this point, LabVIEW complains about not having enough memory.

 

I drew a diagram disable structure around the Acquisition VI. When this module is disabled, memory usage stays rock hard at about 1.1GB for as long as I've cared to look. As soon as I stop the application, enable the Acquisition VI, and rerun it the memory usage starts its steady upward march to 4G.

 

If it helps, the diagram highlights the for loop in the Extract Data subVI when it complains of being out of memory. I don't see any buffer allocations there, so I assume it's not directly related to the conversion from U16 arrays to multiple Bool arrays.

0 Kudos
Message 9 of 21
(3,725 Views)

Thanks for confirming my understanding.

 

As I understand it the Acquisition VI does a few things and the snippet you posted above is from one of the subVIs used by the Acquisition VI. Is that correct?

 

If possible, it'd be helpful if you could progressively enable parts of the Acquisition VI until you find the part that's causing this memory leak. Once you find it, can you post the code in question?

0 Kudos
Message 10 of 21
(3,716 Views)