LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Parallel Execution

Can I run two identical LabVIEW VIs in parallel? They both contain the same NI Vision subVIs. The only difference is the ROI descriptors used. It is possible to run these VIs in parallel?

0 Kudos
Message 1 of 6
(894 Views)

I assume that you are talking about a VI you wrote yourself. Just make it reentrant!

 

(I assume that the vision tools are reentrant, but I cannot check)

0 Kudos
Message 2 of 6
(889 Views)

Yes I wrote the VIs myself. To be clear they are two different VIs just using many of the same subVIs. How would I do this?

0 Kudos
Message 3 of 6
(886 Views)

Earlier you said "two identical VIs", now you are saying "two different VIs". So what is it??? (If they are identical, you only need one set to reentrant. Makes code maintenance twice as easy. 😄 )

 

LabVIEW automatically executes independent code as parallel as possible and all you need to do is avoid data dependencies. It's all in the dataflow principle!

0 Kudos
Message 4 of 6
(857 Views)

I meant nearly identical, with the exception of different ROI descriptors. So identical in the subVIs used, but not the inputs to the subVIs.

0 Kudos
Message 5 of 6
(850 Views)

@audreg wrote:

I meant nearly identical, with the exception of different ROI descriptors. So identical in the subVIs used, but not the inputs to the subVIs.


OK, data is not part of a VI (unless it is hardwired vi e.g. diagram constants). Assuming the ROI comes from a subVI input, all you need is one reentrant VI (preallocate clone).

 

Of course you need to avoid data dependencies. e.g. if you line them up sequentially along the same error wire, the second instance will have to wait until the first instance is finished.

 

How much will execute in parallel is difficult to tell and depends a lot on shared resources and subVI design (i.e. non-reentrant subVIs inside your subVI, shared data access, etc.) How complicated are the calculations?

0 Kudos
Message 6 of 6
(846 Views)