LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

optimize transfer from TCP Read to DMA Write on sbRIO

Highlighted

I have approximately the code shown below, split across two loops. One loop receives bitmap images over a TCP socket, and puts the bitmaps into a queue. The other loop dequeues the bitmaps and sends them to the FPGA. Is there any way to speed up this process? My DMA FIFO is 32 bits wide, but the data coming from TCP Read is a string. Can I avoid the unflatten from string to U32, while still using a 32-bit FIFO? My tests show that the limit on DMA transfer rate is elements, not bytes, so switching to an 8-bit FIFO cuts my bandwidth by a factor of 4 which overwhelms any gain I'd get by replacing the unflatten with string to byte array. I tried the DMA Acquire Write Region method, but I got a Feature Not Supported error (even though the help doesn't mention that not all targets support that method). Implementing a decompression algorithm on the FPGA is an option but requires more effort and adds complexity.

TCP Read to DMA Write.png

0 Kudos
Message 1 of 5
(1,085 Views)
Highlighted

What about this:

splitstring.png

 

Ok, it is some kind of compression, but fairly easy. I assume of course, that DMA is 32 bit. The main problem is written in input string.

0 Kudos
Message 2 of 5
(1,070 Views)
Highlighted

That's not any better than unflatten from string; it might even be worse. The problem with both your approach, and unflatten from string, is that the conversion from the string to the U32 array involves copying every element of the string into the U32 array. I'm hoping for a way to do this in-place, or even better skip the step entirely.

0 Kudos
Message 3 of 5
(1,062 Views)
Highlighted

Ok, that wasn't well thought idea. Give me another try: instead of unflatten from string, try Type Cast. Somehow its about 2 times faster, when I benchmark it on PC.

Message 4 of 5
(1,054 Views)
Highlighted

@PiDi wrote:

Ok, that wasn't well thought idea. Give me another try: instead of unflatten from string, try Type Cast. Somehow its about 2 times faster, when I benchmark it on PC.


That's odd, but thanks - it's an improvement. The help says, "Casts x to the data type, type, by flattening it and unflattening it using the new data type." so I assumed that type cast is just a special case of Unflatten. Apparently it's a slightly optimized special case.

0 Kudos
Message 5 of 5
(1,047 Views)