NVML API Reference Guide (PDF) - vR331 (older) - Last updated March 14, 2014 - Send Feedback

## 4.12. Device Commands

This chapter describes NVML operations that change the state of the device. Each of these requires root/admin access. Non-admin users will see an NVML_ERROR_NO_PERMISSION error code when invoking any of these methods.

### Functions

nvmlReturn_t nvmlDeviceClearEccErrorCounts ( nvmlDevice_t device, nvmlEccCounterType_t counterType )
nvmlReturn_t nvmlDeviceSetAPIRestriction ( nvmlDevice_t device, nvmlRestrictedAPI_t apiType, nvmlEnableState_t isRestricted )
nvmlReturn_t nvmlDeviceSetApplicationsClocks ( nvmlDevice_t device, unsigned int memClockMHz, unsigned int graphicsClockMHz )
nvmlReturn_t nvmlDeviceSetComputeMode ( nvmlDevice_t device, nvmlComputeMode_t mode )
nvmlReturn_t nvmlDeviceSetDriverModel ( nvmlDevice_t device, nvmlDriverModel_t driverModel, unsigned int flags )
nvmlReturn_t nvmlDeviceSetEccMode ( nvmlDevice_t device, nvmlEnableState_t ecc )
nvmlReturn_t nvmlDeviceSetGpuOperationMode ( nvmlDevice_t device, nvmlGpuOperationMode_t mode )
nvmlReturn_t nvmlDeviceSetPersistenceMode ( nvmlDevice_t device, nvmlEnableState_t mode )
nvmlReturn_t nvmlDeviceSetPowerManagementLimit ( nvmlDevice_t device, unsigned int limit )

### Functions

nvmlReturn_t nvmlDeviceClearEccErrorCounts ( nvmlDevice_t device, nvmlEccCounterType_t counterType )

  ###### Parameters

  `device`
    The identifier of the target device
  `counterType`
    Flag that indicates which type of errors should be cleared.

  ###### Returns

  - NVML_SUCCESS if the error counts were cleared
  - NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  - NVML_ERROR_INVALID_ARGUMENT if device is invalid or counterType is invalid
  - NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  - NVML_ERROR_NO_PERMISSION if the user doesn't have permission to perform this operation
  - 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

  Clear the ECC error and other memory error counts for the device.

  For Tesla and Quadro products from the Fermi and Kepler families. Requires NVML_INFOROM_ECC version 2.0 or higher to clear aggregate location-based ECC counts. Requires NVML_INFOROM_ECC version 1.0 or higher to clear all other ECC counts. Requires root/admin permissions. Requires ECC Mode to be enabled.

  Sets all of the specified ECC counters to 0, including both detailed and total counts.

  This operation takes effect immediately.

  See nvmlMemoryErrorType_t for details on available counter types.

  See also:

  - nvmlDeviceGetDetailedEccErrors()

  - nvmlDeviceGetTotalEccErrors()

nvmlReturn_t nvmlDeviceSetAPIRestriction ( nvmlDevice_t device, nvmlRestrictedAPI_t apiType, nvmlEnableState_t isRestricted )

  ###### Parameters

  `device`
    The identifier of the target device
  `apiType`
    Target API type for this operation
  `isRestricted`
    The target restriction

  ###### Returns

  - NVML_SUCCESS if isRestricted has been set
  - NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  - NVML_ERROR_INVALID_ARGUMENT if device is invalid or apiType incorrect
  - NVML_ERROR_NOT_SUPPORTED if the device does not support changing API restrictions
  - NVML_ERROR_NO_PERMISSION if the user doesn't have permission to perform this operation
  - 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

  Changes the root/admin restructions on certain APIs. See nvmlRestrictedAPI_t for the list of supported APIs. This method can be used by a root/admin user to give non-root/admin access to certain otherwise-restricted APIs. The new setting lasts for the lifetime of the NVIDIA driver; it is not persistent. See nvmlDeviceGetAPIRestriction to query the current restriction settings.

  For Tesla and Quadro &tm products from the Kepler+ family. Requires root/admin permissions.

  See also:

  nvmlRestrictedAPI_t

nvmlReturn_t nvmlDeviceSetApplicationsClocks ( nvmlDevice_t device, unsigned int memClockMHz, unsigned int graphicsClockMHz )

  ###### Parameters

  `device`
    The identifier of the target device
  `memClockMHz`
    Requested memory clock in MHz
  `graphicsClockMHz`
    Requested graphics clock in MHz

  ###### Returns

  - NVML_SUCCESS if new settings were successfully set
  - NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  - NVML_ERROR_INVALID_ARGUMENT if device is invalid or memClockMHz and graphicsClockMHz is not a valid clock combination
  - NVML_ERROR_NO_PERMISSION if the user doesn't have permission to perform this operation
  - NVML_ERROR_NOT_SUPPORTED if the device doesn't support this feature
  - 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

  Set clocks that applications will lock to.

  Sets the clocks that compute and graphics applications will be running at. e.g. CUDA driver requests these clocks during context creation which means this property defines clocks at which CUDA applications will be running unless some overspec event occurs (e.g. over power, over thermal or external HW brake).

  Can be used as a setting to request constant performance.

  For Tesla products from the Kepler family. Requires root/admin permissions.

  See nvmlDeviceGetSupportedMemoryClocks and nvmlDeviceGetSupportedGraphicsClocks for details on how to list available clocks combinations.

  After system reboot or driver reload applications clocks go back to their default value. See nvmlDeviceResetApplicationsClocks.

nvmlReturn_t nvmlDeviceSetComputeMode ( nvmlDevice_t device, nvmlComputeMode_t mode )

  ###### Parameters

  `device`
    The identifier of the target device
  `mode`
    The target compute mode

  ###### Returns

  - NVML_SUCCESS if the compute mode was set
  - NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  - NVML_ERROR_INVALID_ARGUMENT if device is invalid or mode is invalid
  - NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  - NVML_ERROR_NO_PERMISSION if the user doesn't have permission to perform this operation
  - 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

  Set the compute mode for the device.

  For all CUDA-capable products. Requires root/admin permissions.

  The compute mode determines whether a GPU can be used for compute operations and whether it can be shared across contexts.

  This operation takes effect immediately. Under Linux it is not persistent across reboots and always resets to "Default". Under windows it is persistent.

  Under windows compute mode may only be set to DEFAULT when running in WDDM

  See nvmlComputeMode_t for details on available compute modes.

  See also:

  nvmlDeviceGetComputeMode()

nvmlReturn_t nvmlDeviceSetDriverModel ( nvmlDevice_t device, nvmlDriverModel_t driverModel, unsigned int flags )

  ###### Parameters

  `device`
    The identifier of the target device
  `driverModel`
    The target driver model
  `flags`
    Flags that change the default behavior

  ###### Returns

  - NVML_SUCCESS if the driver model has been set
  - NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  - NVML_ERROR_INVALID_ARGUMENT if device is invalid or driverModel is invalid
  - NVML_ERROR_NOT_SUPPORTED if the platform is not windows or the device does not support this feature
  - NVML_ERROR_NO_PERMISSION if the user doesn't have permission to perform this operation
  - 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

  Set the driver model for the device.

  For Tesla and Quadro products from the Fermi and Kepler families. For windows only. Requires root/admin permissions.

  On Windows platforms the device driver can run in either WDDM or WDM (TCC) mode. If a display is attached to the device it must run in WDDM mode.

  It is possible to force the change to WDM (TCC) while the display is still attached with a force flag (nvmlFlagForce). This should only be done if the host is subsequently powered down and the display is detached from the device before the next reboot.

  This operation takes effect after the next reboot.

  Windows driver model may only be set to WDDM when running in DEFAULT compute mode.

  Change driver model to WDDM is not supported when GPU doesn't support graphics acceleration or will not support it after reboot. See nvmlDeviceSetGpuOperationMode.

  See nvmlDriverModel_t for details on available driver models. See nvmlFlagDefault and nvmlFlagForce

  See also:

  nvmlDeviceGetDriverModel()

nvmlReturn_t nvmlDeviceSetEccMode ( nvmlDevice_t device, nvmlEnableState_t ecc )

  ###### Parameters

  `device`
    The identifier of the target device
  `ecc`
    The target ECC mode

  ###### Returns

  - NVML_SUCCESS if the ECC mode was set
  - NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  - NVML_ERROR_INVALID_ARGUMENT if device is invalid or ecc is invalid
  - NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  - NVML_ERROR_NO_PERMISSION if the user doesn't have permission to perform this operation
  - 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

  Set the ECC mode for the device.

  For Tesla and Quadro products from the Fermi and Kepler families. Requires NVML_INFOROM_ECC version 1.0 or higher. Requires root/admin permissions.

  The ECC mode determines whether the GPU enables its ECC support.

  This operation takes effect after the next reboot.

  See nvmlEnableState_t for details on available modes.

  See also:

  nvmlDeviceGetEccMode()

nvmlReturn_t nvmlDeviceSetGpuOperationMode ( nvmlDevice_t device, nvmlGpuOperationMode_t mode )

  ###### Parameters

  `device`
    The identifier of the target device
  `mode`
    Target GOM

  ###### Returns

  - NVML_SUCCESS if mode has been set
  - NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  - NVML_ERROR_INVALID_ARGUMENT if device is invalid or mode incorrect
  - NVML_ERROR_NOT_SUPPORTED if the device does not support GOM or specific mode
  - NVML_ERROR_NO_PERMISSION if the user doesn't have permission to perform this operation
  - 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

  Sets new GOM. See nvmlGpuOperationMode_t for details.

  For GK110 M-class and X-class Tesla products from the Kepler family. Not supported on Quadro and Tesla C-class products. Requires root/admin permissions.

  Changing GOMs requires a reboot. The reboot requirement might be removed in the future.

  Compute only GOMs don't support graphics acceleration. Under windows switching to these GOMs when pending driver model is WDDM is not supported. See nvmlDeviceSetDriverModel.

  See also:

  nvmlGpuOperationMode_t

  nvmlDeviceGetGpuOperationMode

nvmlReturn_t nvmlDeviceSetPersistenceMode ( nvmlDevice_t device, nvmlEnableState_t mode )

  ###### Parameters

  `device`
    The identifier of the target device
  `mode`
    The target persistence mode

  ###### Returns

  - NVML_SUCCESS if the persistence mode was set
  - NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  - NVML_ERROR_INVALID_ARGUMENT if device is invalid or mode is invalid
  - NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  - NVML_ERROR_NO_PERMISSION if the user doesn't have permission to perform this operation
  - 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

  Set the persistence mode for the device.

  For all CUDA-capable products. For Linux only. Requires root/admin permissions.

  The persistence mode determines whether the GPU driver software is torn down after the last client exits.

  This operation takes effect immediately. It is not persistent across reboots. After each reboot the persistence mode is reset to "Disabled".

  See nvmlEnableState_t for available modes.

  See also:

  nvmlDeviceGetPersistenceMode()

nvmlReturn_t nvmlDeviceSetPowerManagementLimit ( nvmlDevice_t device, unsigned int limit )

  ###### Parameters

  `device`
    The identifier of the target device
  `limit`
    Power management limit in milliwatts to set

  ###### Returns

  - NVML_SUCCESS if limit has been set
  - NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  - NVML_ERROR_INVALID_ARGUMENT if device is invalid or defaultLimit is out of range
  - NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  - 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

  Set new power limit of this device.

  For Tesla and Quadro products from the Kepler family. Requires root/admin permissions.

  See nvmlDeviceGetPowerManagementLimitConstraints to check the allowed ranges of values.

  Note:

  Limit is not persistent across reboots or driver unloads. Enable persistent mode to prevent driver from unloading when no application is using the device.

  See also:

  nvmlDeviceGetPowerManagementLimitConstraints

  nvmlDeviceGetPowerManagementDefaultLimit

NVML API Reference Guide (PDF) - vR331 (older) - Last updated March 14, 2014 - Send Feedback