ascenddcmi

package module
v0.5.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

README

ascend-dcmi

Ascend DaVinci Card Management Interface (DCMI), golang wrapped version.

the repo source code from: https://github.com/Ascend/ascend-npu-exporter

Documentation

Overview

Package dcmi this for constants

Package dcmi this for dcmi manager

Index

Constants

View Source
const (

	// MainCmdVDevMng virtual device manager
	MainCmdVDevMng MainCmd = 52

	// VmngSubCmdGetVDevResource get virtual device resource info
	VmngSubCmdGetVDevResource VDevMngSubCmd = 0
	// VmngSubCmdGetTotalResource get total resource info
	VmngSubCmdGetTotalResource VDevMngSubCmd = 1
	// VmngSubCmdGetFreeResource get free resource info
	VmngSubCmdGetFreeResource VDevMngSubCmd = 2

	// NDIE NDie ID, only Ascend910 has
	NDIE DcmiDieType = 0
	// VDIE VDie ID, it can be the uuid of chip
	VDIE DcmiDieType = 1
	// DieIDCount die id array max length
	DieIDCount = 5
)

Variables

This section is empty.

Functions

func FuncDcmiGetDeviceHbmInfo

func FuncDcmiGetDeviceHbmInfo(cardID, deviceID int32) (*common.HbmInfo, error)

FuncDcmiGetDeviceHbmInfo dcmi_get_device_hbm_info function for outer invoke, only for Ascend910

func FuncDcmiMcuGetPowerInfo

func FuncDcmiMcuGetPowerInfo(cardID int32) (float32, error)

FuncDcmiMcuGetPowerInfo dcmi_mcu_get_power_info_new function for outer invoke

Types

type CDcmiMemoryInfoV1

type CDcmiMemoryInfoV1 = C.struct_dcmi_memory_info_stru

CDcmiMemoryInfoV1 the c struct of memoryInfo for v1

type CDcmiMemoryInfoV3

type CDcmiMemoryInfoV3 = C.struct_dcmi_get_memory_info_stru

CDcmiMemoryInfoV3 the c struct of memoryInfo for v3

type DcDriverInterface

type DcDriverInterface interface {
	DcInit() error
	DcShutDown() error

	DcGetDeviceCount() (int32, error)
	DcGetLogicIDList() (int32, []int32, error)
	DcGetDeviceHealth(int32, int32) (int32, error)
	DcGetDeviceNetWorkHealth(int32, int32) (uint32, error)
	DcGetDeviceUtilizationRate(int32, int32, common.DeviceType) (int32, error)
	DcGetDeviceTemperature(int32, int32) (int32, error)
	DcGetDeviceVoltage(int32, int32) (float32, error)
	DcGetDevicePowerInfo(int32, int32) (float32, error)
	DcGetDeviceFrequency(int32, int32, common.DeviceType) (uint32, error)
	DcGetMemoryInfo(int32, int32) (*common.MemoryInfo, error)
	DcGetHbmInfo(int32, int32) (*common.HbmInfo, error)
	DcGetDeviceErrorCode(int32, int32) (int32, int64, error)
	DcGetChipInfo(int32, int32) (*common.ChipInfo, error)
	DcGetPhysicIDFromLogicID(int32) (int32, error)
	DcGetLogicIDFromPhysicID(int32) (int32, error)
	DcGetDeviceLogicID(int32, int32) (int32, error)
	DcGetDeviceIPAddress(int32, int32) (string, error)
	DcGetMcuPowerInfo(int32) (float32, error)
	DcGetDieID(int32, int32, DcmiDieType) (string, error)

	DcGetCardList() (int32, []int32, error)
	DcGetDeviceNumInCard(int32) (int32, error)
	DcSetDestroyVirtualDevice(int32, int32, uint32) error
	DcCreateVirtualDevice(int32, int32, common.CgoCreateVDevRes) (common.CgoCreateVDevOut, error)
	DcGetDeviceVDevResource(int32, int32, uint32) (common.CgoVDevQueryStru, error)
	DcGetDeviceTotalResource(int32, int32) (common.CgoSocTotalResource, error)
	DcGetDeviceFreeResource(int32, int32) (common.CgoSocFreeResource, error)
	DcVGetDeviceInfo(int32, int32) (common.VirtualDevInfo, error)
	DcGetCardIDDeviceID(int32) (int32, int32, error)
	DcCreateVDevice(int32, common.CgoCreateVDevRes) (common.CgoCreateVDevOut, error)
	DcGetVDeviceInfo(int32) (common.VirtualDevInfo, error)
	DcDestroyVDevice(int32, uint32) error
	DcGetProductType(int32, int32) (string, error)
	DcGetNpuWorkMode(int32) (int, error)
	DcSetDeviceReset(int32, int32) error
	DcGetDeviceBootStatus(int32) (int, error)

	DcGetDeviceAllErrorCode(int32, int32) (int32, []int64, error)
	DcSubscribeDeviceFaultEvent(int32, int32) error
	DcSetFaultEventCallFunc(func(common.DevFaultInfo))
	DcGetDevProcessInfo(int32, int32) (*common.DevProcessInfo, error)
}

DcDriverInterface interface for dcmi

type DcManager

type DcManager struct{}

DcManager for manager dcmi interface

func (*DcManager) DcCreateVDevice

func (d *DcManager) DcCreateVDevice(logicID int32, vDevInfo common.CgoCreateVDevRes) (common.
	CgoCreateVDevOut, error)

DcCreateVDevice create virtual device by logic id

func (*DcManager) DcCreateVirtualDevice

func (d *DcManager) DcCreateVirtualDevice(cardID, deviceID int32, vDevInfo common.CgoCreateVDevRes) (common.
	CgoCreateVDevOut, error)

DcCreateVirtualDevice create virtual device

func (*DcManager) DcDestroyVDevice

func (d *DcManager) DcDestroyVDevice(logicID int32, vDevID uint32) error

DcDestroyVDevice destroy spec virtual device by logic id

func (*DcManager) DcGetCardIDDeviceID

func (d *DcManager) DcGetCardIDDeviceID(logicID int32) (int32, int32, error)

DcGetCardIDDeviceID get card id and device id from logic id

func (*DcManager) DcGetCardList

func (d *DcManager) DcGetCardList() (int32, []int32, error)

DcGetCardList get card list

func (*DcManager) DcGetChipInfo

func (d *DcManager) DcGetChipInfo(cardID, deviceID int32) (*common.ChipInfo, error)

DcGetChipInfo get the chip info by cardID and deviceID

func (*DcManager) DcGetDevProcessInfo

func (d *DcManager) DcGetDevProcessInfo(cardID, deviceID int32) (*common.DevProcessInfo, error)

DcGetDevProcessInfo chip process info

func (*DcManager) DcGetDeviceAllErrorCode

func (d *DcManager) DcGetDeviceAllErrorCode(cardID, deviceID int32) (int32, []int64, error)

DcGetDeviceAllErrorCode get the error count and all error codes of the device

func (*DcManager) DcGetDeviceBootStatus

func (d *DcManager) DcGetDeviceBootStatus(logicID int32) (int, error)

DcGetDeviceBootStatus get NPU boot status

func (*DcManager) DcGetDeviceCount

func (d *DcManager) DcGetDeviceCount() (int32, error)

DcGetDeviceCount get device count

func (*DcManager) DcGetDeviceErrorCode

func (d *DcManager) DcGetDeviceErrorCode(cardID, deviceID int32) (int32, int64, error)

DcGetDeviceErrorCode get the error count and errorcode of the device,only return the first errorcode

func (*DcManager) DcGetDeviceFreeResource

func (d *DcManager) DcGetDeviceFreeResource(cardID, deviceID int32) (common.CgoSocFreeResource, error)

DcGetDeviceFreeResource get device free resource info

func (*DcManager) DcGetDeviceFrequency

func (d *DcManager) DcGetDeviceFrequency(cardID, deviceID int32, devType common.DeviceType) (uint32, error)

DcGetDeviceFrequency get device frequency, unit MHz Ascend910B with frequency type: 2,6,7,9 Ascend910 with frequency type: 2,6,7,9 Ascend310 with frequency type: 1,2,6,7,9 Ascend310P with frequency type: 1,2,7,9,12 more information see common.DeviceType

func (*DcManager) DcGetDeviceHealth

func (d *DcManager) DcGetDeviceHealth(cardID, deviceID int32) (int32, error)

DcGetDeviceHealth get device health

func (*DcManager) DcGetDeviceIPAddress

func (d *DcManager) DcGetDeviceIPAddress(cardID, deviceID int32) (string, error)

DcGetDeviceIPAddress get device IP address by cardID and deviceID

func (*DcManager) DcGetDeviceLogicID

func (d *DcManager) DcGetDeviceLogicID(cardID, deviceID int32) (int32, error)

DcGetDeviceLogicID get device logicID

func (*DcManager) DcGetDeviceNetWorkHealth

func (d *DcManager) DcGetDeviceNetWorkHealth(cardID, deviceID int32) (uint32, error)

DcGetDeviceNetWorkHealth get device network health by cardID and deviceID

func (*DcManager) DcGetDeviceNumInCard

func (d *DcManager) DcGetDeviceNumInCard(cardID int32) (int32, error)

DcGetDeviceNumInCard get device number in the npu card

func (*DcManager) DcGetDevicePowerInfo

func (d *DcManager) DcGetDevicePowerInfo(cardID, deviceID int32) (float32, error)

DcGetDevicePowerInfo the accuracy is 0.1w, the result like: 8.2

func (*DcManager) DcGetDeviceTemperature

func (d *DcManager) DcGetDeviceTemperature(cardID, deviceID int32) (int32, error)

DcGetDeviceTemperature get the device temperature

func (*DcManager) DcGetDeviceTotalResource

func (d *DcManager) DcGetDeviceTotalResource(cardID, deviceID int32) (common.CgoSocTotalResource, error)

DcGetDeviceTotalResource get device total resource info

func (*DcManager) DcGetDeviceUtilizationRate

func (d *DcManager) DcGetDeviceUtilizationRate(cardID, deviceID int32, devType common.DeviceType) (int32, error)

DcGetDeviceUtilizationRate get device utils rate by id

func (*DcManager) DcGetDeviceVDevResource

func (d *DcManager) DcGetDeviceVDevResource(cardID, deviceID int32, vDevID uint32) (common.CgoVDevQueryStru, error)

DcGetDeviceVDevResource get virtual device resource info

func (*DcManager) DcGetDeviceVoltage

func (d *DcManager) DcGetDeviceVoltage(cardID, deviceID int32) (float32, error)

DcGetDeviceVoltage the accuracy is 0.01v.

func (*DcManager) DcGetDieID

func (d *DcManager) DcGetDieID(cardID, deviceID int32, dcmiDieType DcmiDieType) (string, error)

DcGetDieID get chip die ID, like VDieID or NDieID, only Ascend910 has NDieID

func (*DcManager) DcGetHbmInfo

func (d *DcManager) DcGetHbmInfo(cardID, deviceID int32) (*common.HbmInfo, error)

DcGetHbmInfo get HBM information A310/A310P not support

func (*DcManager) DcGetLogicIDFromPhysicID

func (d *DcManager) DcGetLogicIDFromPhysicID(physicID int32) (int32, error)

DcGetLogicIDFromPhysicID get logicID from physicID

func (*DcManager) DcGetLogicIDList

func (d *DcManager) DcGetLogicIDList() (int32, []int32, error)

DcGetLogicIDList get device logic id list

func (*DcManager) DcGetMcuPowerInfo

func (d *DcManager) DcGetMcuPowerInfo(cardID int32) (float32, error)

DcGetMcuPowerInfo this function is only for Ascend310P, A910/A310 not support

func (*DcManager) DcGetMemoryInfo

func (d *DcManager) DcGetMemoryInfo(cardID, deviceID int32) (*common.MemoryInfo, error)

DcGetMemoryInfo use v3 interface to query memory info

func (*DcManager) DcGetNpuWorkMode

func (d *DcManager) DcGetNpuWorkMode(cardID int32) (int, error)

DcGetNpuWorkMode get npu work mode, this function is only for Ascend910, A310/310P not support

func (*DcManager) DcGetPhysicIDFromLogicID

func (d *DcManager) DcGetPhysicIDFromLogicID(logicID int32) (int32, error)

DcGetPhysicIDFromLogicID get physicID from logicID

func (*DcManager) DcGetProductType

func (d *DcManager) DcGetProductType(cardID, deviceID int32) (string, error)

DcGetProductType get product type by dcmi interface

func (*DcManager) DcGetVDeviceInfo

func (d *DcManager) DcGetVDeviceInfo(logicID int32) (common.VirtualDevInfo, error)

DcGetVDeviceInfo get virtual device info by logic id

func (*DcManager) DcInit

func (d *DcManager) DcInit() error

DcInit load symbol and initialize dcmi

func (*DcManager) DcSetDestroyVirtualDevice

func (d *DcManager) DcSetDestroyVirtualDevice(cardID, deviceID int32, vDevID uint32) error

DcSetDestroyVirtualDevice destroy virtual device

func (*DcManager) DcSetDeviceReset

func (d *DcManager) DcSetDeviceReset(cardID, deviceID int32) error

DcSetDeviceReset reset spec device chip

func (*DcManager) DcSetFaultEventCallFunc

func (d *DcManager) DcSetFaultEventCallFunc(businessFunc func(common.DevFaultInfo))

DcSetFaultEventCallFunc set fault event call back func

func (*DcManager) DcShutDown

func (d *DcManager) DcShutDown() error

DcShutDown clean the dynamically loaded resource

func (*DcManager) DcSubscribeDeviceFaultEvent

func (d *DcManager) DcSubscribeDeviceFaultEvent(cardID, deviceID int32) error

DcSubscribeDeviceFaultEvent subscribe device fault, callback with func 'faultEventCallFunc'

func (*DcManager) DcVGetDeviceInfo

func (d *DcManager) DcVGetDeviceInfo(cardID, deviceID int32) (common.VirtualDevInfo, error)

DcVGetDeviceInfo get vdevice resource info

type DcmiDieType

type DcmiDieType int32

DcmiDieType present chip die type

type MainCmd

type MainCmd uint32

MainCmd main command enum

type VDevMngSubCmd

type VDevMngSubCmd uint32

VDevMngSubCmd virtual device manager sub command

Directories

Path Synopsis
Package cache implement a memory-based LRU local cache
Package cache implement a memory-based LRU local cache
Package common define common variable
Package common define common variable
Package hwlog provides the capability of processing Huawei log rules.
Package hwlog provides the capability of processing Huawei log rules.
Package utils provides the util func
Package utils provides the util func

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL