Parallel Lint Overview

Intel® Parallel Composer provides parallel lint, a source code analysis feature.

Parallel Lint

Writing and debugging parallel programs requires specific knowledge and tools. Parallel lint can help in both the development of parallel applications and the parallelizing of existing serial applications. Parallel lint is a source code analysis capability that performs static global analysis to locate parallelization errors in OpenMP* programs. It uncovers errors that would go undetected by the compiler. The OpenMP 3.0 standard is supported. OpenMP provides a variety of ways for expressing parallelization. Parallel lint can diagnose problems with OpenMP directives and clauses, including:

In certain cases, an OpenMP program can meet all requirements of the specification but still have serious semantic issues. Parallel lint can help diagnose:

Parallel lint can be used to find and analyze issues with source files; these source files need not form a whole program (for instance, you can check a library source). In such cases, due to the lack of full information on usage and modification of global objects, calls to routines, and so forth, analysis will be less exact.  

Your code must successfully compile, with no errors, for source code analysis options to take effect.

The intended output from parallel lint are useful diagnostics; no executable is generated. Object files and library files generated during analysis cannot be used to generate an executable or a dynamic or static library.

Parallel lint analysis performs a general overview check of a program for all possible values simultaneously. This is in contrast to run-time checking tools that execute a program with a fixed set of values for input; such checking tools cannot easily check all edge effects. Parallel lint analysis checks for all input values and execution paths.

Since parallel lint does not perform full interpretation of analyzed programs, it can generate so called false-positive messages. This is a fundamental difference between the compiler and parallel lint generated errors; in the case of parallel lint, you decide whether the generated error is legitimate and needs to be fixed.

Using the Source Code Analysis Options

Source code analysis options include the following:

Option

Result

-diag-enable sc-parallel{[1|2|3]}

/Qdiag-enable:sc-parallel{[1|2|3]}

Enables parallel lint analysis. The number specifies the several level of the diagnostics (1=all critical errors, 2=all errors, and 3=all errors and warnings)

-diag-disable sc-parallel

/Qdiag-disable:sc-parallel

Disables parallel lint analysis

-diag-enable sc-include

/Qdiag-enable:sc-include

Analyzes include files as well as source files.

-diag-disable warn

/Qdiag-disable:warn

Suppresses all warnings, cautions and comments (issues errors only), including those specific to source code analysis

-diag-disable num-list

/Qdiag-disable:num-list

Suppresses messages by number list, where num-list is either a single message or a list of message numbers separated by commas and enclosed in parentheses

-diag-file [file]

/Qdiag-file[:file]

Directs diagnostic results to file with .diag as the default extension. You need to enable source code analysis diagnostics before you can send them to a file. If a file name is not specified, the diagnostics are sent to name-of-the-first-source-file.diag.

-diag-file-append[=file]

/Qdiag-file-append[:file]

Appends diagnostic results to file with .diag as the default extension. You need to enable source code analysis diagnostics before you can send the results to a file. If you do not specify a path, the current working directory will be searched. If the named file is not found, a new file with that name will be created. If a file name is not specified, the diagnostics are sent to name-of-the-first-source-file.diag.

The following notes apply:

Using Source Code Analysis Options with Other Compiler Options

If the /c compiler option is used on the command line along with a command line option to enable source code analysis, an object file is created; source code analysis diagnostics are not produced. This object file may be used in a further invocation of source code analysis. To receive complete source code diagnostics, specify source code analysis options for both compilation and linking phases. This feature is useful when a program consists of files written in different languages (C/C++ and Fortran).

icl /c /Qopenmp /Qdiag-enable:sc-parallel2 file1.c

icl /c /Qopenmp /Qdiag-enable:sc-parallel2 file2.c

icl /Qopenmp /Qdiag-enable:sc-parallel2 file1.obj file2.obj

To analyze OpenMP directives, add the /Qopenmp option to the command line.

Using Source Code Analysis within the IDE

When source code analysis support is enabled within the IDE, the customary final build target (e.g. an executable image) is not created. Therefore, you should create a separate "Source Code Analysis" configuration.

In the Microsoft Visual Studio Environment, modify the existing Debug (development) configuration, as follows:


  1. Select the Project Configuration Manager either from the Build menu or from the Project Properties window.

  2. In the Active Solution Configuration dropdown, select <New..>

  3. Provide a name for this configuration; for example, Source Code Analysis.

  4. Specify to "Copy Settings from" the Debug configuration.

  5. Exit the Configuration Manager.

With the new configuration active, navigate to the C/C++ > Diagnostics property page. Use the Level of Source Code Parallelization Analysis and Analyze Include Files properties to control source code analysis.