Intel® Inspector User Guide for Linux* OS

ID 767796
Date 5/15/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Build Your Application

Follow these guidelines to build applications that produce the most accurate and complete Intel Inspector analysis results:

About Using Optimal Compiler/Linker Settings

You can use the Intel® Inspector to analyze memory and threading errors in both debug and release modes of C++ and Fortran binaries; however, applications compiled/linked in debug mode using the following settings produce the most accurate and complete analysis results.

Compiler/Linker Property

Correct C/C++ Setting

Impact If Not Set Correctly

Debug information

Enabled (-g)

Missing file/line information

Optimization

Disabled (-O0)

Incorrect file/line information

Dynamic runtime library

Selected (-shared-intel for Intel(R) compilers; default or -Bdynamic for GNU compilers)

False positives or missing code locations

Basic runtime error checks

Disabled (do not use -fmudflap)

False positives

Compiler/Linker Property

Correct Fortran Setting

Impact If Not Set Correctly

Debug information

Enabled (-debug or -g)

Missing file/line information

Optimization

Disabled (-O0)

Incorrect file/line information

Dynamic runtime library

Selected (-shared-intel)

False positives or missing code locations

Basic runtime error checks

None (-check:none)

False positives

To learn more about options necessary to produce the most accurate and complete analysis results, see the following resources:

About Ensuring Applications Contain More Than One Thread

If you plan to run threading error analyses on systems with only one processor, you may need to take special steps to ensure applications create more than one thread:

Programming Model

Possible Strategies

oneAPI Threading Building Blocks (oneTBB)

When initializing an object of class tbb::task_scheduler_init, use the following function to force the creation of two or more threads: initialize (int), where int = 2 or higher.

For more information, see http://www.threadingbuildingblocks.org/

POSIX Threads API

Use the following function to create as many threads as you need: pthread_create.

For more information, see http://www.unix.org/version3/ieee_std.html

OpenMP* API

Use the following to force the creation of two or more threads:

  • OMP_NUM_THREADS runtime environment variable - Sets the maximum number of threads in the parallel region, unless overridden by an omp_set_num_threads function or num_threads clause.

  • omp_set_num_threads function - Sets the number of threads in subsequent parallel regions, unless overridden by a num_threads clause.

  • num_threads clause - Sets the number of threads in a thread team.

For more information, see http://openmp.org/wp/openmp-specifications/