Build Application and Create New Project

To create an application the Intel Inspector can inspect for memory errors:

Get Software Tools

You need the following tools to try tutorial steps yourself using the nqueens_fortran sample application:

  • Intel Inspector installation package (.tgz file and license information)

  • .tgz file extraction utility

  • Supported compiler (see Release Notes for more information)

  • Editor

Acquire the Intel Inspector

If you do not already have access to the Intel Inspector, you can download an evaluation copy from http://software.intel.com/en-us/articles/intel-software-evaluation-center/.

Install and Set Up the Intel Inspector Sample Applications

  1. Copy the nqueens_fortran.tgz file from the <install-dir>/samples/<locale>/Fortran/ directory to a writable directory or share on your system. The default <install-dir> is below /opt/intel/.

  2. Extract the sample from the .tgz file to create the nqueens_fortran directory.

  3. Ensure you have set the EDITOR or VISUAL environment variable to your text editor.

Note

  • Samples are non-deterministic. Your screens may vary from the screen captures shown throughout this tutorial.

  • Samples are designed only to illustrate the Intel Inspector features; they do not represent best practices for creating code.

Verify Optimal Compiler/Linker Settings

You can use the Intel® Inspector on both debug and release modes of C++ and Fortran binaries containing native code; 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

Correct Fortran Setting

Impact If Not Set Correctly

Debug information

Enabled (-g)

Enabled (-debug or -g)

Missing file/line information

Optimization

Disabled (-O0)

Disabled (-O0)

Incorrect file/line information

Dynamic runtime library

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

Selected (-shared-intel)

False positives or missing code locations

Basic runtime error checks

Disabled (do not use -fmudflap)

None (-check:none)

False positives

Build the Application

  1. In a terminal session, change directory to the nqueens_fortran/ directory.

  2. Type make nqueens_memory_debug to build a debug version of the nqueens_memory sample application.

Verify the Application Runs Outside the Intel Inspector

  1. In the same terminal session, type ./nqueens_memory_debug to execute the sample application.

  2. Check for non-deterministic application output similar to the following:

    Usages: nqueens_memory[_debug] boardSize
    Using default size of 10
    Starting nqueens solver for size 10 with 8 thread(s)
    Number of solutions: 724
    correct result!
    Calculations took 116 ms.
    

Open the Intel Inspector GUI

  1. In another terminal session, do one of the following:
    • Type one of the following source commands to set up your environment:

      • source <install-dir>/inspxe-vars.sh

      • source <install-dir>/inspxe-vars.csh

    • Add <install-dir>/bin32 or <install-dir>/bin64 to your path.

      Note

      The default installation directory is below /opt/intel/.

  2. Type inspxe-gui.

Create a New Project

  1. Choose File > New > Project... to display a dialog box similar to the following:
    Create a Project dialog box

  2. In the Project name field, type memory_issues. Then click the Create project button to create a config.inspxeproj file in the ~/intel/inspxe/projects/memory_issues/ directory (default location) and display a dialog box similar to the following:
    Target tab in the Project Properties dialog box

  3. Click the Browse... button next to the Application field and select the nqueens_fortran/nqueens_memory_debug application. Notice the Intel Inspector autofills the project Working directory field for you. Then click the OK button to return to the Welcome page, where the name of the opened project displays in the title bar and in the Project Navigator pane. (If necessary, choose View > Project Navigator to display the Project Navigator.)

Key Terms

False positive


Studio-specific supplemental documentation may be available at <install-dir>/<studio>/documentation/.

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