Usage on the Docker Client
- Ascend Docker Runtime supports mounting physical and virtual chips. Before mounting virtual chips, refer to Creating vNPUs to virtualize physical chips. Both static virtualization and dynamic virtualization of physical chips are supported.
- You can query the currently available physical chip IDs by running the
ls /dev/davinci*command, and query the currently available virtual chip IDs by running thels /dev/vdavinci*command. - If you do not need to mount all the content in the default configuration file
/etc/ascend-docker-runtime.d/base.listof Ascend Docker Runtime, create a custom configuration file (for example,hostlog.list) to reduce the mounted content. For details, see (Optional) Configuring Custom Mounted Content.
In the examples, image-name:tag represents the image name and tag. For details about other parameters, see Table 1.
Example 1: Mount the physical chip with chip ID 0 when starting the container.
docker run -it -e ASCEND_VISIBLE_DEVICES=0 {image-name:tag} /bin/bashExample 2: Mount only the NPU device and management device when starting the container, without mounting driver-related directories.
docker run --rm -it -e ASCEND_VISIBLE_DEVICES=0 -e ASCEND_RUNTIME_OPTIONS=NODRV {image-name:tag} /bin/bashExample 3: Mount the physical chip with chip ID 0 when starting the container, and read the mount content from the custom configuration file
hostlog.list.docker run --rm -it -e ASCEND_VISIBLE_DEVICES=0 -e ASCEND_RUNTIME_MOUNTS=hostlog {image-name:tag} /bin/bashExample 4: Mount the chip with virtual chip ID 100 when starting the container.
docker run -it -e ASCEND_VISIBLE_DEVICES=100 -e ASCEND_RUNTIME_OPTIONS=VIRTUAL {image-name:tag} /bin/bashExample 5: When starting the container, slice 4 AICores from the chip with physical chip ID 0 as virtual devices and mount them to the container.
docker run -it --rm -e ASCEND_VISIBLE_DEVICES=0 -e ASCEND_VNPU_SPECS=vir04 {image-name:tag} /bin/bashExample 6: When starting the container, mount the chip with physical chip ID 0, and allow soft links in the mounted driver files (applicable only to Atlas 500 A2 intelligent station, Atlas 200I A2 accelerator module, and Atlas 200I DK A2):
docker run --rm -it -e ASCEND_VISIBLE_DEVICES=0 -e ASCEND_ALLOW_LINK=True {image-name:tag} /bin/bash
After the container is started, run the following commands inside and outside the container to check whether the corresponding devices and drivers are mounted successfully. For the specific mount directory of each model, refer to Content Mounted by Ascend Docker Runtime. Example commands are as follows:
ls /dev | grep davinci* && ls /dev | grep devmm_svm && ls /dev | grep hisi_hdc && ls /usr/local/Ascend/driver && ls /usr/local/ |grep dcmi && ls /usr/local/binPossible outputs:
davinci0
davinci_manager
devmm_svm
hisi_hdc
include lib64
dcmi
npu-smiUse Ascend Docker Runtime to support containers running training, inference, or other tasks.
Taking the Atlas 200I SoC A1 core board running an inference container as an example, modify the command according to the actual situation. The example is as follows, and the related parameters are shown in Table 1 and Table 2.
docker run -it -e ASCEND_VISIBLE_DEVICES=0 --device=/dev/xsmem_dev:rwm --device=/dev/event_sched:rwm --device=/dev/svm0:rwm --device=/dev/sys:rwm --device=/dev/vdec:rwm --device=/dev/vpc:rwm --device=/dev/log_drv:rwm --device=/dev/spi_smbus:rwm --device=/dev/upgrade:rwm --device=/dev/user_config:rwm --device=/dev/ts_aisle:rwm --device=/dev/memory_bandwidth:rwm -v /var/dmp_daemon:/var/dmp_daemon:ro -v /var/slogd:/var/slogd:ro -v /var/log/npu/conf/slog/slog.conf:/var/log/npu/conf/slog/slog.conf:ro -v /usr/local/Ascend/driver/tools:/usr/local/Ascend/driver/tools -v /usr/local/Ascend/driver/lib64:/usr/local/Ascend/driver/lib64 -v /usr/lib64/aicpu_kernels:/usr/lib64/aicpu_kernels:ro -v /sys/fs/cgroup/memory:/sys/fs/cgroup/memory:ro -v /usr/lib64/libyaml-0.so.2:/usr/lib64/libyaml-0.so.2:ro -v /etc/ascend_install.info:/etc/ascend_install.info -v /usr/local/Ascend/driver/version.info:/usr/local/Ascend/driver/version.info workload-image:v1.0 /bin/bashNOTE
- If the driver of the Atlas 200I SoC A1 core board is version 1.0.0 (Ascend HDK 22.0.0) or earlier, you need to mount
/dev/xsmem_devand/dev/event_sched. - If the driver of the Atlas 200I SoC A1 core board is later than version 1.0.0 (Ascend HDK 22.0.0), you do not need to mount
/dev/xsmem_devand/dev/event_sched.
- If the driver of the Atlas 200I SoC A1 core board is version 1.0.0 (Ascend HDK 22.0.0) or earlier, you need to mount
Taking the Atlas 500 A2 intelligent station running an inference container as an example, modify the command according to the actual situation. The example is as follows, and the related parameters are shown in Table 1 and Table 2.
docker run --rm -it -e ASCEND_VISIBLE_DEVICES=0 -e ASCEND_ALLOW_LINK=True workload-image:v1.0 /bin/bash
Taking the Atlas 200I SoC A1 core board running an inference container as an example, modify the command according to the actual situation. The example is as follows, and the related parameters are shown in Table 2.
docker run -it --device=/dev/davinci0:rwm --device=/dev/xsmem_dev:rwm --device=/dev/event_sched:rwm --device=/dev/svm0:rwm --device=/dev/sys:rwm --device=/dev/vdec:rwm --device=/dev/venc:rwm --device=/dev/vpc:rwm --device=/dev/davinci_manager:rwm --device=/dev/spi_smbus:rwm --device=/dev/upgrade:rwm --device=/dev/user_config:rwm --device=/dev/ts_aisle:rwm --device=/dev/memory_bandwidth:rwm -v /etc/sys_version.conf:/etc/sys_version.conf:ro -v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi:ro -v /var/dmp_daemon:/var/dmp_daemon:ro -v /var/slogd:/var/slogd:ro -v /var/log/npu/conf/slog/slog.conf:/var/log/npu/conf/slog/slog.conf:ro -v /etc/hdcBasic.cfg:/etc/hdcBasic.cfg:ro -v /usr/local/Ascend/driver/tools:/usr/local/Ascend/driver/tools -v /usr/local/Ascend/driver/lib64:/usr/local/Ascend/driver/lib64 -v /usr/lib64/aicpu_kernels:/usr/lib64/aicpu_kernels:ro -v /sys/fs/cgroup/memory:/sys/fs/cgroup/memory:ro -v /usr/lib64/libyaml-0.so.2:/usr/lib64/libyaml-0.so.2:ro -v /etc/ascend_install.info:/etc/ascend_install.info -v /usr/local/Ascend/driver/version.info:/usr/local/Ascend/driver/version.info workload-image:v1.0 /bin/bash- If the driver of the Atlas 200I SoC A1 core board is version 1.0.0 (Ascend HDK 22.0.0) or earlier, you need to mount
/dev/xsmem_devand/dev/event_sched. - If the driver of the Atlas 200I SoC A1 core board is a version later than 1.0.0 (Ascend HDK 22.0.0), you do not need to mount
/dev/xsmem_devand/dev/event_sched.
- If the driver of the Atlas 200I SoC A1 core board is version 1.0.0 (Ascend HDK 22.0.0) or earlier, you need to mount
To run inference tasks on the Atlas 500 A2 intelligent station without using Ascend Docker Runtime, refer to the "Starting the Container" section in "Deploying Ascend Software (Customized System Scenario) > Container Deployment > Creating a Container Image" in the Atlas 500 A2 Intelligent Station Ascend Software Installation Guide.
Table 1 Ascend Docker Runtime running parameters
| Parameter | Description | Example |
|---|---|---|
| ASCEND_VISIBLE_DEVICES |
|
NOTE |
| ASCEND_ALLOW_LINK | Specifies whether soft links are allowed in the mounted files or directories. This parameter must be specified in scenarios involving the Atlas 500 A2 Smart Station, Atlas 200I A2 acceleration module, and Atlas 200I DK A2 developer kit. Other devices, such as Atlas training series products, |
|
| ASCEND_RUNTIME_OPTIONS | Restricts the chip ID specified in the ASCEND_VISIBLE_DEVICES parameter:
|
NOTE
|
| ASCEND_RUNTIME_MOUNTS | Specifies the configuration file name for the content to be mounted. This file can configure the files and directories to be mounted to the container. |
|
| ASCEND_VNPU_SPECS | Partitions a certain number of AICores from a physical NPU device and specifies them as virtual devices. For supported values, see the "Virtualization Instance Template" column in Table 1 of Virtualization Templates.
| ASCEND_VNPU_SPECS=vir04 indicates that 4 AICores are partitioned as virtual devices and mounted to the container. |
Table 2 Explanation of other parameters
| Parameter | Description |
|---|---|
| /dev/xsmem_dev | Mounts the memory device management to the container. |
| /dev/event_sched | Mounts the event scheduling device to the container. |
| /dev/ts_aisle | Mounts the device corresponding to the aicpudrv driver to the container. |
| /dev/svm0 | Mounts the memory management device to the container. |
| /dev/sys | Mounts dvpp-related devices to the container. |
| /dev/vdec | Mounts dvpp-related devices to the container. |
| /dev/vpc | Mounts dvpp-related devices to the container. |
| /dev/log_drv | Mounts the logging-related device to the container. |
| /dev/upgrade | Mounts the device for obtaining Ascend system-related configurations and firmware to the container. |
| /dev/spi_smbus | Mounts the device related to out-of-band SPI communication to the container. |
| /dev/user_config | Mounts the device for managing user configurations to the container. |
| /dev/memory_bandwidth | Mounts the memory bandwidth-related device to the container. |
| -v /var/slogd:/var/slogd | Mounts the host machine log process file to the container in read-only mode. |
| -v /var/dmp_daemon:/var/dmp_daemon | Mounts the dmp daemon to the container. |
| -v /var/log/npu/conf/slog:/var/log/npu/conf/slog | Mounts the NPU log module to the container. |
| -v /usr/lib64/libyaml-0.so.2:/usr/lib64/libyaml-0.so.2:ro | Mounts the host machine libyaml .so file to the container. |
| -v /usr/local/Ascend/driver/tools:/usr/local/Ascend/driver/tools | Mounts the driver-related tools directory "/usr/local/Ascend/driver/tools" to the container. |
| -v /usr/local/Ascend/driver/lib64:/usr/local/Ascend/driver/lib64 | Mounts the driver-dependent dynamic library directory "/usr/local/Ascend/driver/lib64" to the container. |
| -v /usr/lib64/aicpu_kernels:/usr/lib64/aicpu_kernels | Mounts the aicpu lib library directory "/usr/lib64/aicpu_kernels" to the container. |
| -v /sys/fs/cgroup/memory:/sys/fs/cgroup/memory:ro | Mounts the dependency directory "/sys/fs/cgroup/memory" required for querying memory usage on the host machine to the container in read-only mode. |
| -v /etc/ascend_install.info:/etc/ascend_install.info | Mounts the host machine installation information file "/etc/ascend_install.info" to the container. |
| -v /usr/local/Ascend/driver/version.info:/usr/local/Ascend/driver/version.info | Mounts the host machine version information file "/usr/local/Ascend/driver/version.info" to the container. Modify it based on the actual situation. |
| workload-image:v1.0 | The generated image file. |
| /bin/bash | Starts an interactive terminal Bash Shell in the container. |