Get Started

Get Started with Intel® VTune™ Profiler

ID 769038
Date 11/07/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Example: Profile a SYCL* Application on Windows*

Profile a sample matrix_multiply SYCL 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.
  • Install Intel VTune Profiler from the Intel® oneAPI Base Toolkit or the Intel® System Bring-up Toolkit. These toolkits contain the Intel® oneAPI DPC++/C++ Compiler(icpx -fsycl) compiler required for the profiling process.
  • Set up environment variables. Execute the vars.bat script located in the <vtune-install-dir>\env directory.
  • Ensure that the Intel oneAPI DPC++ Compiler (installed with the Intel oneAPI Base toolkit) is integrated into Microsoft Visual Studio.
  • Compile the code using the -gline-tables-only and -fdebug-info-for-profiling options for Intel oneAPI DPC++ Compiler.
  • Set up your system for GPU analysis.

For information on installing Intel VTune Profiler in the Microsoft* Visual Studio environment, see VTune Profiler User Guide.

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 SYCL application.

  1. Open Microsoft* Visual Studio.
  2. Click File > Open > Project/Solution. Find the matrix_multiply_vtune folder and select matrix_multiply.sln.
  3. Build this configuration (Project > Build).
  4. Run the program (Debug > Start Without Debugging).
  5. To choose a DPC++ or threaded version of the sample, use preprocessor definitions.

    1. Go to Project Properties > DPC++ > Preprocessor > Preprocessor Definition.
    2. Define icpx -fsycl or USE_THR.

Run GPU Analysis

Run a GPU analysis on the Matrix sample.

  1. From the Visual Studio toolbar, click the Configure Analysis button.

    The Configure Analysis window opens. By default, it inherits your VS project settings and specifies the matrix_multiply.exe as an application to profile.

  2. In the Configure Analysis window, click the Browse button in the HOW pane.
  3. Select the GPU Compute/Media Hotspots analysis type from the Accelerators group in the Analysis Tree.

  4. Click the Start button to launch the analysis with the predefined options.

Run GPU Analysis from Command Line:

  1. Open the sample directory:

    <sample_dir>\VtuneProfiler\matrix_multiply_vtune
  2. In this directory, open a Visual Studio* project file named matrix_multiply.sln

  3. The multiply.cpp file contains several versions of matrix multiplication. Select a version by editing the corresponding #define MULTIPLY line in multiply.hpp

  4. Build the entire project with a Release configuration.

    This generates an executable called matrix_multiply.exe.

  5. Prepare the system to run a GPU analysis. See Set Up System for GPU Analysis.

  6. Set VTune Profiler environment variables by running the batch file:

    export <install_dir>\env\vars.bat

  7. Run the analysis command:

    vtune.exe -collect gpu-offload -- matrix_multiply.exe

VTune Profiler collects data and displays analysis results in the 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.