Skip to content

TutorialNvidiaGPUs

Thomas Roehl edited this page Nov 13, 2024 · 2 revisions

Introduction

Starting with version 5.0, LIKWID supports Nvidia GPUs for topology and performance monitoring.

For build instructions see here.

How is it implemented

LIKWID uses the libraries in the Nvidia CUDA toolkit to determine all required data and function at runtime. If the libraries are not available, the support is deactivated at runtime.

The measurement features of the Nvidia CUPTI API require that the configuration of the measurements has to be done in the same process as the computations. Therefore, LIKWID currently support only measurements of marked code regions in the application code. For this purpose, the NvMarkerAPI needs to be added to the source code and the application linked with LIKWID.

LIKWID NvMarker API

Similar to the LIKWID MarkerAPI for CPUs, the NvMarker API consists of a set of macros. The macros can be activated during compilation (-DLIKWID_NVMON). All macros need to be in a serial region or be called by only a single thread.

  • NVMON_MARKER_INIT: Initialize the library and configure measurements
  • NVMON_MARKER_START("compute"): Start the measurement and name the output "compute"
  • NVMON_MARKER_STOP("compute"): Stop the measurements for code region "compute"
  • NVMON_MARKER_CLOSE: Write out results and finalize library

Furthermore, there are some optional calls:

  • NVMON_MARKER_REGISTER("compute"): Register code region "compute" to reduce startup overhead at first invocation of LIKWID_NVMARKER_START.
  • NVMON_MARKER_SWITCH: Switch round-robin to next eventset if multiple are given on the command line.
  • NVMON_MARKER_GET("compute", ...): Get the current result for code region "compute"

LIKWID version < 5.4.0 uses LIKWID_NVMARKER_ as prefix for the Nvidia GPU related MarkerAPI.

Measurement

For measurements, you call likwid-perfctr with the appropriate command line options. There are two new option:

  • -G <list>: List of GPUs for measurement
  • -W <events>: Event set of performance group for measurement

It is mandatory to use the -m command line switch to activate the NvMarker API.

Clone this wiki locally