Skip to content

Latest commit

 

History

History

ze_metric_streamer

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Level Zero Metric Streamer

Note: The sample currently does not support 2-Tiles GPU data collection

Overview

This sample is a simple LD_PRELOAD based tool that allows to collect such GPU hardware metrics as execution unit (EU) active, stall and idle ratios attributed to Level Zero kernels. The sample is based on continuous mode for metrics collection.

As a result, table like the following will be printed. For each kernel its call count, total time and metric values will be shown.

=== Device Metrics: ===

Total Execution Time (ns): 516360532
Total Kernel Time (ns): 174056667

    Kernel,       Calls,           Time (ns),        Time (%),        Average (ns),   EU Active (%),    EU Stall (%),     EU Idle (%)
      GEMM,           4,           174056667,          100.00,            43514166,           73.24,           26.67,            0.09

To set target device and sub-device to collect metrics from one can specify PTI_DEVICE_ID and PTI_SUB_DEVICE_ID environment variables.

Supported OS

  • Linux
  • Windows (under development)

Prerequisites

Build and Run

Linux

Run the following commands to build the sample:

cd <pti>/samples/ze_metric_streamer
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make

Use this command line to run the tool:

./ze_metric_streamer <target_application>

One may use ze_gemm as target application:

./ze_metric_streamer ../../ze_gemm/build/ze_gemm

Since Intel(R) Metrics Discovery Application Programming Interface library is loaded at runtime, one may need to set its path explicitly, e.g.:

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib ./ze_metric_streamer ../../ze_gemm/build/ze_gemm

On Linux one may need to enable collection for non-root users:

sudo echo 0 > /proc/sys/dev/i915/perf_stream_paranoid

Windows

Use Microsoft* Visual Studio x64 command prompt to run the following commands and build the sample:

cd <pti>\samples\ze_metric_streamer
mkdir build
cd build
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_LIBRARY_PATH=<level_zero_loader>\lib -DCMAKE_INCLUDE_PATH=<level_zero_loader>\include ..
nmake

Use this command line to run the tool:

ze_metric_streamer.exe <target_application>

One may use ze_gemm as target application:

ze_metric_streamer.exe ..\..\ze_gemm\build\ze_gemm.exe

Since Intel(R) Metrics Discovery Application Programming Interface and Metrics Library for Metrics Discovery API (Metrics Library for MD API) are loaded at runtime, one may need to set its path explicitly (see the output of cmake), e.g.:

set PATH=%PATH%;C:\Windows\system32\DriverStore\FileRepository\igdlh64.inf_amd64_d59561bc9241aaf5
ze_metric_streamer.exe ..\..\ze_gemm\build\ze_gemm.exe