Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pkg/dcgm/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ func GetAllDeviceCount() (uint, error) {
return getAllDeviceCount()
}

// GetHostEngineBuildInfo returns DCGM Host Engine build information including
// version number, build date, and build flags
func GetHostEngineBuildInfo() (string, error) {
return getHostEngineBuildInfo()
}

// GetEntityGroupEntities returns all entities of the specified group type
func GetEntityGroupEntities(entityGroup Field_Entity_Group) ([]uint, error) {
return getEntityGroupEntities(entityGroup)
Expand Down
14 changes: 14 additions & 0 deletions pkg/dcgm/hostengine_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package dcgm
import "C"

import (
"fmt"
"unsafe"
)

Expand All @@ -19,6 +20,19 @@ type Status struct {
CPU float64
}

func getHostEngineBuildInfo() (string, error) {
var versionInfo C.dcgmVersionInfo_v2
versionInfo.version = makeVersion2(unsafe.Sizeof(versionInfo))

result := C.dcgmHostengineVersionInfo(handle.handle, &versionInfo)
if err := errorString(result); err != nil {
return "", fmt.Errorf("error getting hostengine version: %s", err)
}

versionStr := C.GoString(&versionInfo.rawBuildInfoString[0]) // no need for stringPtr
return versionStr, nil
}

func introspect() (engine Status, err error) {
var memory C.dcgmIntrospectMemory_t
memory.version = makeVersion1(unsafe.Sizeof(memory))
Expand Down