Enable System-wide Time-based GPU Metrics Collection
Use these steps to enable System Analyzer and Graphics Trace Analyzer to collect Intel GPU metrics. Afterwards, the available metrics will also be shown in Monitor under Options on the Metrics tab (in a top-level Intel category labeled with a suffix based on either the GPU name or graphics device ID).
- You should only have graphics drivers for an Intel GPU installed on the machine. If other GPU vendor's graphics drivers are installed, follow their instructions to remove them. Then confirm that Intel GPU graphics drivers are installed.
- Make sure that the Ubuntu default open source Intel graphics driver package (xserver-xorg-video-intel) is installed and loaded. The following command should output text with the substring xserver-xorg-video-intel:
apt search xorg | grep intel
- Verify that the Intel GPU i915 kernel module is installed. The following command should output text with the module named i915 in the left column:
lsmod | grep i915
Enable the Intel kernel module to allow user space applications to perform GPU based metrics collection. On boot, by default, it does not allow user space applications to do this:
- Use the following command to manually enable GPU based metrics collection:
sudo sysctl -w dev.i915.perf_stream_paranoid=0
- Optionally, use the following command to add an automated cron job that executes whenever the platform reboots:
sudo crontab -e # Add the following line at the end or as the 1st no comment line:
@reboot /sbin/sysctl -w dev.i915.perf_stream_paranoid=0
- Afterwards, the perf_stream_paranoid mode 0 change can be confirmed by using the following command:
sysctl -n dev.i915.perf_stream_paranoid
- Install the current version of the Intel metrics-discovery library (libigdmd.so). This is an open source library that is periodically updated to support Intel integrated and discrete GPUs. Intel® Graphics Performance Analyzer (Intel GPA) tools use the library with its former name, libmd.so.
These steps are validated on Ubuntu 20.04.
- Delete any old versions of the library used by the GPA tools. This helps to ensure that you have the latest version of the open source Intel metrics-discovery library. Run this command:
sudo rm /opt/intel/gpa/libmd.so*
sudo rm /opt/intel/gpa/libigdmd.so*
- Install the base packages required on your machine for compilation with:
sudo apt install g++ libdrm-dev
- Clone and build the Intel metrics-discovery library from the latest source:
git clone https://github.com/intel/metrics-discovery
make -j4 # Adjust based on the # of available CPU cores to improve compile time.
- Install the built Intel metrics-discovery library for the GPA tools to use:
sudo cp -a ../dump/linux64/release/metrics_discovery/libigdmd.so* /opt/intel/gpa/
sudo ln -sf libigdmd.so /opt/intel/gpa/libmd.so
- Verify that the Monitor, Frame Analyzer and other Intel applications are not running in the foreground or background. To do this,
- Run the Ubuntu System Monitor.
- Search for the string Intel.
- If GpaMonitor is visible in the search results, right-click on it.
- Select End followed by End Process.
- Wait a few seconds for the application to shut down.
- Repeat steps a-f for any other Intel GPA applications you found.
- Confirm that GPA Monitor only shows a single Intel GPU connection in the upper-left drop-down menu.
- In the Metrics tab (in a top-level Intel category labeled with a suffix based on either the GPU name or graphics device ID), verify that Intel GPU metrics display under Options.
Enable OpenGL* Query-based GPU Metrics Collection in Frame Analyzer
First perform the steps above. Afterwards, you can perform the following steps to collect more accurate metric values in Graphics Frame Analyzer by locking the GPU frequency:
- Modify the rights to the following files to add write capabilities:
sudo chmod +w /sys/class/drm/card0/gt_max_freq_mhz
sudo chmod +w /sys/class/drm/card0/gt_min_freq_mhz
sudo chmod +w /sys/class/drm/card0/gt_boost_freq_mhz
- Check and record what the current GPU frequency settings are:
- Write the same GPU frequency value in MHz for the three files. Do not exceed the GPU's maximum frequency, For example:
echo 1000 | sudo tee /sys/class/drm/card0/gt_max_freq_mhz
echo 1000 | sudo tee /sys/class/drm/card0/gt_min_freq_mhz
echo 1000 | sudo tee /sys/class/drm/card0/gt_boost_freq_mhz
After finishing usage of Graphics Frame Analyzer, restore the prior settings recorded by following the example in step 3 above, except replace 1000 with the original settings recorded. Alternatively, perform a reboot.