Using Parallel Operations in Multiple-CPU RT Applications
- Updated2025-02-17
- 2 minute(s) read
LabVIEW's multithreaded graphical programming environment makes it easy to take advantage of parallel execution on multiple-CPU systems, also known as multi-core, multi-processor, or SMP systems. To implement a parallel architecture in LabVIEW, place two or more objects on the block diagram without wiring them in sequence. When a VI executes on a system with N CPUs, up to N threads can execute in parallel. You can separate code into parallel loops or you can take advantage of parallel data processing by separating multiple input channels to be processed on separate CPUs.
Parallel Loops
When you include parallel loops in an RT application that runs on a multiple-CPU system, the CPU scheduler performs automatic load balancing to distribute execution threads across the CPUs. You also can use the Assigned CPU input of a Timed Loop to manually assign a Timed Loop to a given CPU.
Parallel Data Processing
You can separate multiple data channels into groups and process the groups in parallel on separate CPUs. For example, if you need to process 16 input channels on a dual core system, you can separate them into two groups of eight, as shown in the following block diagram:
In this example, Process Data.vi is configured as a reentrant subVI, so each instance of the subVI receives a dedicated memory space, and the two instances do not have to execute on the same CPU. Because there is no dataflow dependency between the two instances of Process Data.vi, the CPU scheduler automatically balances the two instances across the available CPUs.