Provides Huawei Ascend NPU natural language command translation and execution. Supports full npu-smi commands: device queries, configuration management, firmware upgrade, vNPU virtualization, certificate management, and compute power testing.
Overview
This skill provides natural language management for Huawei Ascend NPU devices via npu-smi commands. Supports both local direct execution and SSH remote modes.
Related Skills:
huawei-cloud-ascend-remote-connect - General SSH remote operations (disk, Docker, logs, processes)
npu-smi-skill - Alternative NPU management implementation
model-deploy-test-skill - Model deployment and testing on Ascend DevServer
Capabilities:
- Device queries (health, temperature, power, HBM, ECC, topology)
- Configuration management (ECC, fan mode, fan speed)
- Firmware upgrade and status
- vNPU virtualization
- Certificate management
- Compute power testing (FLOPS)
Architecture
System Architecture Diagram
┌─────────────────────────────────────────────────────────────────────┐
│ Agent Orchestration │
│ ┌─────────────────────────────────────────────────────────────┐ │
│ │ 1. Parse user intent → Match Trigger keywords │ │
│ │ 2. Prepare params → host, user, password explicit │ │
│ │ 3. Invoke Skill → skill exec --name ascend-command │ │
│ │ 4. Return result → User │ │
│ └────────────────────────────┬────────────────────────────────┘ │
│ │ Explicit param passing (Rule 1) │
│ ▼ │
├─────────────────────────────────────────────────────────────────────┤
│ User Interaction Layer │
│ ┌─────────────────────────────────────────────────────────────┐ │
│ │ Natural Language Commands / CLI Arguments │ │
│ │ (NPU health check, temperature, firmware upgrade) │ │
│ └────────────────────────────┬────────────────────────────────┘ │
│ │ │
│ ▼ │
├─────────────────────────────────────────────────────────────────────┤
│ Skill Core Components (Stateless (Rule 2)) │
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │
│ │ Command Executor│←→│ NPU Client │←→│ Trend Recorder │ │
│ │ - NL Parsing │ │ - npu-smi cmd │ │ - Metric Log │ │
│ │ - Command Route│ │ - Local/SSH │ │ - Trend Analysis│ │
│ └─────────────────┘ └─────────────────┘ └─────────────────┘ │
│ │ │ │
│ ▼ ▼ │
├─────────────────────────────────────────────────────────────────────┤
│ Huawei Cloud Ascend Infrastructure │
│ Data Flow: Agent → Skill(host,user,pwd) → SSH → npu-smi → Response │
└─────────────────────────────────────────────────────────────────────┘
Agent Orchestration Flow
User request: "Query NPU status on 116.204.23.145"
│
▼
┌─────────────────────────────────────────────────────────────┐
│ Agent parses intent │
│ - Keyword "NPU" → Match ascend-command │
│ - IP address → SSH params needed │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ Agent prepares params (explicit, Rule 1) │
│ --host 116.204.23.145 │
│ --user root │
│ --password *** │
│ --command "NPU list" │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ Skill executes (Stateless, Rule 2) │
│ - NpuClient(host, user, password) explicit receive │
│ - Execute npu-smi command │
│ - Return result │
└─────────────────────────────────────────────────────────────┘
│
▼
Return to user
Related Skills (Agent orchestrated, no direct call, Rule 3)
| Skill |
Purpose |
Orchestration Scenario |
huawei-cloud-ascend-remote-connect |
SSH remote ops |
Agent selects when user needs disk/Docker/logs |
npu-smi-skill |
NPU management |
Alternative impl, Agent selects by scenario |
model-deploy-test-skill |
Model deploy |
Use ascend-command to monitor NPU after deploy |
Note: No direct calls between Skills, orchestrated by Agent based on user intent.
Prerequisites
System Requirements
- Python 3.8+
- Pure Python standard library implementation, no additional dependencies required
Environment Check
Prerequisite check: Python3 required
python3 --version # Python3 >= 3.8
Authentication
Security rules (must be followed):
- Prohibited from reading, echoing, or printing password values
- Prohibited from asking the user to input passwords directly in the conversation
- Only allowed to read credentials from command line arguments
Parameter Confirmation
Input Parameters
| Parameter |
Required |
Description |
| command |
Yes (one-shot) |
Natural language command to execute |
| host |
No |
SSH remote host IP address |
| user |
No |
SSH username |
| password |
No |
SSH password |
Confirmation Requirements
The following operations require explicit user confirmation:
- ECC enable/disable
- Fan mode changes
- Firmware upgrade
- vNPU creation/deletion
- Certificate management
Core Workflow
Task 1: One-Shot Command Execution
python3 scripts/main.py --command "NPU health check"
Task 2: SSH Remote Execution
python3 scripts/main.py --command "NPU list" --host 192.168.1.100 --user root --password xxx
Task 3: Interactive Mode
python3 scripts/main.py
Usage Instructions
Device Queries
List all NPU devices
NPU health check
Get NPU temperature
Get NPU power usage
Get NPU memory info
Configuration Management
Set ECC mode
Set fan mode
Firmware Upgrade
Query firmware version
Upgrade firmware
Virtualization
Query vNPU info
Create vNPU
FLOPS Test
Run FLOPS test
Run FP32 FLOPS test
Run multi-device FLOPS test
Output Format
Standard Response Format
All command outputs follow a structured format:
{
"status": "success",
"command": "npu-smi info -l",
"description": "List all NPU devices"
}
Error Response Format
[ERROR] <error-code>
Message: <error-description>
Suggestion: <troubleshooting-tip>
Verification Method
Basic Verification Steps
Environment Check
python3 --version # Verify Python 3.8+
Local Command Test
python3 scripts/main.py --command "NPU list"
Remote Command Test
python3 scripts/main.py --host <ascend-ip> --user root --password <pwd> --command "NPU health check"
Expected Results
| Test Case |
Expected Output |
| Environment check |
Python version >= 3.8 |
| Local command |
NPU device information or "npu-smi not found" |
| Remote command |
NPU status from remote server |
Script Files
Entry File
- main.py: Skill entry file (required)
- Function: Provide interactive mode, one-shot mode, SSH remote mode
- Supports: Command line arguments, interactive prompt
Core Scripts
Command Translation Mapping
Device Queries
| Natural Language |
Command |
Description |
| List all NPU devices |
npu-smi info -l |
List all NPU devices |
| NPU card info |
npu-smi info -m |
Card and chip mapping |
| NPU info |
npu-smi info |
Full NPU information |
Health Check
| Natural Language |
Command |
Description |
| NPU health check |
npu-smi info -t health -i 0 |
Check device health |
| Check NPU status |
npu-smi info -t health -i 0 |
Check device health |
Temperature/Power/Memory
| Natural Language |
Command |
Description |
| NPU temperature |
npu-smi info -t temp -i 0 -c 0 |
Get temperature |
| NPU power |
npu-smi info -t power -i 0 -c 0 |
Get power usage |
| NPU memory |
npu-smi info -t memory -i 0 -c 0 |
Get memory info |
| NPU utilization |
npu-smi info -t usages -i 0 -c 0 |
Get utilization |
Configuration
| Natural Language |
Command |
Description |
| Set ECC |
npu-smi set -t ecc-enable -i 0 -c 0 -d 1 |
Enable ECC (requires confirmation) |
| Set fan mode |
npu-smi set -t pwm-mode -d 0 |
Set fan mode (requires confirmation) |
Firmware Upgrade
| Natural Language |
Command |
Description |
| Firmware version |
npu-smi upgrade -b mcu -i 0 |
Query firmware version |
| Upgrade firmware |
npu-smi upgrade -t mcu -i 0 -f file.hpm |
Upload firmware (requires confirmation) |
Virtualization
| Natural Language |
Command |
Description |
| vNPU info |
npu-smi info -t info-vnpu -i 0 -c 0 |
Query vNPU info |
| Template info |
npu-smi info -t template-info -i 0 |
Query template info |
| Create vNPU |
npu-smi set -t create-vnpu -i 0 -c 0 -f vir04 |
Create vNPU (requires confirmation) |
Certificate Management
| Natural Language |
Command |
Description |
| Certificate info |
npu-smi info -t tls-cert -i 0 -c 0 |
View TLS certificate |
| Certificate expiration |
npu-smi info -t tls-cert-period -i 0 -c 0 |
Query certificate expiration threshold |
FLOPS Test (ascend-dmi)
Default behavior: single device FP16, fast return (~2 seconds)
| Natural Language |
Command |
Description |
| FLOPS test |
ascend-dmi -f -d 0 -t fp16 -q |
Default: NPU 0, FP16 |
| NPU FLOPS |
ascend-dmi -f -d 0 -t fp16 -q |
Same as above |
| NPU 3 FLOPS |
ascend-dmi -f -d 3 -t fp16 -q |
Specify NPU 3 |
| FP32 FLOPS |
ascend-dmi -f -d 0 -t fp32 -q |
FP32 precision |
| All devices FLOPS |
8 devices async parallel |
All NPUs tested simultaneously |
Execution strategy:
- Single device: Direct execution, ~2 seconds return
- Multi-device: Async parallel execution, total ~2 seconds (not serial 16 seconds)
- Precision: Default fp16, supports fp32/bf16/int8/hf32
Performance Optimization
| Optimization |
Description |
Effect |
| SSH persistent connection |
ControlMaster reuse |
Connection time ~0.1s |
| Batch execution |
execute_batch() for multiple commands |
Reduce SSH round trips |
| Parallel query |
test_flops_parallel() 8-device async test |
16s -> 2s |
| Single parse |
parse_full_info() get all card info at once |
O(N) -> O(1) |
Troubleshooting
Command Not Recognized
- Check if input contains supported keywords
- Try using more explicit commands
SSH Connection Failed
- Verify SSH parameters are correct
- Ensure SSH service is running on target machine
npu-smi Not Available
- Ensure CANN and npu-smi are installed on target machine
- Check LD_LIBRARY_PATH environment variable
Notes
Security Warnings
- Sensitive operations require user confirmation before execution
- Passwords are only stored in memory during session
- Blocked commands cannot be bypassed
Limitations
- Requires npu-smi or ascend-dmi installed on target machine
- SSH password authentication only (no interactive password prompt)
Best Practices
Best Practices
Connection Mode Selection
- Local direct: For NPU installed on local machine
- SSH remote: For managing remote Ascend servers
Command Execution Tips
- Sensitive ops (firmware upgrade, config change) require user confirmation
- Test on single card before batch operations
Performance Monitoring
- Regularly check NPU temperature and power
- Monitor HBM usage to avoid OOM
Troubleshooting
- First check NPU health:
npu-smi info
- View detailed error log:
npu-smi info -t board -i <npu_id>
- See troubleshooting.md
Trigger Keywords
- Chinese: NPU, 昇腾, 显存, 算力, 温度, 功耗, 固件, 虚拟化
- English: npu, ascend, temperature, power, HBM, firmware, vNPU, FLOPS
Directory Structure
huawei-cloud-ascend-command/
├── SKILL.md # Skill description (required)
├── scripts/ # Scripts directory (required)
│ ├── __init__.py # Module export
│ ├── main.py # Skill entry file (required)
│ ├── executor.py # NPU command executor
│ └── npu_client.py # NPU client
└── references/ # Reference documentation
├── acceptance-criteria.md # Acceptance criteria
├── verification-method.md # Verification steps
├── troubleshooting.md # Troubleshooting guide
├── device-queries.md # Device queries reference
├── configuration.md # Configuration reference
├── firmware-upgrade.md # Firmware upgrade reference
├── virtualization.md # Virtualization reference
└── certificate-management.md # Certificate management
References
| Document |
Description |
| acceptance-criteria.md |
Acceptance criteria for skill validation |
| verification-method.md |
Verification steps and test methods |
| troubleshooting.md |
Troubleshooting guide and common issues |
| device-queries.md |
Device queries command reference |
| configuration.md |
Configuration management reference |
| firmware-upgrade.md |
Firmware upgrade reference |
| virtualization.md |
Virtualization management reference |
| certificate-management.md |
Certificate management reference |
Technical Support
1---2name: huawei-cloud-ascend-command3description: Huawei Ascend NPU natural language management skill, supporting both local direct connection and SSH remote modes. Provides comprehensive npu-smi command capabilities including device queries, configuration management, firmware upgrade, vNPU virtualization, certificate management, and compute power testing (FLOPS). Enables remote management and monitoring of Ascend NPU devices with real-time metrics tracking. Use this skill when the user wants to: (1) query NPU device status and health, (2) monitor temperature, power, memory/HBM utilization, (3) configure ECC settings and fan modes, (4) perform firmware upgrades, (5) manage vNPU virtualization, (6) run compute power tests, (7) check certificate information. Trigger: user mentionsnpu', 'ascend', 'NPU', 'Ascend', 'temperature', 'power', 'HBM', 'firmware', 'upgrade', 'vNPU', 'virtualization', 'certificate', 'FLOPS', 'compute', 'health', 'memory', 'utilization', 'ECC', 'fan', '昇腾', '昇腾卡', '昇腾状态', '显存', '算力', '设备查询', 'NPU监控'"4---5Provides Huawei Ascend NPU natural language command translation and execution. Supports full npu-smi commands: device queries, configuration management, firmware upgrade, vNPU virtualization, certificate management, and compute power testing.
6
7## Overview
8
9This skill provides natural language management for Huawei Ascend NPU devices via npu-smi commands. Supports both local direct execution and SSH remote modes.
10
11**Related Skills**:
12- `huawei-cloud-ascend-remote-connect` - General SSH remote operations (disk, Docker, logs, processes)
13- `npu-smi-skill` - Alternative NPU management implementation
14- `model-deploy-test-skill` - Model deployment and testing on Ascend DevServer
15
16**Capabilities**:
17- Device queries (health, temperature, power, HBM, ECC, topology)
18- Configuration management (ECC, fan mode, fan speed)
19- Firmware upgrade and status
20- vNPU virtualization
21- Certificate management
22- Compute power testing (FLOPS)
23
24## Architecture
25
26### System Architecture Diagram
27
28```
29┌─────────────────────────────────────────────────────────────────────┐
30│ Agent Orchestration │
31│ ┌─────────────────────────────────────────────────────────────┐ │
32│ │ 1. Parse user intent → Match Trigger keywords │ │
33│ │ 2. Prepare params → host, user, password explicit │ │
34│ │ 3. Invoke Skill → skill exec --name ascend-command │ │
35│ │ 4. Return result → User │ │
36│ └────────────────────────────┬────────────────────────────────┘ │
37│ │ Explicit param passing (Rule 1) │
38│ ▼ │
39├─────────────────────────────────────────────────────────────────────┤
40│ User Interaction Layer │
41│ ┌─────────────────────────────────────────────────────────────┐ │
42│ │ Natural Language Commands / CLI Arguments │ │
43│ │ (NPU health check, temperature, firmware upgrade) │ │
44│ └────────────────────────────┬────────────────────────────────┘ │
45│ │ │
46│ ▼ │
47├─────────────────────────────────────────────────────────────────────┤
48│ Skill Core Components (Stateless (Rule 2)) │
49│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │
50│ │ Command Executor│←→│ NPU Client │←→│ Trend Recorder │ │
51│ │ - NL Parsing │ │ - npu-smi cmd │ │ - Metric Log │ │
52│ │ - Command Route│ │ - Local/SSH │ │ - Trend Analysis│ │
53│ └─────────────────┘ └─────────────────┘ └─────────────────┘ │
54│ │ │ │
55│ ▼ ▼ │
56├─────────────────────────────────────────────────────────────────────┤
57│ Huawei Cloud Ascend Infrastructure │
58│ Data Flow: Agent → Skill(host,user,pwd) → SSH → npu-smi → Response │
59└─────────────────────────────────────────────────────────────────────┘
60```
61
62### Agent Orchestration Flow
63
64```
65User request: "Query NPU status on 116.204.23.145"
66 │
67 ▼
68┌─────────────────────────────────────────────────────────────┐
69│ Agent parses intent │
70│ - Keyword "NPU" → Match ascend-command │
71│ - IP address → SSH params needed │
72└─────────────────────────────────────────────────────────────┘
73 │
74 ▼
75┌─────────────────────────────────────────────────────────────┐
76│ Agent prepares params (explicit, Rule 1) │
77│ --host 116.204.23.145 │
78│ --user root │
79│ --password *** │
80│ --command "NPU list" │
81└─────────────────────────────────────────────────────────────┘
82 │
83 ▼
84┌─────────────────────────────────────────────────────────────┐
85│ Skill executes (Stateless, Rule 2) │
86│ - NpuClient(host, user, password) explicit receive │
87│ - Execute npu-smi command │
88│ - Return result │
89└─────────────────────────────────────────────────────────────┘
90 │
91 ▼
92 Return to user
93```
94
95### Related Skills (Agent orchestrated, no direct call, Rule 3)
96
97| Skill | Purpose | Orchestration Scenario |
98|-------|------|----------|
99| `huawei-cloud-ascend-remote-connect` | SSH remote ops | Agent selects when user needs disk/Docker/logs |
100| `npu-smi-skill` | NPU management | Alternative impl, Agent selects by scenario |
101| `model-deploy-test-skill` | Model deploy | Use ascend-command to monitor NPU after deploy |
102
103**Note**: No direct calls between Skills, orchestrated by Agent based on user intent.
104
105## Prerequisites
106
107### System Requirements
108
109- Python 3.8+
110- Pure Python standard library implementation, no additional dependencies required
111
112### Environment Check
113
114> **Prerequisite check: Python3 required**
115> ```bash
116> python3 --version # Python3 >= 3.8
117> ```
118
119## Authentication
120
121> **Security rules (must be followed):**
122> - **Prohibited** from reading, echoing, or printing password values
123> - **Prohibited** from asking the user to input passwords directly in the conversation
124> - **Only allowed** to read credentials from command line arguments
125
126## Parameter Confirmation
127
128### Input Parameters
129
130| Parameter | Required | Description |
131|-----------|----------|-------------|
132| command | Yes (one-shot) | Natural language command to execute |
133| host | No | SSH remote host IP address |
134| user | No | SSH username |
135| password | No | SSH password |
136
137### Confirmation Requirements
138
139The following operations require explicit user confirmation:
140- ECC enable/disable
141- Fan mode changes
142- Firmware upgrade
143- vNPU creation/deletion
144- Certificate management
145
146## Core Workflow
147
148### Task 1: One-Shot Command Execution
149
150```bash
151python3 scripts/main.py --command "NPU health check"
152```
153
154### Task 2: SSH Remote Execution
155
156```bash
157python3 scripts/main.py --command "NPU list" --host 192.168.1.100 --user root --password xxx
158```
159
160### Task 3: Interactive Mode
161
162```bash
163python3 scripts/main.py
164```
165
166## Usage Instructions
167
168### Device Queries
169
170```
171List all NPU devices
172NPU health check
173Get NPU temperature
174Get NPU power usage
175Get NPU memory info
176```
177
178### Configuration Management
179
180```
181Set ECC mode
182Set fan mode
183```
184
185### Firmware Upgrade
186
187```
188Query firmware version
189Upgrade firmware
190```
191
192### Virtualization
193
194```
195Query vNPU info
196Create vNPU
197```
198
199### FLOPS Test
200
201```
202Run FLOPS test
203Run FP32 FLOPS test
204Run multi-device FLOPS test
205```
206
207---
208
209## Output Format
210
211### Standard Response Format
212
213All command outputs follow a structured format:
214
215```json
216{
217 "status": "success",
218 "command": "npu-smi info -l",
219 "description": "List all NPU devices"
220}
221```
222
223### Error Response Format
224
225```
226[ERROR] <error-code>
227Message: <error-description>
228Suggestion: <troubleshooting-tip>
229```
230
231---
232
233## Verification Method
234
235### Basic Verification Steps
236
2371. **Environment Check**
238 ```bash
239 python3 --version # Verify Python 3.8+
240 ```
241
2422. **Local Command Test**
243 ```bash
244 python3 scripts/main.py --command "NPU list"
245 ```
246
2473. **Remote Command Test**
248 ```bash
249 python3 scripts/main.py --host <ascend-ip> --user root --password <pwd> --command "NPU health check"
250 ```
251
252### Expected Results
253
254| Test Case | Expected Output |
255|-----------|----------------|
256| Environment check | Python version >= 3.8 |
257| Local command | NPU device information or "npu-smi not found" |
258| Remote command | NPU status from remote server |
259
260---
261
262## Script Files
263
264### Entry File
265
266- **main.py**: Skill entry file (required)
267 - Function: Provide interactive mode, one-shot mode, SSH remote mode
268 - Supports: Command line arguments, interactive prompt
269
270### Core Scripts
271
272- **executor.py**: NPU command executor (main entry)
273 - Function: Natural language parsing, command routing, sensitive operation confirmation
274 - Supported commands: Device queries, configuration, firmware upgrade, virtualization, certificate management
275 - Core methods: `handle_command(text)`, `confirm_sensitive()`
276
277- **npu_client.py**: NPU client
278 - Function: Wraps npu-smi command execution, supports local and SSH remote execution
279 - Core methods: `list_devices()`, `get_health()`, `get_temperature()`, `get_power()`, `get_memory()`, `set_ecc_enable()`, `upgrade_query()`, `create_vnpu()`, `get_tls_cert()`
280 - Optimization: SSH ControlMaster, batch execution, parallel FLOPS testing
281
282---
283
284## Command Translation Mapping
285
286### Device Queries
287
288| Natural Language | Command | Description |
289|-----------------|---------|-------------|
290| List all NPU devices | `npu-smi info -l` | List all NPU devices |
291| NPU card info | `npu-smi info -m` | Card and chip mapping |
292| NPU info | `npu-smi info` | Full NPU information |
293
294### Health Check
295
296| Natural Language | Command | Description |
297|-----------------|---------|-------------|
298| NPU health check | `npu-smi info -t health -i 0` | Check device health |
299| Check NPU status | `npu-smi info -t health -i 0` | Check device health |
300
301### Temperature/Power/Memory
302
303| Natural Language | Command | Description |
304|-----------------|---------|-------------|
305| NPU temperature | `npu-smi info -t temp -i 0 -c 0` | Get temperature |
306| NPU power | `npu-smi info -t power -i 0 -c 0` | Get power usage |
307| NPU memory | `npu-smi info -t memory -i 0 -c 0` | Get memory info |
308| NPU utilization | `npu-smi info -t usages -i 0 -c 0` | Get utilization |
309
310### Configuration
311
312| Natural Language | Command | Description |
313|-----------------|---------|-------------|
314| Set ECC | `npu-smi set -t ecc-enable -i 0 -c 0 -d 1` | Enable ECC (requires confirmation) |
315| Set fan mode | `npu-smi set -t pwm-mode -d 0` | Set fan mode (requires confirmation) |
316
317### Firmware Upgrade
318
319| Natural Language | Command | Description |
320|-----------------|---------|-------------|
321| Firmware version | `npu-smi upgrade -b mcu -i 0` | Query firmware version |
322| Upgrade firmware | `npu-smi upgrade -t mcu -i 0 -f file.hpm` | Upload firmware (requires confirmation) |
323
324### Virtualization
325
326| Natural Language | Command | Description |
327|-----------------|---------|-------------|
328| vNPU info | `npu-smi info -t info-vnpu -i 0 -c 0` | Query vNPU info |
329| Template info | `npu-smi info -t template-info -i 0` | Query template info |
330| Create vNPU | `npu-smi set -t create-vnpu -i 0 -c 0 -f vir04` | Create vNPU (requires confirmation) |
331
332### Certificate Management
333
334| Natural Language | Command | Description |
335|-----------------|---------|-------------|
336| Certificate info | `npu-smi info -t tls-cert -i 0 -c 0` | View TLS certificate |
337| Certificate expiration | `npu-smi info -t tls-cert-period -i 0 -c 0` | Query certificate expiration threshold |
338
339### FLOPS Test (ascend-dmi)
340
341**Default behavior: single device FP16, fast return (~2 seconds)**
342
343| Natural Language | Command | Description |
344|-----------------|---------|-------------|
345| FLOPS test | `ascend-dmi -f -d 0 -t fp16 -q` | Default: NPU 0, FP16 |
346| NPU FLOPS | `ascend-dmi -f -d 0 -t fp16 -q` | Same as above |
347| NPU 3 FLOPS | `ascend-dmi -f -d 3 -t fp16 -q` | Specify NPU 3 |
348| FP32 FLOPS | `ascend-dmi -f -d 0 -t fp32 -q` | FP32 precision |
349| All devices FLOPS | 8 devices async parallel | All NPUs tested simultaneously |
350
351**Execution strategy:**
352- **Single device**: Direct execution, ~2 seconds return
353- **Multi-device**: Async parallel execution, total ~2 seconds (not serial 16 seconds)
354- **Precision**: Default fp16, supports fp32/bf16/int8/hf32
355
356---
357
358## Performance Optimization
359
360| Optimization | Description | Effect |
361|-------------|-------------|--------|
362| SSH persistent connection | ControlMaster reuse | Connection time ~0.1s |
363| Batch execution | `execute_batch()` for multiple commands | Reduce SSH round trips |
364| Parallel query | `test_flops_parallel()` 8-device async test | 16s -> 2s |
365| Single parse | `parse_full_info()` get all card info at once | O(N) -> O(1) |
366
367---
368
369## Troubleshooting
370
371### Command Not Recognized
372- Check if input contains supported keywords
373- Try using more explicit commands
374
375### SSH Connection Failed
376- Verify SSH parameters are correct
377- Ensure SSH service is running on target machine
378
379### npu-smi Not Available
380- Ensure CANN and npu-smi are installed on target machine
381- Check LD_LIBRARY_PATH environment variable
382
383---
384
385## Notes
386
387### Security Warnings
388
389- Sensitive operations require user confirmation before execution
390- Passwords are only stored in memory during session
391- Blocked commands cannot be bypassed
392
393### Limitations
394
395- Requires npu-smi or ascend-dmi installed on target machine
396- SSH password authentication only (no interactive password prompt)
397
398---
399
400
401## Best Practices
402
403### Best Practices
404
4051. **Connection Mode Selection**
406 - Local direct: For NPU installed on local machine
407 - SSH remote: For managing remote Ascend servers
408
4092. **Command Execution Tips**
410 - Sensitive ops (firmware upgrade, config change) require user confirmation
411 - Test on single card before batch operations
412
4133. **Performance Monitoring**
414 - Regularly check NPU temperature and power
415 - Monitor HBM usage to avoid OOM
416
4174. **Troubleshooting**
418 - First check NPU health: `npu-smi info`
419 - View detailed error log: `npu-smi info -t board -i <npu_id>`
420 - See [troubleshooting.md](references/troubleshooting.md)
421
4225. **Trigger Keywords**
423 - Chinese: NPU, 昇腾, 显存, 算力, 温度, 功耗, 固件, 虚拟化
424 - English: npu, ascend, temperature, power, HBM, firmware, vNPU, FLOPS
425
426## Directory Structure
427
428```
429huawei-cloud-ascend-command/
430├── SKILL.md # Skill description (required)
431├── scripts/ # Scripts directory (required)
432│ ├── __init__.py # Module export
433│ ├── main.py # Skill entry file (required)
434│ ├── executor.py # NPU command executor
435│ └── npu_client.py # NPU client
436└── references/ # Reference documentation
437 ├── acceptance-criteria.md # Acceptance criteria
438 ├── verification-method.md # Verification steps
439 ├── troubleshooting.md # Troubleshooting guide
440 ├── device-queries.md # Device queries reference
441 ├── configuration.md # Configuration reference
442 ├── firmware-upgrade.md # Firmware upgrade reference
443 ├── virtualization.md # Virtualization reference
444 └── certificate-management.md # Certificate management
445```
446
447## References
448
449| Document | Description |
450|----------|-------------|
451| [acceptance-criteria.md](references/acceptance-criteria.md) | Acceptance criteria for skill validation |
452| [verification-method.md](references/verification-method.md) | Verification steps and test methods |
453| [troubleshooting.md](references/troubleshooting.md) | Troubleshooting guide and common issues |
454| [device-queries.md](references/device-queries.md) | Device queries command reference |
455| [configuration.md](references/configuration.md) | Configuration management reference |
456| [firmware-upgrade.md](references/firmware-upgrade.md) | Firmware upgrade reference |
457| [virtualization.md](references/virtualization.md) | Virtualization management reference |
458| [certificate-management.md](references/certificate-management.md) | Certificate management reference |
459
460## Technical Support
461
462- Ascend Official Documentation: https://www.hiascend.com/document
463- npu-smi Command Reference: https://www.hiascend.com/document/detail/zh/Atlas%20200I%20A2/260RC1/re/npu/npusmi_007.html