Host Directories Unmounted to Container
Prerequisites
- The driver software package has been installed on the host. For details, see Installing the Driver.
- You need to install Docker on the host. If NPU 20.0.X or NPU 20.1.X software packages are used for installation, the Docker version must be 18.03 or later.
- Run the following command to restart the Docker service:
systemctl daemon-reload systemctl restart docker
- Obtain the OS image. For example, if the container image is Ubuntu 18.04, run the following command:
docker pull ubuntu:18.04
If the obtained OS image version is incorrect, you are advised to obtain the correct OS image version from Ascend Hub.
- View the image:
docker images
Procedure
- Run the id HwHiAiUser command on the host to check the gid value of HwHiAiUser on the host. In the example shown in Figure 12-3, the gid value is 1001.If the NPU 20.1.X or later software package is used for installation and you use the --install-username=username --install-usergroup=usergroup parameters to specify a non-root user when installing the driver runfile, you need to use the same method to note down the gid of the non-root user. This gid is required when creating a non-root user in the container, ensure that the non-root users who start the related process in the host and container are in the same group.
- Create and start a Docker container on the host.
Mount the parameters listed in Table 12-3 to the container.
Table 12-3 Parameter descriptionParameter
Description
--device
Indicates the mapped device.
-v /usr/local/dcmi:/usr/local/dcmi
Mounts the .so dcmi file and the interface file directory /usr/local/dcmi on the host to the container. Change them as required.
-v /usr/local/sbin/npu-smi:/usr/local/sbin/npu-smi
If the NPU 20.0.0 software package is used for installation, mount the npu-smi tool /usr/local/sbin/npu-smi on the host to the container. Change the directory to the actual one.
-v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi
If NPU 20.0.0 or later or NPU 20.1.X or later software packages are used for installation, mount the npu-smi tool /usr/local/bin/npu-smi on the host to the container. Change the directory to the actual one.
-v /var/log/npu/slog/container/container_name:/var/log/npu/slog
If software packages of NPU 20.0.0 or later or NPU 20.1.X or later are used for installation, mount the host log path /var/log/npu/slog/container/container_name to the container. Change it based on actual situation.
-v /var/log/npu/conf/slog/slog.conf:/var/log/npu/conf/slog/slog.conf
If software packages of NPU 20.0.0 or later or NPU 20.1.X or later are used for installation, mount the host log configuration file /var/log/npu/conf/slog/slog.conf to the container. Change it based on actual situation.
- Create a running user in the container to start related process. (If NPU 20.1.X or later software packages are used for installation, the running user is a non-root user, for example, HwHiAiUser.) If the running user is the root user, skip this step.
groupadd -g gid HwHiAiUser && useradd -g HwHiAiUser -d /home/HwHiAiUser -m HwHiAiUser && echo ok
Replace the gid value in the preceding command with that obtained in 1. If ok is returned, the creation is successful.
If a non-root user is created, ensure that the owner group of the non-root user is the same as that of the user who runs Driver. If they are different, add them to the Driver running user group.
- Run the exit command to exit the container. In the path of the driver package on the host, run the following command to copy the software package to the container:
docker cp /xxx/*.run container_id:/home/HwHiAiUser/software
In the preceding command, xxx indicates the path of the software package on the host, *.run indicates the software package name, container_id indicates the container ID. You can run the docker ps -a command to view the ID of the container in use. /home/HwHiAiUser/software indicates the path for storing the software package in the container. If the path does not exist, create it manually.
- Start the container again, switch to the HwHiAiUser user, go to the software directory, and install the driver software package by referring to Table 12-4.
docker start xxx docker attach xxx
Replace xxx with the container ID or name.Table 12-4 Installation commandsComponent
Installation Command
Installation User
Running User
Multi-Version Installation Support
Remarks
Driver
./*.run --docker
Default installation path: /usr/local/Ascend
Or a user-defined installation path specified using the --install-path=<path> argument
Root user
HwHiAiUser
or a non-root user specified using the --install-username=username --install-usergroup=usergroup arguments
Not supported
For more installation modes, see Parameter Description.
If no error is displayed during the installation, the installation is successful.
- Default installation path: /usr/local/Ascend
- Installation log path: /var/log/ascend_seclog/ascend_install.log
- Path for storing the installation path, installation command, and user information of the software package after installation: /etc/ascend_install.info
- If you use the software package of NPU 20.2.X or later, you only need to perform If you use the software package of NPU 20.2.X, ... to set the environment variable. If the NPU 20.0.X or NPU 20.1.X software package is used for installation, you need to perform the following steps to start the slogd daemon process.
- Set the environment variable (an environment variable set in export mode takes effect only in the current window and takes effect immediately):
- If you use the software package of NPU 20.0.X or NPU 20.1.X, run the following command:
export LD_LIBRARY_PATH=/usr/local/Ascend/driver/lib64:/usr/local/Ascend/add-ons:$LD_LIBRARY_PATH
- If you use the software package of NPU 20.2.X or later, run the following command:
export LD_LIBRARY_PATH=/usr/local/Ascend/driver/lib64:$LD_LIBRARY_PATH
In the preceding command, /usr/local/Ascend is the default installation path. Replace it as required.
- If you use the software package of NPU 20.0.X or NPU 20.1.X, run the following command:
- Create log files and start the slogd process.
mkdir -p /usr/slog mkdir -p /var/log/npu/slog/slogd chown -Rf HwHiAiUser:HwHiAiUser /usr/slog chown -Rf HwHiAiUser:HwHiAiUser /var/log/npu/slog su HwHiAiUser --command "/usr/local/Ascend/driver/tools/slogd &"
- Check the slogd process and check if the Driver component is successfully installed:
ps -ef | grep -v grep | grep "tools/slogd"
If the following messages are returned, the process is started and the Driver component is installed successfully:
root@ascend-HP-ProDesk-600-G4-PCI-MT:/var/log/npu/conf/slog# ps -ef | grep -v grep | grep "tools/slogd" HwHiAiU+ 38 1 0 07:03 ? 00:00:00 /usr/local/Ascend/driver/tools/slogd
- Set the environment variable (an environment variable set in export mode takes effect only in the current window and takes effect immediately):