Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Using Parallel Operations in Multiple-CPU RT Applications (RT Module)

LabVIEW 8.5 Real-Time Module Help
August 2007

NI Part Number:
370622E-01

»View Product Info

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.

Note  Excessive parallelism can increase latency due to unnecessary data transfer between CPUs. You must also design parallel architectures carefully to avoid jitter due to shared resources. Simultaneous requests for a shared resource impede parallel execution and diminish the performance benefit of a multiple-CPU system. You can use the Real-Time Execution Trace Toolkit to determine whether parallel operations actually execute in parallel.

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.

Note  When you open a VI created in a version of LabVIEW prior to 8.5, all Timed Loops automatically run on the default CPU. In this case, you can use manual CPU assignment to take advantage of multiple CPUs.

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 figure.

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.

Note  LabVIEW treats each Timed Loop as a single thread. To take advantage of parallel processing with the Timed Loop, place each parallel operation in a separate Timed Loop. Refer to the National Instruments Web site for more information about using parallelism in a multiple-CPU RT system.

Resources


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit