NVML API Reference Guide (PDF) - vR340 (older) - Last updated July 1, 2014 - Send Feedback

## 4.13. Event Handling Methods

This chapter describes methods that NVML can perform against each device to register and wait for some event to occur.

### Modules

Event Types

### Classes

struct
nvmlEventData_t

### Typedefs

typedef nvmlEventSet_st * nvmlEventSet_t

### Functions

nvmlReturn_t nvmlDeviceGetSupportedEventTypes ( nvmlDevice_t device, unsigned long long* eventTypes )
nvmlReturn_t nvmlDeviceRegisterEvents ( nvmlDevice_t device, unsigned long long eventTypes, nvmlEventSet_t set )
nvmlReturn_t nvmlEventSetCreate ( nvmlEventSet_t* set )
nvmlReturn_t nvmlEventSetFree ( nvmlEventSet_t set )
nvmlReturn_t nvmlEventSetWait ( nvmlEventSet_t set, nvmlEventData_t* data, unsigned int timeoutms )

### Typedefs

typedef nvmlEventSet_st * nvmlEventSet_t

  Handle to an event set

### Functions

nvmlReturn_t nvmlDeviceGetSupportedEventTypes ( nvmlDevice_t device, unsigned long long* eventTypes )

  ###### Parameters

  `device`
    The identifier of the target device
  `eventTypes`
    Reference in which to return bitmask of supported events

  ###### Returns

  - NVML_SUCCESS if the eventTypes has been set
  - NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  - NVML_ERROR_INVALID_ARGUMENT if eventType is NULL
  - NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  - NVML_ERROR_UNKNOWN on any unexpected error

  ###### Description

  Returns information about events supported on device

  For all products.

  Events are not supported on Windows. So this function returns an empty mask in eventTypes on Windows.

  See also:

  Event Types

  nvmlDeviceRegisterEvents

nvmlReturn_t nvmlDeviceRegisterEvents ( nvmlDevice_t device, unsigned long long eventTypes, nvmlEventSet_t set )

  ###### Parameters

  `device`
    The identifier of the target device
  `eventTypes`
    Bitmask of Event Types to record
  `set`
    Set to which add new event types

  ###### Returns

  - NVML_SUCCESS if the event has been set
  - NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  - NVML_ERROR_INVALID_ARGUMENT if eventTypes is invalid or set is NULL
  - NVML_ERROR_NOT_SUPPORTED if the platform does not support this feature or some of requested event types
  - NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  - NVML_ERROR_UNKNOWN on any unexpected error

  ###### Description

  Starts recording of events on a specified devices and add the events to specified nvmlEventSet_t

  For Tesla and Quadro products from the Fermi and Kepler families. Ecc events are available only on ECC enabled devices (see nvmlDeviceGetTotalEccErrors) Power capping events are available only on Power Management enabled devices (see nvmlDeviceGetPowerManagementMode)

  For Linux only.

  IMPORTANT: Operations on set are not thread safe

  This call starts recording of events on specific device. All events that occurred before this call are not recorded. Checking if some event occurred can be done with nvmlEventSetWait

  If function reports NVML_ERROR_UNKNOWN, event set is in undefined state and should be freed. If function reports NVML_ERROR_NOT_SUPPORTED, event set can still be used. None of the requested eventTypes are registered in that case.

  See also:

  Event Types

  nvmlDeviceGetSupportedEventTypes

  nvmlEventSetWait

  nvmlEventSetFree

nvmlReturn_t nvmlEventSetCreate ( nvmlEventSet_t* set )

  ###### Parameters

  `set`
    Reference in which to return the event handle

  ###### Returns

  - NVML_SUCCESS if the event has been set
  - NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  - NVML_ERROR_INVALID_ARGUMENT if set is NULL
  - NVML_ERROR_UNKNOWN on any unexpected error

  ###### Description

  Create an empty set of events. Event set should be freed by nvmlEventSetFree

  See also:

  nvmlEventSetFree

nvmlReturn_t nvmlEventSetFree ( nvmlEventSet_t set )

  ###### Parameters

  `set`
    Reference to events to be released

  ###### Returns

  - NVML_SUCCESS if the event has been successfully released
  - NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  - NVML_ERROR_UNKNOWN on any unexpected error

  ###### Description

  Releases events in the set

  For Tesla and Quadro products from the Fermi and Kepler families.

  See also:

  nvmlDeviceRegisterEvents

nvmlReturn_t nvmlEventSetWait ( nvmlEventSet_t set, nvmlEventData_t* data, unsigned int timeoutms )

  ###### Parameters

  `set`
    Reference to set of events to wait on
  `data`
    Reference in which to return event data
  `timeoutms`
    Maximum amount of wait time in milliseconds for registered event

  ###### Returns

  - NVML_SUCCESS if the data has been set
  - NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  - NVML_ERROR_INVALID_ARGUMENT if data is NULL
  - NVML_ERROR_TIMEOUT if no event arrived in specified timeout or interrupt arrived
  - NVML_ERROR_GPU_IS_LOST if a GPU has fallen off the bus or is otherwise inaccessible
  - NVML_ERROR_UNKNOWN on any unexpected error

  ###### Description

  Waits on events and delivers events

  For Tesla and Quadro products from the Fermi and Kepler families.

  If some events are ready to be delivered at the time of the call, function returns immediately. If there are no events ready to be delivered, function sleeps till event arrives but not longer than specified timeout. This function in certain conditions can return before specified timeout passes (e.g. when interrupt arrives)

  In case of xid error, the function returns the most recent xid error type seen by the system. If there are multiple xid errors generated before nvmlEventSetWait is invoked then the last seen xid error type is returned for all xid error events.

  See also:

  Event Types

  nvmlDeviceRegisterEvents

### Event Types

NVML API Reference Guide (PDF) - vR340 (older) - Last updated July 1, 2014 - Send Feedback