Asynchronously Calling Multiple Instances of a VI for Parallel Execution

By default, when you start multiple asynchronous calls to the same VI, LabVIEW serializes the calls, forcing them to run one at a time and leading to a longer cumulative execution time. Use the following procedure to execute the calls in parallel, preventing any one call from delaying the execution of another call.

What to Use

Use the following block diagram objects to dynamically start an asynchronous call to a reentrant VI and then collect the outputs of the VI at a later time:

What to Do

Create the following block diagram to start multiple asynchronous calls to a reentrant VI and then collect the results.



The following list describes important details about the previous diagram.

Note The LabVIEW Help displays each of the option flags for the Open VI Reference function in hexadecimal representation. Therefore, always change the display format of the Numeric Constant input to hexadecimal to ensure that you are passing the correct value.
Note If you want to ignore the results of the asynchronous calls, omit the Wait On Asynchronous Call node and include the 0x80 option flag instead of the 0x100 option flag.

Caveats and Recommendations

VI Server properties and methods cannot modify parallel instances of an asynchronous VI call. If you call a VI Server property or method on a 0x40 VI reference, the property or method cannot modify the VI clone that the Start Asynchronous Call node actually calls. Instead, the property or method affects the original target VI. To apply VI Server properties or methods to the VI clone that the Start Asynchronous Call node actually calls, call the property or method within the target VI itself.

Examples

Refer to the Asynchronous Call and Collect (Using Option 0x40) VI in the labview\examples\Application Control\VI Server\Asynchronous Call By Reference directory for an example of asynchronously calling parallel instances of a VI to reduce execution time.

Refer to the Benchmarking Asynchronous Calls VI in the labview\examples\Application Control\VI Server\Asynchronous Call By Reference directory for a comparison of several synchronous and asynchronous approaches to solving the same task.