03-04-2019 07:35 AM
I have to call two functions from dll using call library function node. The functions must be executed at the same time. How can I realize this in Labview?
03-04-2019 07:42 AM
According to the Principles of Data Flow, putting them together in a Flat Sequence Structure and having them have the same inputs is largely the "best you can do", ensuring that they start at the "same" (to within a few clock ticks) time. What happens within the two DLLs (i.e. does one "hog" all the CPU cycles, or call a "shared" resource that forces the other to "wait until I'm done with it"?) may be beyond your control, but you at least started them together.
Bob Schor
03-04-2019 07:42 AM - edited 03-04-2019 07:43 AM
Hi Skoda,
call two functions from dll using call library function node. The functions must be executed at the same time.
This will only work when the DLL allows to call those functions in parallel. Does it?
And it will only work in parallel when the underlying communication scheme allows parallel communication with your device. Does it?
Does your computer offer more than one CPU core to be able to handle both calls in parallel?
"Exactly at the same time" is a very strict requirement! Are you talking about 1ps resolution or just 5ms?
03-04-2019 07:58 AM - edited 03-04-2019 08:03 AM
Here are some suggestions in addition to the attached snippet:
-set identical absolute time for timed structure to start (future time event)
-assigned different processors to each task
-identical timed structure priority setting
-set "call library function" to "run in any thread"
-may get benefit from setting subVI 1 and 2 execution priority to high or time critical
03-04-2019 08:03 AM
Did you make that subVI re-entrant?
03-04-2019 08:14 AM
And add to the list offered by others...
Is the node where you are calling the dll yellow or orange?
Ben
03-04-2019 12:06 PM - edited 03-04-2019 12:07 PM
@Skoda3 wrote:
The functions must be executed at the same time. How can I realize this in Labview?
Nothing can be guaranteed to happen at exactly the same time, all you can do is specify max allowable jitter. (You get close on an FPGA or if you can tie things together with a hardware trigger, but you still have differences if the wires have different length, etc. :D). How do you tell if they don't execute at exactly the same time? Is that something you can measure reliably? What do the functions do? Do they communicate with an external instrument? Since the upper wire is shared, do they interact with a shared resource? (e.g. DAQ hardware).
Is this running on a PC or on an RT system?
03-08-2019 02:19 AM - edited 03-08-2019 02:24 AM
If I set VIs as Preallocated Clone executio it just does not work any more. I cannot get data from each of the VIs.
03-08-2019 02:46 AM
@Skoda3 wrote:
It is orange. Why?
EDIT: If I set VIs as Preallocated Clone executio it just does not work any more. I cannot get data from each of the VIs.
Orange means 'running in UI thread', and has as a side effect that they are thread safe. That means the dll functions will wait for each other to finish.
03-08-2019 03:21 AM - edited 03-08-2019 03:24 AM
Okej so If call library function nodes wait for each other (orange call library function node), this means that if I want to parallelyze execution I have to mark "Prealocated clone execution" to get parallelism?