Using Intel Inspector to Monitor Programs
Intel Inspector is a powerful memory and thread debugger that helps identify memory errors, threading issues, and other bugs in your applications. Here’s how to use it:
Installation and Setup
- Install Intel Inspector as part of the Intel® oneAPI Base Toolkit or HPC Toolkit
- Configure your environment by running the appropriate vars script:
- On Windows:
C:\Program Files (x86)\Intel\oneAPI\inspector\latest\env\vars.bat
- On Linux:
source /opt/intel/oneapi/inspector/latest/env/vars.sh
- On Windows:
Basic Usage
1. Starting Analysis
For a new analysis:
- Launch Intel Inspector GUI
- Click “New Project”
- Specify:
- Application executable
- Working directory
- Command line arguments
Command line alternative:
inspxe-cl -collect <analysis_type> -r <result_dir> -- <your_program> [args]
2. Choosing Analysis Type
Intel Inspector offers several analysis types:
- Memory Errors: Detect memory leaks, corruption, etc.
- Threading Errors: Find race conditions, deadlocks, etc.
- Combo Analysis: Both memory and threading
3. Running the Analysis
- Select your desired analysis type
- Click “Start” to run your program under inspection
- The tool will instrument and monitor your application
Interpreting Results
After analysis completes:
- Problems are categorized by severity (Error, Warning, Remark)
- Click on issues to see:
- Detailed description
- Source code location (if debug info available)
- Call stack leading to the issue
Advanced Features
- Suppressions: Create filters to ignore known issues
- Baselines: Compare results between different runs
- Custom Analysis: Configure specific memory or threading checks
- Integration: Use with IDEs like Visual Studio or Eclipse
Command Line Reference
Common commands:
# Memory error analysis
inspxe-cl -collect mi1 -r ./result_dir -- ./myapp
# Threading error analysis
inspxe-cl -collect ti1 -r ./result_dir -- ./myapp
# View results
inspxe-cl -report problems -r ./result_dir
Tips for Effective Use
- Build your application with debug symbols (-g on Linux, /Zi on Windows)
- Reduce optimization levels for clearer analysis
- Start with small test cases before analyzing large applications
- Use the “Pause” feature for long-running applications
- Consider incremental analysis for large codebases
Intel Inspector provides detailed documentation with examples for specific programming languages and scenarios. Would you like more specific information about any particular aspect of using Intel Inspector?