Getting Started

Supported Platforms

DCGM currently supports the following products and environments:

  • All K80 and newer Tesla GPUs
  • NVSwitch on DGX-2
  • All Maxwell and newer non-Tesla GPUs
    Note: Starting with v1.3, limited DCGM functionality is available on non-Tesla GPUs. More details are available in the section Feature Overview.
  • Linux - x64 and POWER
  • Ubuntu and CentOS/RHEL
  • CUDA 7.5+ and NVIDIA Driver R384+

    NVIDIA Driver R410 and later is required on systems using NVSwitch, such as DGX-2 or HGX-2.

  • Bare metal

Installation

To run DCGM the target system must include the following NVIDIA components, listed in dependency order:
  1. Supported Tesla Recommended Driver
  2. Supported CUDA Toolkit
  3. DCGM Runtime and SDK
  4. DCGM Python bindings (if desired)
All of the core components are available as RPMs/DEBs from NVIDIA’s website. The Python bindings are available in the /usr/src/dcgm/bindings directory after installation. The user must be root or have sudo privileges for installation, as for any such packaging operations.
Note: DCGM is tested and designed to run with a Tesla Recommended Driver. Attempting to run on other drivers, such as a developer driver, could result in missing functionality.

To remove the previous installation (if any), perform the following steps (e.g. on an RPM-based system).

  1. Make sure that the nv-hostengine is not running. You can stop it using the following command
    # sudo nv-hostengine -t
  2. Remove the previous installation.
    # sudo yum remove datacenter-gpu-manager
Installing DCGM via the package manager is simple.
    • For example, on an RPM-based system:
      # sudo rpm -ivh datacenter-gpu-manager_xxx-1_x86_64.rpm 
    • For DGX-2 systems, a different package which includes the Fabric Manager module is required:
      # sudo rpm -ivh datacenter-gpu-manager-fabricmanager_xxx-1_x86_64.rpm
    • Installing DCGM on a Debian-based system is similar using dpkg:
      # sudo dpkg –i datacenter-gpu-manager_xxx-1_amd64.deb 
    • For DGX-2 systems, a different package which includes the Fabric Manager module is required:
      # sudo dpkg –i datacenter-gpu-manager-fabricmanager_xxx-1_amd64.deb 

To verify installation, start the standalone host engine and use dcgmi to query the system. You should see a listing of all supported GPUs:

# nv-hostengine 
Starting host engine using port number : 5555 

# dcgmi discovery -l 
2 GPUs found. 
+--------+-------------------------------------------------------------------+ 
| GPU ID | Device Information                                                | 
+========+===================================================================+ 
| 0      | Name: Tesla K80                                                   |
|        | PCI Bus ID: 0000:07:00.0                                          | 
|        | Device UUID: GPU-000000000000000000000000000000000000             | 
+--------+-------------------------------------------------------------------+ 
| 1      | Name: Tesla K80                                                   | 
|        | PCI Bus ID: 0000:08:00.0                                          | 
|        | Device UUID: GPU-111111111111111111111111111111111115             |
+--------+-------------------------------------------------------------------+ 

# nv-hostengine –t 
Host engine successfully terminated. 

Basic Components

DCGM shared library
The user space shared library, libdcgm.so, is the core component of DCGM. This library implements the major underlying functionality and exposes this as a set of C-based APIs. It sits on top of the NVIDIA driver, NVML, and the CUDA Toolkit.
NVIDIA Host Engine
The NVIDIA host engine, nv-hostengine, is a thin wrapper around the DCGM shared library. Its main job is to instantiate the DCGM library as a persistent standalone process, including appropriate management of the monitoring and management activities.
Note:
  • DCGM can run as root or non-root. Some DCGM functionality, such as configuration management, are not allowed to be run as non-root.
  • On DGX-2, nv-hostengine must run as root to enable the Fabric Manager.
DCGM CLI Tool
The command line interface to DCGM, dcgmi, is a network-capable interface into the NVIDIA host engine. It exposes much of the DCGM functionality in a simple, interactive format. It is intended for users and admins who want to control DCGM, or gather relevant data, without needing to build against the programmatic interfaces. It is not intended for scripting.
Python Bindings
The Python bindings are included with the DCGM package and installed in /usr/src/dcgm/bindings.
Software Development Kit
The DCGM SDK includes examples of how to leverage major DCGM features, alongside API documentation and headers. The SDK includes coverage for both C and Python based APIs, and include examples for using DCGM in both standalone and embedded modes.
These are installed in /usr/src/dcgm/sdk_samples.

Modes of Operation

The core DCGM library can be run as a standalone process or be loaded by an agent as a shared library. In both cases it provides roughly the same class of functionality and has the same overall behavior. The choice of mode depends on how it best fits within the user’s existing environment.

Note: In both modes the DCGM library should be run as root. Many features will not work without privileged access to the GPU, including various configuration settings and diagnostics.

Embedded Mode

In this mode the agent is loaded as a shared library. This mode is provided for the following situations:

  • A 3rd-party agent already exists on the node, and
  • Extra jitter associated with an additional autonomous agent needs to be managed
By loading DCGM as a shared library and managing the timing of its activity, 3rd-party agents can control exactly when DCGM is actively using CPU and GPU resources.

In this mode the 3rd-party agent should generally load the shared library at system initialization and manage the DCGM infrastructure over the lifetime of the host. Since DCGM is stateful, it is important that the library is maintained over the life of the 3rd-party agent, not invoked in a one-off fashion. In this mode all data gathering loops, management activities, etc. can be explicitly invoked and controlled via library interfaces. A 3rd-party agent may choose, for example, to synchronize DCGM activities across an entire multi-node job in this way.

CAUTION:
In this mode it is important that the various DCGM management interfaces be executed by the 3rd-party within the designated frequency ranges, as described in the API definitions. Running too frequently will waste resources with no noticeable gain. Running too infrequently will allow for gaps in monitoring and management coverage.
Working in this mode requires a sequence of setup steps and a management thread within the 3rd-party agent that periodically triggers all necessary DCGM background work. The logic is roughly as follows:
  • On Agent Startup
    dcgmInit() 
    
    System or job-level setup, e.g. 
    call dcgmGroupCreate() to set up GPU groups 
    call dcgmWatchFields() to manage watched metrics 
    call dcgmPolicySet() to set policy 
  • Periodic Background Tasks (managed)
    Trigger system management behavior, i.e.
     call dcgmUpdateAllFields() to manage metrics
     call dcgmPolicyTrigger() to manage policies 
    
    Gather system data, e.g.
     call dcgmHealthCheck() to check health
     call dcgmGetLatestValues() to get metric updates 
  • On Agent Shutdown
    dcgmShutdown()
Note: For a more complete example see the Embedded Mode example in the DCGM SDK

Standalone Mode

In this mode the DCGM agent is embedded in a simple daemon provided by NVIDIA, the NVIDIA Host Engine. This mode is provided for the following situations:
  • DCGM clients prefer to interact with a daemon rather than manage a shared library resource themselves
  • Multiple clients wish to interact with DCGM, rather than a single node agent
  • Users wish to leverage the NVIDIA CLI tool, DCGMI
  • Users of DGX-2 systems will need to run the Host Engine daemon to configure and monitor the NVSwitches
Generally, NVIDIA prefers this mode of operation, as it provides the most flexibility and lowest maintenance cost to users. In this mode the DCGM library management routines are invoked transparently at default frequencies and with default behaviors, in contrast to the user control provided by the Embedded Mode. Users can either leverage DCGMI tool to interact with the daemon process or load the DCGM library with daemon’s IP address during initialization for programmatic interaction.
The daemon leverages a socket-based interface to speak with external processes, e.g. DCGMI. Users are responsible for configuring the system initialization behavior, post DCGM install, to ensure the daemon is properly executed on startup.
Note:
  • Helper installation scripts for daemon setup will be included in the next Release Candidate package.
  • On DGX-2 systems, nv-hostengine is automatically started at system boot time, so that the Fabric Manager can configure and monitor the NVSwitches.

Static Library

A statically-linked stub version of the DCGM library has been included for the purposes of being able to remove an explicit dependency on the DCGM shared library. This library provides wrappers to the DCGM symbols and uses dlopen() to dynamically access libdcgm.so. If the shared library is not installed, or cannot be found in the LD_LIBRARY_PATH, an error code is returned. When linking against this library libdl must be included in the compile line which is typically done using:

# gcc foo.c –o foo –ldcgm_stub -ldl