Intel® C++ Compiler

Programming Example

This topic only applies to Intel® 64 architecture targeting the Intel® Xeon Phi™ coprocessor x100 product family (formerly code name Knights Corner).

This sample program, sample.cpp, uses the F32vec16 class to average the elements of an 80 element floating point array.

To generate the object file a.out, which only runs on Intel® MIC Architecture, compile the following code with the following command:

Overview: Intel® IEEE 754-2008 Binary Floating-Point Conformance Library

The Intel® IEEE 754-2008 Binary Floating-Point Conformance Library provides all operations mandated by the IEEE 754-2008 standard for binary32 and binary64 binary floating-point interchange formats. The minimum requirements for correct operation of the library are an Intel® Pentium® 4 processor and an operating system supporting Intel® Streaming SIMD Extensions 2 (Intel® SSE2) instructions.

Compilation Phases

The Intel® C++ Compiler processes C and C++ language source files. Compilation can be divided into these major phases:

  • Preprocessing

  • Semantic parsing

  • Optimization

  • Code generation

  • Linking

The first four phases are performed by the compiler:

Convert a C/C++ Program

The sequence of steps to create a parallel program using Intel® Cilk™ Plus is as follows:

  1. Typically, you start with a serial C/C++ program that implements the basic functions or algorithms that you want to parallelize. Ensure that the serial program is correct. Any bugs in the serial program will occur in the parallel program, but they will be more difficult to identify and fix.

Exception Handling

Intel® Cilk™ Plus attempts to reproduce, as closely as possible, the semantics of C++ exception handling. This generally requires limiting parallelism while exceptions are pending, and programs should not depend on parallelism during exception handling. The exception handling logic is as follows:

  • If an exception is thrown and not caught in a spawned child, then that exception is rethrown in the parent at the next sync point.

Microsoft Foundation Classes and Intel(R) Cilk(TM) Plus Programs


This topic is for Windows* programmers only.

The Microsoft Foundation Classes (MFC) library depends upon thread local storage to map from its class wrappers to the GDI handles for objects. Because an Intel® Cilk™ Plus strand is not guaranteed to run on any specific OS thread, parallel code using Intel® Cilk™ Plus cannot safely call MFC functions.

Considerations for Using Locks

You can use various synchronization mechanisms in the hardware or operating system.

The following lock terms and facts are useful:

  • The following terms are interchangeable: "acquiring", "entering", or "locking" a lock (or "mutex").

  • A strand (or thread) that acquires a lock is said to "own" the lock.

  • Only the owning strand can "release", "leave", or "unlock" the lock.

Subscribe to Intel® C++ Compiler