Skip to content

TutorialNvidiaGPUs

Thomas Roehl edited this page Apr 22, 2020 · 1 revision

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.

  • LIKWID_NVMARKER_INIT: Initialize the library and configure measurements
  • LIKWID_NVMARKER_START("compute"): Start the measurement and name the output "compute"
  • LIKWID_NVMARKER_STOP("compute"): Stop the measurements for code region "compute"
  • LIKWID_NVMARKER_CLOSE: Write out results and finalize library

Furthermore, there are some optional calls:

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

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