Crate furiosa_smi_rs

Crate furiosa_smi_rs 

Source
Expand description

§Furiosa System Management Interface Rust 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.

The goal of the furiosa-smi-rs crate is to provide wrappers around the C furiosa-smi API.

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

Run the following Cargo command in your project directory:

cargo add furiosa-smi-rs

Or add the following line to your Cargo.toml:

furiosa-smi-rs = "0.1.0"

§Usage example

To get started with Furiosa-smi-rs, simply import the furiosa_smi_rs crate and utilize its functions to interact with NPU devices. The package provides various methods to access the NPU device information and status.

use furiosa_smi_rs::{Device, SmiResult};

fn main() -> SmiResult<()> {
    // Initialize the Furiosa SMI library.
    furiosa_smi_rs::init()?;

    // Retrieve a list of NPU devices in the system.
    let devices: Vec<Device> = furiosa_smi_rs::list_devices()?;

    for device in devices.iter() {
        // Acquire information about the NPU device.
        let device_info = device.device_info()?;
        println!("Device Info");
        println!("\t\tDevice Arch: {:?}", device_info.arch());
        println!("\t\tDevice Cores: {:?}", device_info.core_num());
    }

    // You can use other APIs. Please refer to the documentation.
    Ok(())
}

The expected output is as below.

Device Info
        Device Arch: Rngd
        Device Cores: 8

        ...

Structs§

CoreFrequency
A struct for a core frequency information of the device
CoreStatuses
A struct for core status
CoreUtilization
A struct for a utilization information of the device
Device
Abstraction for a single Furiosa NPU device.
DeviceFile
A struct for device file
DeviceInfo
A struct for device information
DevicePerformanceCounter
A struct for a performance counter of the device
DeviceTemperature
A struct for a temperature information of the device
MemoryFrequency
A struct for memory frequency
PeFrequency
A struct for PE frequency
PePerformanceCounter
A struct for PE performance counter
PeStatus
A struct for PE status
PeUtilization
A struct for PE utilization
VersionInfo
A struct for version information

Enums§

Arch
Represents a architecture type of device
CoreStatus
Represents a core status
GovernorProfile
Represents a governor profile
LinkType
Represents a device link type
SmiError
Represents a error status

Functions§

driver_info
Print a driver information of the device.
init
Initialize Furiosa SMI library.
list_devices
List all Furiosa NPU devices in the system.

Type Aliases§

SmiResult
Represents a result of Furiosa SMI API function