Example: Profile a DPC++ Application on Windows*
Profile a sample
matrix_multiply
DPC++ (Data Parallel C++) application with Intel® VTune™ Profiler. Get familiar with the product and understand the statistics collected for GPU-bound applications.
Prerequisites
- Make sure you have Microsoft* Visual Studio (v2017 or newer) installed on your system.
- InstallIntel VTunefrom theProfilerIntel® oneAPI Base Toolkitor theIntel® System Bring-up Toolkit. These toolkits contain theIntel® oneAPI(DPC++/C++Compilerdpcpp) compiler required for the profiling process.
- Set up environment variables. Execute thevars.batscript located in the<directory.vtune-install-dir>\env
- Ensure that the Intel oneAPI DPC++ Compiler (installed with the Intel oneAPI Base toolkit) is integrated into Microsoft Visual Studio.
- Compile the DPC++ code using the-gline-tables-onlyand-fdebug-info-for-profilingoptions for Intel oneAPI DPC++ Compiler.
For information on installing
Intel VTune
in the Microsoft* Visual Studio environment, see
VTune Profiler User Guide.
Profiler
Build the Matrix App
Download the
matrix_multiply_vtune
code sample package for Intel oneAPI toolkits. This contains the sample which you can use to build and profile a DPC++ application.
- Open Microsoft* Visual Studio.
- ClickFile > Open > Project/Solution. Find thematrix_multiply_vtunefolder and selectmatrix_multiply.sln.
- Build this configuration (Project > Build).
- Run the program (Debug > Start Without Debugging).
- To choose a DPC++ or threaded version of the sample, use preprocessor definitions.
- Go toProject Properties > DPC++ > Preprocessor > Preprocessor Definition.
- DefineDPCPPorUSE_THR.
Run GPU Analysis
Run a GPU analysis on the Matrix sample.
- From the Visual Studio toolbar, click theConfigure Analysisbutton.TheConfigure Analysiswindow opens. By default, it inherits your VS project settings and specifies thematrix_multiply.exeas an application to profile.
- In theConfigure Analysiswindow, click the
Browse button in the
HOWpane. - Select theGPU Compute/Media Hotspotsanalysis type from theAcceleratorsgroup in the Analysis Tree.
- Click theStartbutton to launch the analysis with the predefined options.
VTune
collects data and displays analysis results in the
Profiler
GPU Compute/Media Hotspots
viewpoint. In the
Summary
window, see statistics on CPU and GPU resource usage to understand if your application is GPU-bound. Switch to the
Graphics
window to see basic CPU and GPU metrics representing code execution over time.