Tutorial

  • 11/18/2019
  • Public Content

Visual Studio* IDE: Choose Project and Build Application

Intel® Inspector
is a dynamic memory and threading error checking tool for users developing serial and multithreaded applications on Windows* and Linux* operating systems. This topic is part of a
tutorial
that shows how to find and fix
memory
errors using the
Intel Inspector
and a
Fortran
sample application.
Follow these steps only if you are using the
Intel Inspector
plug-in to the Visual Studio* IDE to complete this tutorial.
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 and license
  • .zip
    file extraction utility
  • Supported compiler (see
    Release Notes
    for more information)
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.zip
    file from the
    <install-dir>\samples\<locale>\Fortran
    directory to a writable directory or share on your system. The default
    <install-dir>
    is below
    C:\Program Files (x86)\Intel\
    (on certain systems, instead of
    Program Files (x86)
    , the directory name is
    Program Files
    ).
  2. Extract the sample from the
    .zip
    file.
  • 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.

Open a Visual Studio* Solution

  1. Choose
    File
    Open
    Project/Solution
    .
  2. In the
    Open Project
    dialog box, open the
    nqueens_fortran\nqueens_fortran.sln
    file to display the
    nqueens_fortran
    solution in the
    Solution Explorer
    .
    The
    nqueens_fortran.sln
    solution was created using the Visual Studio* 2010 IDE. If the Visual Studio* conversion wizard appears, follow the steps to convert the solution to run on your installed version of the Visual Studio* IDE.

Choose a Startup Project

If the
memory_issues
project is not the startup project (project typeface in the
Solution Explorer
is not bold),
  1. Right-click the
    memory_issues
    project in the
    Solution Explorer
    .
  2. Choose
    Set as StartUp Project
    , which changes the project typeface to bold.

Understand 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 (
/Zi
or
/ZI
)
Missing file/line information
Optimization
Disabled (
/Od
)
Incorrect file/line information
Dynamic runtime library
Selected (
/MD
or
/MDd
)
False positives or missing code locations
Basic runtime error checks
Disabled (do not use
/RTC
;
Default
option in Visual Studio* IDE)
False positives
Compiler/Linker Property
Correct Fortran Setting
Impact If Not Set Correctly
Debug information
Enabled (
/debug:full
)
Missing file/line information
Optimization
Disabled (
/Od
)
Incorrect file/line information
Dynamic runtime library
Selected (
/libs:dll/threads
or
libs:dll/threads/dbglibs
)
False positives or missing code locations
Basic runtime error checks
None (
/check:none
)
False positives
The sample code is already set. Follow these steps if you need to change settings for your application.
  1. If the
    Solutions Configuration
    drop-down on the Visual Studio*
    Standard
    toolbar is set to
    Release
    , change it to
    Debug
    .
  2. Right-click the
    memory_issues
    project in the
    Solution Explorer
    , then choose
    Properties
    to display the
    Property Pages
    dialog box.
  3. In the left pane, choose
    Configuration Properties
    Fortran
    .
    • Choose
      Debugging
      and verify the
      Debug Information Format
      field is set to
      Full (/debug:full)
      .
    • Choose
      Optimization
      and verify the
      Optimization
      field is set to
      Disable (/Od)
      .
    • Choose
      Libraries
      and verify the
      Runtime Library
      field is set to
      Multithread DLL (/libs:dll/threads)
      or
      Debug Multithread DLL (libs:dll/threads/dbglibs)
      .
    • Choose
      Run-time
      and verify the
      Runtime Error Checking
      field is set to
      None (/check:none)
      .
  4. In the left pane, choose
    Configuration Properties
    Linker
    Debugging
    and verify the
    Generate Debug Info
    field is set to
    Yes (/DEBUG)
    .
  5. Click the
    Apply
    button, then click the
    OK
    button to close the
    Property Pages
    dialog box.

Build and Test the Application

  1. Choose
    Build
    Project Only
    Build Only memory_issues
    to build a single project in the solution.
  2. Check the messages in the
    Output
    window to confirm the build succeeded.
  3. Choose
    Debug
    Start Without Debugging
    to test the application.
  4. Check for non-deterministic application output (that also varies by number of cores) similar to the following:
    Usage: memory_issues.exe boardSize Using default size of 10 Starting nqueens solver for size 10 with 2 thread(s) Number of solutions: 724 Correct result! Calculations took 47 ms. Press any key to continue...

Product and Performance Information

1

Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804