Build Settings for C/C++ Applications

This topic describes the C/C++ native build (compiler and linker) settings for Intel Advisor tools. The optimization options for the Survey and Suitability tools differ from the Correctness tool (no optimization), thus separate build scripts and target executables are needed.

Tool

Configuration or Options

Amount of Data

Survey and Suitability

Release configuration. Specify debug information and moderate (limited inlining) optimization.

Usually the same data set as typical customer program execution, unless you want to provide a data set that exercises a specific part of your program you are evaluating for parallelism.

Correctness

Debug configuration. Specify debug information and no optimization.

Much smaller subset of the data typically used. You need to select a data set that is small but representative (see Choosing a Small, Representative Data Set for the Correctness Tool).

Build Options for Modules with Annotations

In each source module that contains Intel Advisor annotations, specify the following build options to reference the annotation definitions:

When using Microsoft Visual Studio, specify this project property:

Option Property

Explanation

C/C++ > General > Additional Include Directories > $(ADVISOR_XE_2013_DIR)\include

Compiler: Searches an additional include directory that contains the annotation definitions.

If you build your application's target using a Windows command line (not in Visual Studio), after you set up your command line environment, add this option to your build command:

Option

Explanation

/I"%ADVISOR_XE_2013_DIR%"\include

Compiler: Searches an additional include directory that contains the Intel Advisor annotation definitions.

Survey and Suitability Tools: Debug and Optimization Build Options

In addition to the options listed above for source modules that contain annotations, use the following options. To build a target for the Survey or Suitability tools, use the Release configuration. Use the following compiler and linker options to get full debug information and moderate optimization for your target.

When using Microsoft Visual Studio, specify these project properties:

Tool

Option Property

Explanation

Survey and Suitability

C/C++ > General > Debug Information Format > Program Database (/Zi)

Compiler: Requests full debug information.

Survey and Suitability

Linker > Debugging > Generate Debug Info > Yes (/DEBUG)

Linker: Requests full debug information.

Survey and early stages of Suitability

C/C++ > Optimization > Inline Function Expansion > Only __inline (/Ob1).

Compiler: Requests moderate optimization that limits function inlining.

Later stages of Suitability

C/C++ > Optimization > user-specified

Compiler: Use your normal optimization level that typically does not limit function inlining.

If you build your application's target using a Windows command line (not in Visual Studio), add these options to your build command:

Tool

Option

Explanation

Survey and Suitability

/debug=full

Compiler: Requests full debug information.

Survey and Suitability

/DEBUG

Linker: Requests full debug information.

Survey and early stages of Suitability

/O2 and /Ob1

Compiler: Requests moderate optimization that limits function inlining.

Later stages of Suitability

user-specified-optimization

Compiler: Use your normal optimization level that typically does not limit function inlining.

If the Suitability Report provides an incorrect location for site, task, or lock annotations, determine whether your build specifies advanced compiler optimization options that - for example - eliminate duplicate code or merge call sites. If so, consider removing the advanced optimization option when you build the target to be analyzed by Suitability tool. Such advanced optimizations may also cause similar issues when using other tools.

If the Intel Advisor tools report that your sources, files, or line numbers are not available, make sure that your build options specify debug information (listed above).

Correctness Tool: Debug, Optimization, and Run-time Build Options

In addition to the options listed above for source modules that contain annotations, use the following options. The Correctness tool is much easier to use on optimization-disabled code because the relationship between the sources and the running program is much simpler. For this reason, to build a target for the Correctness tool, use a Debug configuration build. Use the following compiler and linker options to provide debug information and no optimization for the target:

When using Microsoft Visual Studio, specify these project properties:

Tool

Option Property

Explanation

Correctness

C/C++ > General > Debug Information Format, either Program Database (/Zi) or Program Database for Edit & Continue (/ZI)

Compiler: Requests full debug information.

Correctness

Linker > Debugging > Generate Debug Info > Yes (/DEBUG)

Linker: Requests full debug information.

Correctness

C/C++ > Optimization > Disabled (/Od).

Compiler: Disables optimization.

Correctness

C/C++ > Code Generation > Runtime Library > either Multi-threaded Debug DLL (/MDd) or Multi-threaded DLL (/MD)

Linker: Search for unresolved references in a multithreaded, shared object run-time library.

If you build your application's target using a Windows command line (not in Visual Studio), add these options to your build command:

Tool

Option

Explanation

Correctness

Either /Zi or /ZI

Compiler: Requests full debug information.

Correctness

/DEBUG

Linker: Requests full debug information.

Correctness

/Od

Compiler: Disables optimization.

Correctness

Either /MDd or /MD

Linker: search for unresolved references in a multithreaded, shared object run-time library.

If you do not enable debug information (/Zi , /ZI, or /debug=full), you might see missing file/line information during analysis. Similarly, if you do not disable optimization (by specifying /Od), you may see incorrect file/line information during analysis.

For more complete information about compiler optimizations, see our Optimization Notice.