This section describes how to use the scripts in the MindIE Motor installation directory (examples/kubernetes_deploy_scripts) to deploy and uninstall a prefill-decode disaggregation cluster on MindIE in one-click mode. The cluster administrator can use Kubernetes kubectl to operate the cluster offline by referring to these scripts.
The cluster administrator only needs to compile the startup script, configure services and Kubernetes on the management node, and then call the deployment script to automatically deliver the service configuration and startup script, generate a global ranktable, and schedule pods to compute nodes.
To ensure that the Coordinator can reliably obtain the memory, the values of memory under the requests and limits fields should be the same (if possible). By default, the recommended memory specifications are as follows:
Maximum memory that can be occupied by the Coordinator = Value of body_limit x Value of max_requests x 120%
Directory structure of scripts:
├── boot_helper
│ ├── boot.sh
│ ├── gen_config_single_container.py
│ ├── get_group_id.py
│ ├── mindie_cpu_binding.py
│ ├── server_prestop.sh
│ └── update_mindie_server_config.py
├── chat.sh
├── conf
├── delete.sh
├── deploy.sh
├── deploy_ac_job.py
├── deployment
│ ├── controller_init.yaml
│ ├── coordinator_init.yaml
│ ├── mindie_ms_controller.yaml
│ ├── mindie_ms_coordinator.yaml
│ ├── mindie_server.yaml
│ ├── mindie_server_heterogeneous.yaml
│ ├── mindie_service_single_container.yaml
│ ├── mindie_service_single_container_base_A3.yaml
│ ├── server_init.yaml
│ └── single_container_init.yaml
├── gen_ranktable_helper
│ ├── gen_global_ranktable.py
│ └── global_ranktable.json
├── generate_stream.sh
├── log.sh
├── user_config.json
├── user_config_base_A3.json
└── utils
├── validate_config.py
└── validate_utils.py
The following table describes the key directories and files for single-node prefill-decode disaggregation deployment.
Directory/File |
Description |
|---|---|
conf |
Main service configuration file of the cluster management component and Server, which is used to manage scheduling policies and model configurations in the prefill-decode disaggregation scenario. |
boot_helper |
Contains the container startup script boot.sh. It modifies configuration files in the conf directory (i.e. generates several configurations files with unique port assignments for one Server config.json file) and generates the auxiliary script gen_config_single_container.py corresponding global_ranktable. NOTE:
MindIE depends on the jemalloc.so library file. Do not install invalid SO files with the same name in the /usr/ directory, as this may introduce security risks such as arbitrary command execution. |
deployment |
Defines a Kubernetes deployment task and configures the NPU resource usage, number of instances, and image. For single-node prefill-decode disaggregation deployment, only the mindie_service_single_container.yaml file is used. |
chat.sh |
Simple dialog example of using curl to send HTTPS requests to the inference service, which is applicable to the prefix cache scenario. |
generate_stream.sh |
Streaming response example for sending an HTTPS request to the inference service using curl. |
deploy.sh |
Deployment script, which is used to start all MindIE components in one-click mode. |
delete.sh |
Uninstallation script, which is used to uninstall all MindIE components in one-click mode. |
log.sh |
Queries the printed logs of all deployed pods. |
The LLaMA3-8B with four instances is used as an example, each instance configured with two NPUs. The following is a deployment example. Perform the following operations in the deployment script path.
kubectl create namespace mindie
"deploy_mode": "pd_disaggregation_single_container"
For single-node prefill-decode disaggregation deployment, set deploy_mode to pd_separate.
"deploy_mode": "pd_disaggregation_single_container"
Parameter |
Description |
|---|---|
modelName |
Model name, which is associated with the model weight file, for example, llama3-8b. |
modelWeightPath |
Directory of the model weight file, which must be set to the weight path mounted to the container specified in the mindie_service_single_container.yaml file. The default path is /mnt/mindie-service/ms/model. Ensure that the cluster can schedule the Ascend compute node's model file existing in this path. |
worldSize |
Number of NPUs occupied by a prefill/decode instance. For example, if this parameter is set to 2, two NPUs are used. |
npuDeviceIds |
NPU ID, starting from 0. The total number of IDs is the same as the value of worldSize, for example, [[0,1]]. |
inferMode |
Set this parameter to dmi. |
tp |
Number of tensor parallel processes on the entire network. This number is the value of worldSize. This parameter is a supplementary parameter and needs to be configured under the ModelConfig field. |
In single-node prefill-decode deployment, multiple Server processes run in one pod. Each Server process requires an independent configuration file. To simplify the configuration process, you can use the MINDIE_MS_GEN_SERVER_PORT environment variable in the mindie_service_single_container.yaml file for management. This environment variable supports two configuration modes:
tls_enable specifies whether to enable HTTPS. If the MindIE components in the cluster use the HTTPS interface, set tls_enable to true, import certificates to the container, and configure the corresponding certificate paths. To use the HTTP interface, set tls_enable to false. No certificate file is required.
You are advised to enable tls_enable to ensure communication security. If tls_enable is disabled, high network security risks exist.
Atlas 800I A2 inference server: Configure the mindie_service_single_container.yaml file in the deployment directory among the deployment script directories.
Atlas 800I A3 SuperPoD Server: Configure the mindie_service_single_container_base_A3.yaml file in the deployment directory among the deployment script directories.
- name: model-path
hostPath:
path: /data/LLaMA3-8B
The priority is higher than that of default_p_rate in the ms_controller.json configuration file.
The priority is higher than that of default_d_rate in the ms_controller.json configuration file.
The default value is 1, indicating that logs are written into a file. The value range is [false, true] or [0, 1].
The default value is 1, indicating that logs are printed. The value range is [false, true] or [0, 1].
The default value is INFO. The log levels are [CRITICAL, ERROR, WARN, INFO, DEBUG].
Parameter |
Value Type |
Value Range |
Description |
|---|---|---|---|
huawei.com/Ascend910 |
Int |
Total number of NPUs occupied by all prefill/decode instances, which is the same as the number specified by worldSize in all Server configuration files. |
|
sp-block |
Size of a SuperPoD block, indicating the number of NPUs on a virtual SuperPoD. This parameter is configured only when Atlas 800I A3 SuperPoD Server is used (that is, the mindie_service_single_container_base_A3.yaml file is used). The value of this parameter must be the same as that of huawei.com/Ascend910. |
||
image |
Image name.
|
||
startupProbe |
Startup probe, which checks the startup status every 180 seconds. If the startup probe fails for 30 consecutive times, the pod is considered to be not started successfully and will be automatically restarted. Set a proper startup time as required. |
||
readinessProbe |
Readiness probe, which checks the readiness status every 180 seconds. If the probe fails, the pod stops receiving traffic until the check is passed. Set a proper triggering time as required. |
||
livenessProbe |
Liveness probe, which checks the liveness status every 180 seconds. It is used to detect the container health. If any process does not respond, the container is restarted. Set a proper triggering time as required. |
||
MINDIE_MS_GEN_SERVER_PORT |
Whether multiple configuration files of Server are automatically generated by the program based on the original config.json file. |
||
MINDIE_MS_P_RATE |
Proportion of prefill nodes in prefill-decode disaggregation deployment mode.
The priority is higher than that of default_p_rate in the ms_controller.json configuration file. |
||
MINDIE_MS_D_RATE |
Proportion of decode nodes in prefill-decode disaggregation deployment mode.
The priority is higher than that of default_d_rate in the ms_controller.json configuration file. |
||
MINDIE_LOG_TO_FILE |
|
Whether to write logs of each MindIE component to a file. The default value is 1. |
|
MINDIE_LOG_TO_STDOUT |
|
Whether to print logs of each MindIE component. The default value is 1. |
|
MINDIE_LOG_LEVEL |
|
Log level of each MindIE component. The default value is INFO. |
Environment Variable |
Type |
Description |
|---|---|---|
MINDIE_INFER_MODE |
Prefill-decode disaggregation |
Inference mode, indicating whether prefill-decode disaggregation is enabled.
This environment variable is not included in the default boot.sh script configuration. If required, add it to the script. |
MINDIE_DECODE_BATCH_SIZE |
Public variable |
Maximum decode batch size. Value range: [1, 5000] This environment variable is not included in the default boot.sh script configuration. If required, add it to the script. |
MINDIE_PREFILL_BATCH_SIZE |
Public variable |
Maximum prefill batch size. Value range: [1, MINDIE_DECODE_BATCH_SIZE - 1] This environment variable is not included in the default boot.sh script configuration. If required, add it to the script. |
MINDIE_MAX_SEQ_LEN |
Public variable |
Maximum sequence length. Integer in the range of (0, 4294967295] This environment variable is not included in the default boot.sh script configuration. If required, add it to the script. |
MINDIE_MAX_ITER_TIMES |
Public variable |
Maximum output length. Integer in the range of [1, MINDIE_MAX_SEQ_LEN – 1] This environment variable is not included in the default boot.sh script configuration. If required, add it to the script. |
MINDIE_MODEL_NAME |
Public variable |
Model name. This environment variable is not included in the default boot.sh script configuration. If required, add it to the script. |
MINDIE_MODEL_WEIGHT_PATH |
Public variable |
Path of the model weight file. This environment variable is not included in the default boot.sh script configuration. If required, add it to the script. |
MINDIE_ENDPOINT_HTTPS_ENABLED |
Public variable |
Whether to enable HTTPS on the prefill/decode instance.
This environment variable is not included in the default boot.sh script configuration. If required, add it to the script. |
MINDIE_INTER_COMM_TLS_ENABLED |
Public variable |
Whether to enable TLS for communication between inference instances.
This environment variable is not included in the default boot.sh script configuration. If required, add it to the script. |
HSECEASY_PATH |
Public variable |
Path of the dependency library of the KMC decryption tool. |
MINDIE_MS_CONTROLLER_CONFIG_FILE_PATH |
Public variable |
Configuration file path of the Controller component. |
MINDIE_MS_COORDINATOR_CONFIG_FILE_PATH |
Public variable |
Configuration file path of the Coordinator component. |
ATB_LLM_HCCL_ENABLE |
Public variable |
Whether to enable the HCCL communication backend. This variable is enabled by default.
When the single-node prefill-decode disaggregation service is deployed using Atlas 800I A2 inference server to run dense models, you are advised to disable this environment variable to improve performance. |
HCCL_OP_EXPANSION_MODE |
Public variable |
Location for expanding the orchestration of the communication algorithm. The default value is AIV. This environment variable takes effect when ATB_LLM_HCCL_ENABLE is set to 1. The values are as follows:
For details about this environment variable, see "HCCL_OP_EXPANSION_MODE" in CANN Environment Variable Reference (Community Edition). |
HCCL_RDMA_RETRY_CNT |
Public variable |
Number of retransmission times of the RDMA NIC. The value must be an integer ranging from 1 to 7. The default value is 7. |
HCCL_RDMA_TIMEOUT |
Public variable |
Retransmission timeout of the RDMA NIC. The formula for calculating the minimum retransmission timeout of the RDMA NIC is 4.096 μs * 2 ^ timeout. In the formula, timeout is the value of this environment variable, and the actual retransmission timeout is related to the user network status. Set this environment variable to an integer ranging from [5,20]. The default value is 18. |
HCCL_EXEC_TIMEOUT |
Public variable |
Synchronization wait time during task execution between devices. Within this configured time, each device process waits for other devices to perform communication synchronization. This variable is used to set the timeout interval of the first token. The value range is [0, 2147483647], in seconds. The default value is 60. The value 0 indicates that there is no timeout. |
Note: For details about log-related environment variables, see Log Configuration. |
||
Before starting the service, you are advised to use the pre-check tool of MindStudio to verify the fields in the configuration file and check the validity of the configuration. For details, see Link.
Configure the MindIE installation directory in the container. Change the value of MINDIE_USER_HOME_PATH based on the actual installation path during image creation. For example, if the installation path is /xxx/Ascend/mindie, set the value to /xxx.
export MINDIE_USER_HOME_PATH={Image installation path}
Run the following command to start the cluster:
bash deploy.sh
or
bash deploy.sh 800i_a2
Run the following command to start the cluster:
bash deploy.sh 800i_a3
kubectl get pods -n mindie
Command output:
1 2 | NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES mindie-server-7b795f8df9-vl9hv 1/1 Running 0 145m xx.xx.xx.xx ubuntu <none> <none> |
The Controller, Coordinator, and Server components are started in the pods whose names start with mindie-server.
If the pod is in the Running status, the pod container has been successfully scheduled to a node and started. However, you need to further check whether the service program is started successfully.
bash log.sh
kubectl logs mindie-server-7b795f8df9-vl9hv -n mindie
{
"version": "1.0",
"server_group_list": [
{
"group_id": "2",
"server_count": "4",
"server_list": [
{
"server_id": "127.0.0.1",
"server_ip": "127.0.0.1",
"predict_port": "xxxx",
"mgmt_port": "xxxx",
"metric_port": "xxxx",
"inter_comm_port": "xxxx",
"device": [
{
"device_id": "0",
"device_ip": "1.1.1.1",
"rank_id": "0",
"device_logical_id": "0"
},
{
"device_id": "1",
"device_ip": "1.1.1.2",
"rank_id": "1",
"device_logical_id": "1"
}
]
},
{
"server_id": "127.0.0.1",
"server_ip": "127.0.0.1",
"predict_port": "xxxx",
"mgmt_port": "xxxx",
"metric_port": "xxxx",
"inter_comm_port": "xxxx",
"device": [
{
"device_id": "2",
"device_ip": "1.1.1.3",
"rank_id": "2",
"device_logical_id": "2"
},
{
"device_id": "3",
"device_ip": "1.1.1.4",
"rank_id": "3",
"device_logical_id": "3"
}
]
},
{
"server_id": "127.0.0.1",
"server_ip": "127.0.0.1",
"predict_port": "xxxx",
"mgmt_port": "xxxx",
"metric_port": "xxxx",
"inter_comm_port": "xxxx",
"device": [
{
"device_id": "4",
"device_ip": "1.1.1.5",
"rank_id": "4",
"device_logical_id": "4"
},
{
"device_id": "5",
"device_ip": "1.1.1.6",
"rank_id": "5",
"device_logical_id": "5"
}
]
},
{
"server_id": "127.0.0.1",
"server_ip": "127.0.0.1",
"predict_port": "xxxx",
"mgmt_port": "xxxx",
"metric_port": "xxxx",
"inter_comm_port": "xxxx",
"device": [
{
"device_id": "6",
"device_ip": "1.1.1.7",
"rank_id": "6",
"device_logical_id": "6"
},
{
"device_id": "7",
"device_ip": "1.1.1.8",
"rank_id": "7",
"device_logical_id": "7"
}
]
}
]
},
{
"group_id": "1",
"server_count": "1",
"server_list": [
{
"server_ip": "127.0.0.1"
}
]
},
{
"group_id": "0",
"server_count": "1",
"server_list": [
{
"server_ip": "127.0.0.1"
},
]
}
],
"status": "completed"
}
{
"version": "1.0",
"server_group_list": [
{
"group_id": "2",
"server_count": "4",
"server_list": [
{
"server_id": "127.0.0.1",
"server_ip": "127.0.0.1",
"predict_port": "xxxx",
"mgmt_port": "xxxx",
"metric_port": "xxxx",
"inter_comm_port": "xxxx",
"device": [
{
"device_id": "0",
"device_ip": "1.1.1.1",
"super_device_id": "xxxxxxxxxx",
"rank_id": "0",
"device_logical_id": "0"
},
{
"device_id": "1",
"device_ip": "1.1.1.2",
"super_device_id": "xxxxxxxxxx",
"rank_id": "1",
"device_logical_id": "1"
}
]
},
{
"server_id": "127.0.0.1",
"server_ip": "127.0.0.1",
"predict_port": "xxxx",
"mgmt_port": "xxxx",
"metric_port": "xxxx",
"inter_comm_port": "xxxx",
"device": [
{
"device_id": "2",
"device_ip": "1.1.1.3",
"super_device_id": "xxxxxxxxxx",
"rank_id": "2",
"device_logical_id": "2"
},
{
"device_id": "3",
"device_ip": "1.1.1.4",
"super_device_id": "xxxxxxxxxx",
"rank_id": "3",
"device_logical_id": "3"
}
]
},
{
"server_id": "127.0.0.1",
"server_ip": "127.0.0.1",
"predict_port": "xxxx",
"mgmt_port": "xxxx",
"metric_port": "xxxx",
"inter_comm_port": "xxxx",
"device": [
{
"device_id": "4",
"device_ip": "1.1.1.5",
"super_device_id": "xxxxxxxxxx",
"rank_id": "4",
"device_logical_id": "4"
},
{
"device_id": "5",
"device_ip": "1.1.1.6",
"super_device_id": "xxxxxxxxxx",
"rank_id": "5",
"device_logical_id": "5"
}
]
},
{
"server_id": "127.0.0.1",
"server_ip": "127.0.0.1",
"predict_port": "xxxx",
"mgmt_port": "xxxx",
"metric_port": "xxxx",
"inter_comm_port": "xxxx",
"device": [
{
"device_id": "6",
"device_ip": "1.1.1.7",
"super_device_id": "xxxxxxxxxx",
"rank_id": "6",
"device_logical_id": "6"
},
{
"device_id": "7",
"device_ip": "1.1.1.8",
"super_device_id": "xxxxxxxxxx",
"rank_id": "7",
"device_logical_id": "7"
}
]
}
],
"super_pod_list": [
{
"super_pod_id": "0",
"server_list": [
{
"server_id": "127.0.0.1"
}
]
}
]
},
{
"group_id": "1",
"server_count": "1",
"server_list": [
{
"server_ip": "127.0.0.1"
}
]
},
{
"group_id": "0",
"server_count": "1",
"server_list": [
{
"server_ip": "127.0.0.1"
},
]
}
],
"status": "completed"
}
Parameter |
Type |
Description |
|---|---|---|
version |
String |
Version number of Ascend Operator. |
status |
String |
Cluster information status.
|
group_id |
String |
ID of each component.
|
server_count |
String |
Total number of processes of each component. |
server_list |
JSON object array |
Process deployment information of each component.
|
server_id |
String |
Node host IP address of a component. |
server_ip |
String |
Node IP address of a component. |
predict_port |
String |
Port number bound to the service-plane RESTful interface provided by EndPoint. |
mgmt_port |
String |
Port number bound to the internal interface provided by EndPoint. |
metric_port |
String |
Port number of the service management and control metric interface (Prometheus format). |
inter_comm_port |
String |
Communication port between instances in a cluster. |
device |
JSON object array |
NPU device information. Only Server has this attribute. The valid list length is [1, 128]. |
device_id |
String |
NPU device ID. |
device_ip |
String |
NPU IP address. |
super_device_id |
String |
ID of an NPU device on a SuperPoD. This parameter is involved only in Atlas 800I A3 SuperPoD Server. |
rank_id |
String |
Logical ID of the NPU, that is, the sequence ID of the visible device in the pod where Server is located. |
device_logical_id |
String |
Logical ID of the NPU, that is, the sequence ID of the visible device in the pod where Server is located. |
super_pod_list |
String |
SuperPoD list. This parameter is involved only in Atlas 800I A3 SuperPoD Server. |
super_pod_id |
String |
ID of the current SuperPoD. This parameter is involved only in Atlas 800I A3 SuperPoD Server. |
kubectl exec -it mindie-server-7b795f8df9-vl9hv -n mindie -- bash
bash generate_stream.sh
HTTPS is recommended, as it is more secure than HTTP.
bash delete.sh mindie ./