Skip to content

furiosa-ai/furiosa-smi-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Furiosa System Management Interface Go Binding

Overview

Furiosa System Management Interface, is a programmatic interface for managing and monitoring FuriosaAI NPUs.

The interface provides the following API modules, each designed to offer distinct functionalities for managing and monitoring NPU devices. These modules enable developers to access essential hardware information, topology details, system-wide information, and performance metrics.

Each module provides the following features:

  • Device module provides NPU device discovery and information including device specification and liveness.

  • Topology module provides the topology status within a system including device-to-device link type and p2p accessibility.

  • System module provides system-wide information of each NPU device, including firmware version and driver version.

  • Performance module provides the device performance metrics including power consumption, temperature, and utilization.

Installation

furiosa-smi-go is available on the Go Packages.

go get github.com/furiosa-ai/furiosa-smi-go@latest

Once installed, you can import the furiosa-smi-go module:

import "github.com/furiosa-ai/furiosa-smi-go/pkg/smi"

Usage

To get started with furiosa-smi-go, simply import the furiosa-smi-go package and utilize its functions to interact with NPU devices.

The package provides various methods to access the NPU device information and status.

package main

import (
	"fmt"
	"os"

	"github.com/furiosa-ai/furiosa-smi-go/pkg/smi"
)

func main() {
	devices, err := smi.ListDevices()
	if err != nil {
		fmt.Printf("%s\n", err.Error())
		os.Exit(1)
	}

	fmt.Printf("found %d device(s)\n", len(devices))

	for _, device := range devices {
		deviceInfo, err := device.DeviceInfo()
		if err != nil {
			fmt.Println(err.Error())
			os.Exit(1)
		}

		fmt.Printf("Device Arch: %v\n", deviceInfo.Arch())
		fmt.Printf("Device CoreNum: %d\n", deviceInfo.CoreNum())
		fmt.Printf("Device NumaNode: %d\n", deviceInfo.NumaNode())
		fmt.Printf("Device Name: %s\n", deviceInfo.Name())
		
		// ... You can use other APIs. Please refer to the documentation.
	}
}

The expected output is as below.

found 1 device(s)
Device Arch: 8
Device CoreNum: 0
Device NumaNode: 0
Device Name: /rngd/npu0

...

You can refer to the example go programs for more usage.