Using the Intel® IPP Library in an Embedded System – on Non-Standard Operating Systems

If you are familiar with the Intel® Integrated Performance Primitives (Intel® IPP) library you know that it is widely used to build applications built for the Microsoft* Windows* and Linux* operating systems – today's most prevalent "standard" desktop and server operating system (OS) platforms. What you may not know is that the Intel IPP library can also be used with applications built for some embedded and real-time operating systems (RTOS). It's not possible to build an IPP application for use on every embedded OS, but if your embedded platform and development tools meet a few key conditions, you might be able to take advantage of the SIMD acceleration provided by this library in your embedded application on a "non-standard" operating system.

The Intel IPP 7.0 library is currently delivered on four operating system platforms: Microsoft* Windows*, Linux*, Mac OS* X and QNX*. A standalone version of the library is available on Windows and Linux; it is distributed as part of an Intel compiler suite product on Mac OS X and QNX (as well as Windows and Linux). Application of the Intel IPP library to a "non-standard" operating system essentially requires that three conditions (described in detail below) be satisfied: a single-threaded variant of the library, access to a standard C library to satisfy the standard memory allocation routines (malloc/realloc/calloc/free) and tools that are compatible with one of the ABIs defined by the "standard" Intel IPP operating systems.

In essence, operating system environments that follow the ABI rules used by the Linux OS and the gcc compiler or the Windows OS and Microsoft Visual C/C++ compiler are candidates for application of the Intel IPP library. Only the single-threaded variant of the Intel IPP library should be used on a non-standard operating system because the Intel OpenMP library is required by the multi-threaded variants of the library. (Obviously, if your embedded OS is directly derived from the Microsoft Windows and Linux OS these rules will likely be satisfied.)

Support for the Standard C ABI

The Intel IPP library binaries are built using the Intel C/C++ compiler; this does not mean that you must also use the Intel compiler to build your code in if you will utilize the Intel IPP library in your application. Since the library is a C library it uses a standard C calling interface; meaning there are no name mangling complexities to contend with (standard C name mangling rules apply). Likewise, the call-return interface is compatible with the popular compilers and linkers used on the standard operating system platforms mentioned above (Windows and Linux). It is quite common for developers to use the Microsoft Visual Studio* compiler to create Intel IPP Windows applications and the gcc compiler for developing Intel IPP Linux applications.

Link with a Standard C Library

Only a few functions within the standard C library are needed to satisfy the needs of the Intel IPP library. The library primitives make no direct calls to operating system services and make no assumptions about the type of services that may be available within the underlying operating system. Memory allocation is the only significant operating system service required. As an option, memory allocation requests can be fielded by your own intermediate interface – further removing the operating system dependencies.

The IPP library functions use no locks, semaphores or static memory; they rely only on the calling application’s stack and the standard C library memory allocation routines (malloc/realloc/calloc/free) for temporary and static memory storage. To completely eliminate the Intel IPP library’s dependency on these C library memory allocation functions you can use the i_malloc interface to substitute your own memory allocation routines for the standard C library routines (see the Intel IPP i_malloc sample for details).

Limit Use to the Single-threaded Static Library (no OpenMP*)

If you restrict your application to the non-threaded static variant of the Intel IPP library, operating system requirements are minimized. Limiting yourself to a single-threaded variant of the library is not a dramatic compromise. Approximately 80% of the functions in the library are single-threaded (only 20% are multi-threaded). You need to use the single-threaded static variant because multi-threading within the Intel IPP library functions is implemented using the Intel® OpenMP multi-threading library. For more information about threading within the Intel IPP library see this KB article: OpenMP and the Intel® IPP Library.

The Intel OpenMP library is tightly coupled to the underlying operating system and the Intel C and Fortran compilers. While the Intel OpenMP library is compatible with OpenMP standards, one cannot guarantee that OpenMP libraries from different vendors are interchangeable. See the Intel compiler documentation section entitled OpenMP* Source Compatibility and Interoperability with Other Compilers for more information. So even if your embedded OS and compiler include an OpenMP library, it is safest to not use it with your Intel IPP application on a non-standard operating system.

Using the Intel® IPP Library with an RTOS

Applications that use the Intel IPP library can also be successfully applied to an RTOS. The lack of locks and semaphores within the library, and the atomic nature of the functions within the library, means the library is safe to use with many deterministic applications. The primitives in the library have not been “characterized” for deterministic applications; that is, they have not been defined to meet a guaranteed minimum execution time, so you should characterize the execution time of the functions you intend to use before deciding if they are suitable for use inside your time-critical code. The perfsys tool, included with the library, can be used to make these timing measurements.

An example of the value of applying the Intel IPP library to an RTOS can be illustrated with the TenAsys* INtime RTOS* for Windows. The INtime RTOS is a special-purpose operating system designed to run alongside Windows, allowing two operating systems to run side-by-side on a single hardware platform (Windows and the INtime RTOS).

One can build Intel IPP applications for the INtime RTOS because it implements an ABI that is compatible with the 32-bit Microsoft Windows ABI (note that the INtime RTOS has a unique API, but uses Windows-compatible function calling and return rules) and uses the Microsoft Visual Studio development environment as its build and debug platform. Likewise, the Windows CE operating system can also support Intel IPP applications (for use on IA-32 Windows CE platforms only), for similar reasons (see the Intel IPP Windows CE sample for more information).

Combining the Intel IPP library with an RTOS gives you a means to easily add the raw performance gains of SIMD instructions to the real-time determinism of an RTOS. In some applications displacing a DSP requires both performance and determinism. See the TenAsys white paper for more information about applying the Intel IPP library to an RTOS application.

How do you get started with the Intel IPP library? If you already own the Intel Compiler Pro compiler or one of the new Intel Parallel Studio products you've probably already got a copy of the Intel IPP library on your development system! If you don't have one of those tools you can always download an evaluation copy of the library. While the Intel compiler is a great tool for use with the Intel IPP library, the Intel compiler is not a requirement for building applications with the library. The Intel IPP library can be used with your favorite compiler for tremendous performance improvements.

Download a free evaluation copy of the IPP library at the main IPP product page. And don't forget to grab the free IPP samples to help you start even faster.

Para obtener información más completa sobre las optimizaciones del compilador, consulte nuestro Aviso de optimización.