All Products
Search
Document Center

Intelligent Computing LINGJUN:gRPC API reference

Última atualização: Oct 10, 2026

Lingjun Runtime Kit exposes resource management, monitoring, and configuration management APIs to container-layer components over gRPC. Use this reference to find the API contracts, proto file locations, invocation examples, field semantics, and compatibility policy.

Note

Public preview: This product is currently in public preview. If you have questions or suggestions, submit a ticket.

1. API overview

Lingjun Runtime Kit provides GPU resource management, monitoring, and configuration management APIs over standard gRPC interfaces.

  • Transport: Communication runs over Unix Domain Sockets. The resource management and monitoring APIs share one socket (default path unix:///run/amp/eKitC/xdm/sockets/dp2mgr.sock), while the configuration management APIs use a separate socket (/run/amp/eKitC/xdm/sockets/config-daemon.sock).

  • Permission model: The Lingjun Runtime Kit daemon creates the socket files, and access control relies on file system permissions. Only processes with root privileges on the same node can access the sockets. Kubernetes components gain access by mounting the /run/amp/eKitC/xdm/sockets/ directory through hostPath. The path is invisible inside workload containers, so these containers cannot access it directly.

  • Three API categories:

    Category

    Typical caller

    Socket

    APIs

    Resource management

    Device Plugin

    dp2mgr.sock

    ListSupportedXPUType, ListAndWatch, Allocate, and Release

    Monitoring

    Exporter

    dp2mgr.sock

    ListGpuInfo, ExporterGetDataList, ExporterDataStream, ExporterGetConfig, and ExporterGetStatus

    Configuration management

    Controller (Job Agent)

    config-daemon.sock

    Enable, Disable, and QueryStatus

1.1 Proto files and client stub generation

The Device Plugin and the Exporter both communicate with Lingjun Runtime Kit over the same Unix Domain Socket (dp2mgr.sock) and share the same proto definitions. You can obtain the resource management and monitoring proto files from the Device Plugin component in the open source repository (path internal/grpc/api_outer.proto). The Controller uses a separate config-daemon.sock and a separate proto file, located at api/proto/config_service.proto in the Controller component (see Section 5).

The following examples generate client stubs in different languages:

# Go (recommended, consistent with the component source code)
protoc --go_out=plugins=grpc:. api_outer.proto

# Python
python -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. api_outer.proto

# Java
protoc --java_out=. --grpc-java_out=. api_outer.proto

1.2 Go invocation example

The following example follows the invocation approach in the Device Plugin source code:

import (
    "google.golang.org/grpc"
    "google.golang.org/grpc/credentials/insecure"
)

socketPath := "unix:///run/amp/eKitC/xdm/sockets/dp2mgr.sock"
conn, err := grpc.Dial(socketPath, grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
    log.Fatalf("connect failed: %v", err)
}
defer conn.Close()

client := NewXpuDeviceManagerServiceClient(conn)
// Example: query the xPU types supported by the node
resp, err := client.ListSupportedXPUType(context.Background(), &XPUTypeRequest{})

Note: The service and client names in the example (XpuDeviceManagerService) are generated from the proto definitions. Always refer to the proto files in the open source repository.

2. Compatibility and evolution policy

The gRPC interfaces are the only integration boundary between Runtime Kit and the open source components, and follow an additive, backward-compatible evolution policy: interfaces evolve incrementally (new APIs and fields are added), and the semantics of existing APIs and fields remain unchanged. If a breaking change is ever required, it will be released only as a major version upgrade and prominently noted in the release notes. A major version upgrade does not necessarily contain breaking changes. For details, see the release notes of the corresponding version.

Components that are built from the proto definitions of any historical version of this document therefore continue to work after a Runtime upgrade. For the complete versioning scheme and compatibility details, see Sections 4 and 5 in Deployment and release guide.

3. Resource management APIs (called by the Device Plugin)

API

Type

Purpose

ListSupportedXPUType

Unary

Queries the xPU types supported by the node

ListAndWatch

Server-Streaming

Streams the device list and health status

Allocate

Unary

Allocates xPU resources to a container

Release

Unary

Releases the device allocation records of a container

3.1 ListSupportedXPUType

Queries the xPU device types supported by the current node. Request: no parameters (empty request).

Response fields:

Field

Type

Description

status

int32

Status code (0 = success)

message

string

Status description

supportedType

repeated enum

Device type list: GPU(0)/PPU(1)/AMD(2)/DCU(3)

3.2 ListAndWatch

Streams node device lists and health status changes. Request: no parameters (empty request).

Response fields (streamed; each push contains the complete device list):

Field

Type

Description

devices[].id

string

Unique device identifier

devices[].health

string

"Healthy" indicates a normal device. All other values indicate errors

devices[].totalCore

uint32

Total compute

devices[].totalMemory

uint32

Total memory (MiB)

devices[].extenderResources

map

Extended resource key-value pairs (see Section 3.4)

3.3 Allocate

The core resource allocation API. It allocates xPU resources to containers.

Request fields:

Field

Type

Required

Description

id

string

Yes

Unique container identifier

runtimeMode

enum

No

Container runtime (default: RunC)

featureGates

map

No

Feature gates (reserved, described below)

annotations

map

No

Additional annotations (reserved, described below)

devices

repeated

Yes

Device allocation list

devices is a repeated field: each element corresponds to one independent GPU card, and multiple elements mean "allocate multiple cards to this container". Only homogeneous configurations are supported: all elements must use the same core/memory/slice values. If minor is left empty, Lingjun Runtime Kit automatically assigns an available card number.

Device allocation fields (devices[]):

Field

Type

Description

minor

UInt32Value

GPU card number (optional; automatically assigned if left empty)

core

UInt32Value

Compute percentage

memory

UInt32Value

Memory (GiB)

slice

UInt32Value

Number of MIG partitions

extender

map<string, string>

Extension field that pairs with extenderResources in ListAndWatch. The scheduler returns scheduling decisions (such as PCIe indexes) to XDM through this field

extender field:

In the Allocate request, devices[].extender is a generic extension field (map<string, string>). It pairs with extenderResources in the ListAndWatch response, forming an upstream/downstream pair: ListAndWatch reports device topology upstream, and Allocate returns the scheduling decision of the scheduler downstream.

Currently defined keys:

Key

Value format

Purpose

pcie_index

JSON array (for example, "[0, 1]")

The list of PCIe indexes specified by the scheduler (that is, the device indexes carried by topo1 in the ListAndWatch topology). XDM locates the corresponding RDMA devices by PCIe index and mounts them into the container

Response fields:

Field

Type

Description

status

int32

Status code (0 = success)

message

string

Status description

annotations

map

Returned annotations

labels

map

Returned labels

Field conventions by scenario:

Scenario

minor

core

memory

slice

Whole-card allocation

Optional

—

—

—

Time-division multiplexing (TDM)

Optional

Required

Optional

—

Spatial partitioning (MIG)

Optional

—

Optional

Required

Key constraints:

  • If core is left empty or set to 0, compute limits are disabled (the whole card is available). The valid range is 1–100, as a percentage of one card. For multiple cards, use the devices array (one card per element).

  • The unit of memory in the Allocate request is GiB, while totalMemory returned by ListAndWatch uses MiB.

  • Setting either core or memory to 0 means that compute or memory is not limited. If both are 0 and no other resources are requested, the container is treated as a CPU container.

  • If minor is specified, the given card number is used (suitable for scenarios with an upper-level scheduler). If it is left empty, Lingjun Runtime Kit automatically assigns a card number.

  • Valid values of slice are 1, 2, 3, 4, and 7. MIG partitioning currently supports the A100 and H800 GPU models.

featureGates and annotations fields: Both fields are reserved extension fields (featureGates is map<int32, bool>, and annotations is map<string, string>). No specific features are enabled in the current version. Design intent: featureGates will be used to enable feature gates on demand in later versions, and annotations carries additional context between the caller and Lingjun Runtime Kit. In standard usage, leave both fields empty. For custom development, you can use annotations to pass custom key-value pairs, which Runtime Kit passes through and returns in the response.

Request examples:

Whole-card allocation (two cards):

{ "id": "550e8400-e29b-41d4-a716-446655440000", "devices": [{ "minor": 1 }, { "minor": 2 }] }

Time-division multiplexing (50% compute + 4 GiB memory):

{ "id": "550e8400-e29b-41d4-a716-446655440001", "devices": [{ "minor": 1, "core": 50, "memory": 4 }] }

MIG spatial partitioning:

{ "id": "550e8400-e29b-41d4-a716-446655440004", "devices": [{ "minor": 1, "slice": 3, "memory": 4 }] }

3.4 extenderResources and topology information

In the ListAndWatch response, devices[].extenderResources is a generic extension field (map<string, string>) that the Device Plugin uses to pass additional device attributes beyond the standard fields to the scheduler.

Currently defined keys:

Key

Value type

Purpose

topology

JSON string

Physical topology of the accelerator cards, which the scheduler uses for topology-aware scheduling

The topology value is a JSON string serialized from a per-device topology object. XDM collects the hardware and network topology and abstracts it into hierarchical ordinals sorted by distance. Through ListAndWatch, XDM passes the object to the Device Plugin in the extenderResources["topology"] field of each card. The Device Plugin translates the level segments into node annotations and labels, which the scheduler consumes. The object has the form {"levels": [...]}, where levels contains all topology levels of the card, and each element describes one topology level:

PPU M890P per-device example (GPU 0):

{
  "levels": [
    {"level": 1,  "name": "pcieSwitches",    "topo1": [0],  "peers": [0, 1]},
    {"level": 2,  "name": "numaNodes",       "topo2": [0],  "peers": [0, 1]},
    {"level": 3,  "name": "cpuSockets",      "topo3": [0],  "peers": [0, 1, 2, 3]},
    {"level": 11, "name": "hyperNode",       "topo11": "hypernode-001"},
    {"level": 21, "name": "leafSwitch",      "topo21": "asw-001"},
    {"level": 22, "name": "pointOfDelivery", "topo22": "pod-g13-p1"}
  ]
}

The three intra-node layers of M890P (pcieSwitches / numaNodes / cpuSockets) carry peers and topoN, while the rack layer (hyperNode) and the network layers (leafSwitch / pointOfDelivery) carry only topoN string identifiers. The Device Plugin and the scheduler translate the device indexes carried by topo1 into concrete GPU↔RDMA device mappings; other levels are translated in the same way.

PPU 810E per-device example (GPU 0; includes intra-node interconnect layers + PCIe layers + network layers):

{
  "levels": [
    {"level": 1,  "name": "icnLink2",        "topo1": [0],  "peers": [0, 3]},
    {"level": 2,  "name": "icnLink4",        "topo2": [0],  "peers": [0, 1, 2, 3]},
    {"level": 3,  "name": "icnLink8",        "topo3": [0],  "peers": [0, 1, 2, 3, 4, 5, 6, 7]},
    {"level": 4,  "name": "pcieSwitches",    "topo4": [4],  "peers": [0, 1, 2, 3]},
    {"level": 5,  "name": "numaNodes",       "topo5": [1],  "peers": [0, 1, 2, 3, 8, 9, 10, 11]},
    {"level": 6,  "name": "cpuSockets",      "topo6": [0]},
    {"level": 21, "name": "leafSwitch",      "topo21": "ASW-VM-SQA-G10-P2-S25"},
    {"level": 22, "name": "pointOfDelivery", "topo22": "VM-SQA-G10-P2"}
  ]
}

Within an 810E node, the levels first cover the inter-card interconnect layers (icnLink2 / icnLink4 / icnLink8, where peers reflect the actual link connections and are not necessarily consecutive), then the PCIe physical layers (pcieSwitches / numaNodes / cpuSockets), and optionally the network layers (leafSwitch / pointOfDelivery).

Field semantics (level/topoN abstraction contract):

Field

Type

Description

levels

array

All topology levels of the card, covering the intra-node, rack, and network segments

level

int

Level segment number: 1–9 intra-node, 11–19 rack, 21–29 network. A smaller value means a shorter distance between devices. Segments without a corresponding level are omitted

name

string

(Optional) Name of the physical layer that the level corresponds to, such as pcieSwitches/numaNodes/cpuSockets/hyperNode/leafSwitch/pointOfDelivery/icnLinkN. This field is provided for readability only. If it is absent, the scheduler determines distance solely by level

topoN (topo1/topo11/…)

int[] or string

Resource identifiers associated with the level. Intra-node levels use int arrays (device indexes, one-to-many supported); rack and network levels use string logical identifiers

peers

int[]

(Optional) Carried by intra-node levels: the minor numbers of the devices in the same group as this card at this level (including the card itself). If absent, topoN takes precedence

Sorting the levels by level in ascending order arranges them from nearest to farthest. The scheduler uses this ordering to prefer combinations with the shortest topology distance in multi-card and cross-node scenarios. Level segments that a device model does not have (for example, no rack segment) are omitted.

Note

This chapter defines the abstract protocol contract (external specification) for level/topoN/name. level uses segmented numbering, where a smaller value means a shorter distance, and name identifies the physical layer that a level represents. The Device Plugin and the scheduler translate the device indexes carried by the topoN of intra-node levels (such as topo1) into concrete RDMA device mappings; other levels are translated in the same way.

3.5 Release

Releases the device allocation records of a container (the reverse operation of Allocate). The Device Plugin calls this API when a container is destroyed, and XDM then reclaims the device resources used by the container.

Request fields:

Field

Type

Required

Description

id

string

Yes

Unique container identifier (the same id that was passed in the Allocate request)

Response fields:

Field

Type

Description

status

int32

Status code (0 = success)

message

string

Status description

Request example:

{ "id": "550e8400-e29b-41d4-a716-446655440000" }

Response example:

{ "status": 0, "message": "" }

4. Monitoring APIs (called by the Exporter)

API

Type

Purpose

ListGpuInfo

Unary

Queries static GPU device information

ExporterGetDataList

Unary

Pulls a metric snapshot in a single call

ExporterDataStream

Server-Streaming

Streams metric updates

ExporterGetConfig

Unary

Gets the collection configuration

ExporterGetStatus

Unary

Queries the running status

4.1 ListGpuInfo

Gets static information about GPU devices on the node, such as the model, UUID, and driver version.

Request fields:

Field

Type

Description

exporterType

enum

Collector(0)/Detector(1)

Response fields:

Field

Type

Description

driverVersion

string

Driver version

xpuType

enum

GPU(0)/PPU(1)/AMD(2)

count

uint32

Number of GPUs

gpu[].gpuID

uint32

Device number

gpu[].uuid

string

Globally unique identifier

gpu[].modelName

string

GPU model

gpu[].busId

string

PCIe bus address

gpu[].core

uint32

Total compute

gpu[].memory

uint64

Total memory

4.2 ExporterGetDataList

Pulls a metric snapshot in a single call, filtered by device and metric ID. This API is suitable for periodic metric collection.

Request fields:

Field

Type

Required

Description

exportType

enum

Yes

Collector(0)/Detector(1)

source

enum

No

CacheData(0)/RealTimeData(1)

fieldID

repeated int32

No

List of metric IDs. If empty, all metrics are returned

gpuID

repeated uint32

No

List of GPU numbers. If empty, all GPUs are queried

Response fields (dataList[]):

Field

Type

Description

fieldID

int32

Metric ID

value

string

Metric value

uuid

string

UUID of the GPU that the metric belongs to

time

int64

Collection timestamp (Unix, in milliseconds)

eGpu

bool

Whether the metric is for a sliced instance

full

bool

Whether the metric is for the whole card

cId

string

Container ID

labels

map

Additional labels (Pod, Namespace, and so on)

4.3 ExporterDataStream

A streaming API over a persistent connection. The core service (XDM) continuously pushes metric updates at each collection interval. The request and response formats match ExporterGetDataList. Clients must implement reconnection with exponential backoff (recommended settings: initial interval 1 second, multiplier 2, maximum 30 seconds).

4.4 ExporterGetConfig

Gets the Exporter collection configuration.

Response fields:

Field

Type

Description

interval

int32

Collection interval (milliseconds)

runningMode

enum

RunningRemote(0)/RunningLocal(1)

suptFieldID

repeated int32

List of supported metric IDs

gpuID

repeated uint32

List of GPU numbers available for collection

4.5 ExporterGetStatus

Queries the running status of the Exporter.

Response fields:

Field

Type

Description

runningStatus

enum

ExportRunning(0)/ExportError(1)

5. Configuration management APIs (called by the Controller)

The Job Agent of the Controller calls this group of APIs to enable or disable Runtime Kit features on a node (the feature flags that correspond to the node label lj_runtimekit_enable=true; for details, see 3.5 Enable and disable features). Communication uses a Unix Domain Socket at /run/amp/eKitC/xdm/sockets/config-daemon.sock. Only processes with root privileges can access this socket. The Job Agent runs in privileged mode and mounts the socket directory through hostPath.

Proto file: api/proto/config_service.proto in the Controller component.

Service definition:

service AmpConfigService {
  rpc Enable(EnableRequest) returns (EnableResponse);
  rpc Disable(DisableRequest) returns (DisableResponse);
  rpc QueryStatus(QueryStatusRequest) returns (QueryStatusResponse);
}

5.1 Enable

Enables Runtime Kit features on the node. Request: EnableRequest {} (no parameters).

Response fields (EnableResponse):

Field

Type

Description

status

int32

Status code. 0 indicates success, and any non-zero value indicates failure

message

string

Description of the operation result

stdout

string

Standard output of the underlying command

stderr

string

Standard error of the underlying command

exit_code

int32

Exit code of the underlying command

duration_ms

int64

Execution duration (milliseconds)

5.2 Disable

Disables Runtime Kit features on the node. Request: DisableRequest {} (no parameters). Response: DisableResponse (the fields match EnableResponse).

5.3 QueryStatus

Queries whether Runtime Kit features are enabled on the node. Request: QueryStatusRequest {} (no parameters).

Response fields (QueryStatusResponse):

Field

Type

Description

enabled

bool

Whether the features are currently enabled

message

string

Additional information

Invocation example (Go):

// Connect to the config-daemon Unix socket
conn, err := grpc.Dial(
    "unix:///run/amp/eKitC/xdm/sockets/config-daemon.sock",
    grpc.WithTransportCredentials(insecure.NewCredentials()),
)
client := configpb.NewAmpConfigServiceClient(conn)

// Enable
resp, err := client.Enable(ctx, &configpb.EnableRequest{})

// Query the status
status, err := client.QueryStatus(ctx, &configpb.QueryStatusRequest{})
fmt.Println("enabled:", status.Enabled)

6. Error codes and reliability

Error code reference:

status

Name

Common cause

Solution

0

SUCCESS

—

—

1

INVALID_ARGUMENT

Invalid field, such as an empty id or a core value out of the valid range

Correct the request according to the API specification

2

RESOURCE_EXHAUSTED

Insufficient node resources

Check resource usage, switch to another node, or reduce the request

3

DEVICE_NOT_READY

The driver is not loaded, or the card is offline

Check the device status and the ListAndWatch output

4

AUTH_FAILURE

Incorrect Unix Domain Socket permission configuration

Check the socket permissions and configuration

5

INTERNAL_ERROR

Internal error

Collect logs and contact technical support

Connection reliability requirements: Custom clients must handle connection interruptions (such as core service restarts and socket file recreation) and reconnect with exponential backoff (recommended settings: initial interval 1 second, multiplier 2, maximum 30 seconds). For the streaming APIs (ListAndWatch and ExporterDataStream), if a stream is interrupted, call the API again and rebuild the subscription.

Appendix: API quick reference

Category

API

Type

Socket

Resource management

ListSupportedXPUType

Unary

dp2mgr.sock

Resource management

ListAndWatch

Server-Streaming

dp2mgr.sock

Resource management

Allocate

Unary

dp2mgr.sock

Resource management

Release

Unary

dp2mgr.sock

Monitoring

ListGpuInfo

Unary

dp2mgr.sock

Monitoring

ExporterGetDataList

Unary

dp2mgr.sock

Monitoring

ExporterDataStream

Server-Streaming

dp2mgr.sock

Monitoring

ExporterGetConfig

Unary

dp2mgr.sock

Monitoring

ExporterGetStatus

Unary

dp2mgr.sock

Configuration management

Enable

Unary

config-daemon.sock

Configuration management

Disable

Unary

config-daemon.sock

Configuration management

QueryStatus

Unary

config-daemon.sock