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.
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.sockListSupportedXPUType, ListAndWatch, Allocate, and Release
Monitoring
Exporter
dp2mgr.sockListGpuInfo, ExporterGetDataList, ExporterDataStream, ExporterGetConfig, and ExporterGetStatus
Configuration management
Controller (Job Agent)
config-daemon.sockEnable, 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 |
|
|
Unary |
Queries the xPU types supported by the node |
|
|
Server-Streaming |
Streams the device list and health status |
|
|
Unary |
Allocates xPU resources to a container |
|
|
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 |
|
|
int32 |
Status code (0 = success) |
|
|
string |
Status description |
|
|
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 |
|
|
string |
Unique device identifier |
|
|
string |
"Healthy" indicates a normal device. All other values indicate errors |
|
|
uint32 |
Total compute |
|
|
uint32 |
Total memory (MiB) |
|
|
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 |
|
|
string |
Yes |
Unique container identifier |
|
|
enum |
No |
Container runtime (default: RunC) |
|
|
map |
No |
Feature gates (reserved, described below) |
|
|
map |
No |
Additional annotations (reserved, described below) |
|
|
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 |
|
|
UInt32Value |
GPU card number (optional; automatically assigned if left empty) |
|
|
UInt32Value |
Compute percentage |
|
|
UInt32Value |
Memory (GiB) |
|
|
UInt32Value |
Number of MIG partitions |
|
|
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 |
|
|
JSON array (for example, |
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 |
|
|
int32 |
Status code (0 = success) |
|
|
string |
Status description |
|
|
map |
Returned annotations |
|
|
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
coreis 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 thedevicesarray (one card per element).The unit of
memoryin the Allocate request is GiB, whiletotalMemoryreturned by ListAndWatch uses MiB.Setting either
coreormemoryto 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
minoris 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
sliceare 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 |
|
|
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 |
|
|
array |
All topology levels of the card, covering the intra-node, rack, and network segments |
|
|
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 |
|
|
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 |
|
|
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 |
|
|
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.
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 |
|
|
string |
Yes |
Unique container identifier (the same id that was passed in the Allocate request) |
Response fields:
|
Field |
Type |
Description |
|
|
int32 |
Status code (0 = success) |
|
|
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 |
|
|
Unary |
Queries static GPU device information |
|
|
Unary |
Pulls a metric snapshot in a single call |
|
|
Server-Streaming |
Streams metric updates |
|
|
Unary |
Gets the collection configuration |
|
|
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 |
|
|
enum |
Collector(0)/Detector(1) |
Response fields:
|
Field |
Type |
Description |
|
|
string |
Driver version |
|
|
enum |
GPU(0)/PPU(1)/AMD(2) |
|
|
uint32 |
Number of GPUs |
|
|
uint32 |
Device number |
|
|
string |
Globally unique identifier |
|
|
string |
GPU model |
|
|
string |
PCIe bus address |
|
|
uint32 |
Total compute |
|
|
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 |
|
|
enum |
Yes |
Collector(0)/Detector(1) |
|
|
enum |
No |
CacheData(0)/RealTimeData(1) |
|
|
repeated int32 |
No |
List of metric IDs. If empty, all metrics are returned |
|
|
repeated uint32 |
No |
List of GPU numbers. If empty, all GPUs are queried |
Response fields (dataList[]):
|
Field |
Type |
Description |
|
|
int32 |
Metric ID |
|
|
string |
Metric value |
|
|
string |
UUID of the GPU that the metric belongs to |
|
|
int64 |
Collection timestamp (Unix, in milliseconds) |
|
|
bool |
Whether the metric is for a sliced instance |
|
|
bool |
Whether the metric is for the whole card |
|
|
string |
Container ID |
|
|
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 |
|
|
int32 |
Collection interval (milliseconds) |
|
|
enum |
RunningRemote(0)/RunningLocal(1) |
|
|
repeated int32 |
List of supported metric IDs |
|
|
repeated uint32 |
List of GPU numbers available for collection |
4.5 ExporterGetStatus
Queries the running status of the Exporter.
Response fields:
|
Field |
Type |
Description |
|
|
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 |
|
|
int32 |
Status code. 0 indicates success, and any non-zero value indicates failure |
|
|
string |
Description of the operation result |
|
|
string |
Standard output of the underlying command |
|
|
string |
Standard error of the underlying command |
|
|
int32 |
Exit code of the underlying command |
|
|
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 |
|
|
bool |
Whether the features are currently enabled |
|
|
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 |
|
Unary |
|
|
Resource management |
|
Server-Streaming |
|
|
Resource management |
|
Unary |
|
|
Resource management |
|
Unary |
|
|
Monitoring |
|
Unary |
|
|
Monitoring |
|
Unary |
|
|
Monitoring |
|
Server-Streaming |
|
|
Monitoring |
|
Unary |
|
|
Monitoring |
|
Unary |
|
|
Configuration management |
|
Unary |
|
|
Configuration management |
|
Unary |
|
|
Configuration management |
|
Unary |
|