CPU and Memory Affinity(3)

NAME
CPU and Memory Affinity -

  Defines

#define NVML_AFFINITY_SCOPE_NODE 0
Scope of NUMA node for affinity queries.
#define NVML_AFFINITY_SCOPE_SOCKET 1
Scope of processor socket for affinity queries.

  Functions

nvmlReturn_t DECLDIR nvmlDeviceGetMemoryAffinity (nvmlDevice_t device, unsigned int nodeSetSize, unsigned long *nodeSet, nvmlAffinityScope_t scope)
nvmlReturn_t DECLDIR nvmlDeviceGetCpuAffinityWithinScope (nvmlDevice_t device, unsigned int cpuSetSize, unsigned long *cpuSet, nvmlAffinityScope_t scope)
nvmlReturn_t DECLDIR nvmlDeviceGetCpuAffinity (nvmlDevice_t device, unsigned int cpuSetSize, unsigned long *cpuSet)
nvmlReturn_t DECLDIR nvmlDeviceSetCpuAffinity (nvmlDevice_t device)
nvmlReturn_t DECLDIR nvmlDeviceClearCpuAffinity (nvmlDevice_t device)

Detailed Description

This chapter describes NVML operations that are associated with CPU and memory affinity.

Function Documentation

  nvmlReturn_t DECLDIR nvmlDeviceClearCpuAffinity (nvmlDevice_t device)

Clear all affinity bindings for the calling thread. Note, this is a change as of version 8.0 as older versions cleared the affinity for a calling process and all children.

For Kepler (TM) or newer fully supported devices. Supported on Linux only.

Parameters:
    device The identifier of the target device

Returns:

    •   NVML_SUCCESS if the calling process has been successfully unbound

    •   NVML_ERROR_INVALID_ARGUMENT if device is invalid

    •   NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized

    •   NVML_ERROR_UNKNOWN on any unexpected error

  nvmlReturn_t DECLDIR nvmlDeviceGetCpuAffinity (nvmlDevice_t device, unsigned int cpuSetSize, unsigned long * cpuSet)

Retrieves an array of unsigned ints (sized to cpuSetSize) of bitmasks with the ideal CPU affinity for the device For example, if processors 0, 1, 32, and 33 are ideal for the device and cpuSetSize == 2, result[0] = 0x3, result[1] = 0x3 This is equivalent to calling nvmlDeviceGetCpuAffinityWithinScope with NVML_AFFINITY_SCOPE_NODE.

For Kepler (TM) or newer fully supported devices. Supported on Linux only.

Parameters:
    device The identifier of the target device
    cpuSetSize The size of the cpuSet array that is safe to access
    cpuSet Array reference in which to return a bitmask of CPUs, 64 CPUs per unsigned long on 64-bit machines, 32 on 32-bit machines

Returns:

    •   NVML_SUCCESS if cpuAffinity has been filled

    •   NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized

    •   NVML_ERROR_INVALID_ARGUMENT if device is invalid, cpuSetSize == 0, or cpuSet is NULL

    •   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

  nvmlReturn_t DECLDIR nvmlDeviceGetCpuAffinityWithinScope (nvmlDevice_t device, unsigned int cpuSetSize, unsigned long * cpuSet, nvmlAffinityScope_t scope)

Retrieves an array of unsigned ints (sized to cpuSetSize) of bitmasks with the ideal CPU affinity within node or socket for the device. For example, if processors 0, 1, 32, and 33 are ideal for the device and cpuSetSize == 2, result[0] = 0x3, result[1] = 0x3

Note:
    If requested scope is not applicable to the target topology, the API will fall back to reporting the CPU affinity for the immediate non-I/O ancestor of the device.

For Kepler (TM) or newer fully supported devices. Supported on Linux only.

Parameters:
    device The identifier of the target device
    cpuSetSize The size of the cpuSet array that is safe to access
    cpuSet Array reference in which to return a bitmask of CPUs, 64 CPUs per unsigned long on 64-bit machines, 32 on 32-bit machines
    scope Scope that change the default behavior

Returns:

    •   NVML_SUCCESS if cpuAffinity has been filled

    •   NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized

    •   NVML_ERROR_INVALID_ARGUMENT if device is invalid, cpuSetSize == 0, cpuSet is NULL or sope is invalid

    •   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

  nvmlReturn_t DECLDIR nvmlDeviceGetMemoryAffinity (nvmlDevice_t device, unsigned int nodeSetSize, unsigned long * nodeSet, nvmlAffinityScope_t scope)

Retrieves an array of unsigned ints (sized to nodeSetSize) of bitmasks with the ideal memory affinity within node or socket for the device. For example, if NUMA node 0, 1 are ideal within the socket for the device and nodeSetSize == 1, result[0] = 0x3

Note:
    If requested scope is not applicable to the target topology, the API will fall back to reporting the memory affinity for the immediate non-I/O ancestor of the device.

For Kepler (TM) or newer fully supported devices. Supported on Linux only.

Parameters:
    device The identifier of the target device
    nodeSetSize The size of the nodeSet array that is safe to access
    nodeSet Array reference in which to return a bitmask of NODEs, 64 NODEs per unsigned long on 64-bit machines, 32 on 32-bit machines
    scope Scope that change the default behavior

Returns:

    •   NVML_SUCCESS if NUMA node Affinity has been filled

    •   NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized

    •   NVML_ERROR_INVALID_ARGUMENT if device is invalid, nodeSetSize == 0, nodeSet is NULL or scope is invalid

    •   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

  nvmlReturn_t DECLDIR nvmlDeviceSetCpuAffinity (nvmlDevice_t device)

Sets the ideal affinity for the calling thread and device using the guidelines given in nvmlDeviceGetCpuAffinity(). Note, this is a change as of version 8.0. Older versions set the affinity for a calling process and all children. Currently supports up to 1024 processors.

For Kepler (TM) or newer fully supported devices. Supported on Linux only.

Parameters:
    device The identifier of the target device

Returns:

    •   NVML_SUCCESS if the calling process has been successfully bound

    •   NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized

    •   NVML_ERROR_INVALID_ARGUMENT if device is invalid

    •   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

Author

Generated automatically by Doxygen for NVML from the source code.