From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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: 

multithreaded application with labview IMAQ & WinXP on Dual Core Processor

Hi all,

I am working on a multi-threaded vision application on a PC with the latest Core 2 Duo processor.  I have image data coming over two TCP sockets, and image processing using the IMAQ Vision libraries.

I have managed to parallelize the image processing, TCP communication, and display functions.

I have 2 Image processing loops, 2 TCP loops (one for each socket), a UI loop, and a display loop.  Inter-loop communication  is via 2 Q's and a few notifiers.

The image processing and TCP VI's are all re-entrant.  The TCP and Image processing VI's are on different threads.

I tried playing around with changing priorities on the VI's but it made things a bit worse.

My questions are:

1  Are dll calls to the IMAQ dll's re-entrant?  (probably not?)

2  Can these dll calls be made re-entrant?  Would it make a difference?

3  Any way to set two different instances of the same re-entrant VI on the diagram on DIFFERENT threads?

3  Any other ways I can improve performance?


Thanks for any insights!



Neville.
0 Kudos
Message 1 of 2
(2,285 Views)

Hi Neville,

If you doing image processing, then you are probably using VIs that call the NIVision DLL.  These calls are actually reentrant by default (calls made to the IMAQ DLL are also reentrant).  Having said that, remember that the image processing VIs, along with most VIs in the vi.lib folder, are not reentrant, making the DLL calls effectively non reentrant as well.  The reason for this is that, unless a VI takes a considerable amout of time to execute, running it as reentrant will often slow down performance due to the overhead involved in managing parallel execution.  I'm not sure if you have already tried this, but you may find that your program will run faster if you set your image processing VIs to be non reentrant.  I do not know of a way to run multiple instances of the same reentrant VI on different threads, but I will look into it, and I will let you know if I find something.  Another option would be to create copies of the VIs so that the functionality of each one is identical, but you are actually calling different .vi files.

In general, it seems like the architecture of your program is very optimized with the parallel loops, queues, and notifiers that you are using.  I would recommend trying out non reentrant VIs to see if this speeds things up.  Please let me know if this is helpful.

Chris
Applicatoins Engineer
National Instruments

0 Kudos
Message 2 of 2
(2,266 Views)