02-14-2022 10:18 AM
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?
02-14-2022 10:31 AM
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)
02-14-2022 10:37 AM
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?
02-14-2022 11:43 AM - edited 02-14-2022 11:46 AM
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!
02-14-2022 11:52 AM
I meant nearly identical, with the exception of different ROI descriptors. So identical in the subVIs used, but not the inputs to the subVIs.
02-14-2022 12:00 PM - edited 02-14-2022 12:02 PM
@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?