Introduction to LabVIEW Real-Time Symmetric Multiprocessing (SMP)

Publish Date: Oct 30, 2007 | 7 Ratings | 3.86 out of 5 |  PDF

Overview

This document is part of the
Multicore Programming Fundamentals Whitepaper Series

Multicore Programming Fundamentals Whitepaper Series

Multicore Programming Fundamentals Whitepaper Series

Symmetric multiprocessing, or SMP, is an operating system feature that allows multi-core processors to run a single instance of the operating system and connect to a common main memory, while executing code in parallel. Most modern desktop operating systems (Windows, Linux, MacOS, etc.) support SMP. However, SMP support is not yet common in real-time operating systems.

This whitepaper describes how you can take advantage of SMP support in the LabVIEW 8.5 Real-Time Module to implement high-performance real-time applications on multi-core systems.

Table of Contents

  1. Introduction
  2. Assigning Tasks to Specific Processors with the Timed Loop
  3. Debugging Multicore Real-Time Applications
  4. Guaranteed Multi-core Readiness
  5. LabVIEW Real-Time SMP Case-Study: Wineman Technologies
  6. Conclusions
  7. More Resources on Multicore Programming

1. Introduction

The LabVIEW 8.5 Real-Time Module includes the NI RT Extensions for SMP, which adds multi-core support to the ETS real-time operating system. You can install the NI RT Extensions for SMP to take advantage of high-performance multi-core processor technology. Figure 1 below illustrates a process known as auto-load balancing, which allows the Real-Time Module to distribute application threads across the available processor cores on an ETS RT target.

Figure 1 - LabVIEW Real-Time support for SMP

Back to Top

2. Assigning Tasks to Specific Processors with the Timed Loop

To further increase the performance and reliability of a real-time system, you can easily assign Timed Loops to specific processor cores. You can dedicate one core of a processor to execute a time-critical control loop and isolate it from less important tasks that run on different cores, as illustrated in Figure 2 below.

Figure 2 - Dedicating a Time Critical Task to a Specific Processor

With the LabVIEW 8.5 Real-Time Module, you can assign a Timed Loop to a specific processor core. Each Timed Loop represents a unique thread, and you can use the Processor Assignment section of the Configure Timed Loop dialog box to designate the thread to run only on a specific processor core, as illustrated in Figure 3 below.

Figure 3 - Assigning a Timed Loop to a particular processor core

Back to Top

3. Debugging Multicore Real-Time Applications

As applications become complex, it's important to understand at a low-level how code executes on the real-time system. Adding processor cores to the system only amplifies this complexity. The Real-Time Execution Trace Toolkit 2.0 provides a visual representation of both VI and thread execution on single-core or multi-core systems, so you can find hotspots in your code and detect undesirable behaviors such as resource contention, memory allocations, and priority inversions.

Figure 4 - The Real-Time Execution Trace Toolkit 2.0 with support for multi-core debugging

You also can use the On-Screen CPU Monitor on RT 8.5 targets to monitor CPU utilization on multi-core real-time systems. This utility displays information directly to a display connected to the real-time target, with information such as Total Load, ISR (Interrupt Service Request) usage, CPU usage by Timed Structures, and CPU usage by threads, as shown below.

Figure 5 - On-Screen CPU Monitor

Back to Top

4. Guaranteed Multi-core Readiness

Companies migrating real-time software to a multicore processor experience varying levels of scalability, and must examine each layer of the stack for readiness. This process can consume a great deal of time and resources. One great advantage of the LabVIEW 8.5 Real-Time Module, the LabVIEW Real-Time Module software stack meets all the requirements for multicore readiness.

The real-time software stack consists of development tools, libraries, device drivers, and a real-time operating system. Many real-time applications from previous generation systems were built on a software stack intended for single-processor designs. Table 1 lists a few key considerations to help evaluate the readiness of the real-time software stack found in a typical control application.

Real-Time Software Stack

What It Means to Be Multicore Ready

Development Tool

Support is provided on RTOS, tool allows for threading correctness and optimization. Debugging and tracing capabilities are provided to analyze real-time multicore systems.

Libraries

Libraries are thread-safe and can be made re-entrant so they may be executed in parallel. Algorithms are in place so as to not cause memory allocation and induce jitter into system.

Device Drivers

Drivers are designed for optimal multithreaded performance.

Real-Time Operating System

RTOS supports multithreading and multitasking, and can load balance tasks on multicore processors with SMP.

Table 1 - Multicore Ready Real-Time Software Stack

A common bottleneck in real-time systems are device drivers that are not thread-safe or libraries that cannot be executed in a reentrant fashion. Non-reentrant code might still function properly but it cannot execute in parallel on a multicore processor, and can become a shared resource, leading to performance problems. LabVIEW overcomes these pitfalls with thread-safe and reentrant I/O drivers, such as DAQmx, as well as reentrant-ready math libraries.

Note Some VIs and functions on the Mathematics and Signal Processing palette are configured for non-reentrant execution by default. You can configure VIs for reentrant execution using the Execution page of the VI Properties dialog box in LabVIEW.

Back to Top

5. LabVIEW Real-Time SMP Case-Study: Wineman Technologies

Wineman is a National Instruments partner that develops dynamometer control systems as well as hardware-in-the-loop simulators, utilizing PID control, profile generation, alarming, scripting, analog and digital I/O, CAN, Modbus and TCP/IP communication. The Wineman family of products includes EASE and INERTIA applications which utilize an architecture based on LabVIEW Real-Time.

Wineman was challenged by the need to overcome high CPU utilization. The high-priority loop in one of their typical applications consumed the majority of the single-core processor in order to meet execution requirements. This left little time for the lower-priority loops to execute tasks such as user-interface communication and data logging. As a result of this task starvation, the application was difficult to use and/or unstable.

Using the SMP support in the LabVIEW 8.5 Real-Time Module, Wineman was able to add more control loops to their existing system and enhance performance by 40% with only minor changes to the LabVIEW code.

Support for multi-core processors in LabVIEW Real-Time significantly improved the overall performance of Wineman's products. Most notable was the ability to take advantage of the multi-core support without any significant changes to the LabVIEW code. By using the inherently parallel nature of LabVIEW, Wineman's application naturally migrated to the multi-core environment in a way that would take advantage of the additional processing power. Seamless SMP support enabled Wineman to add functionality to their dynamometer control and hardware-in-the-loop simulators and to better meet the needs of their end-users.

Back to Top

6. Conclusions

LabVIEW 8.5 Real-Time opens the door for real-time developers to take advantage of high-performance multi-core processors in their real-time applications. In addition to support for SMP, LabVIEW 8.5 introduces enhanced debugging tools such as the Execution Trace Toolkit 2.0, which allows you to visually analyze VI and thread execution on a multi-core system.

The multicore-ready LabVIEW 8.5 Real-Time software stack allows companies like Wineman to see immediate performance gains when migrating to multi-core systems, without significant modifications to the original LabVIEW code.

Back to Top

7. More Resources on Multicore Programming


Multicore Programming Fundamentals Whitepaper Series

Back to Top

Bookmark & Share

Ratings

Rate this document

Answered Your Question?
Yes No

Submit