Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
songlinfeng
container-toolkit
Commits
d4b6e644
Commit
d4b6e644
authored
Oct 28, 2025
by
songlinfeng
💬
Browse files
Update README.md
parent
0da9d5a2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
5 deletions
+51
-5
README.md
README.md
+51
-5
No files found.
README.md
View file @
d4b6e644
...
...
@@ -3,29 +3,36 @@
## 简介
DTK Container Toolkit 使用户能够构建和运行使用DCU设备的容器,该toolkit包括以下工具包。
```
dtk-container-toolkit``` - DTK容器运行时
```dtk-ctk``` - DTK容器工具集命令行
## 使用
-
```dtk-container-toolkit```
- DTK容器运行时
-
```dtk-ctk```
- DTK容器工具集命令行
## 使用
-
--gpus需要Docker version 19+
-
cdi 需要Docker version 25+
首先确保已经安装好DTK。
### 安装
使用 dpkg/rpm -i 进行安装。
使用 dpkg/rpm -i 进行安装。安装后会自动执行以下命令
```
sh
$
dtk-ctk
--quiet
config
--config-file
=
/etc/dtk-container-runtime/config.toml
--in-place
#生成配置文件
$
dtk-ctk runtime configure
--runtime
=
docker
--set-as-default
#修改docker的config.json的runtime
```
重启docker服务
```
sh
$
sudo
systemctl restart docker
```
### 在
容器
中使用
H
CU
### 在
docker
中使用
D
CU
#### 通过 docker CLI
可以通过 docker run 添加参数 --gpus 给容器添加HCU设备。
```
sh
$
docker run
-it
--gpus
all ubuntu:18.04
# 添加所有HCU设备
$
docker run
-it
--gpus
1 ubuntu:18.04
# 添加一个HCU设备,HCU 0
$
docker run
-it
--gpus
"device=0,2"
ubuntu:18.04
#添加第0号和第2号GPU
```
#### 通过环境变量 `DTK_VISIBLE_DEVICES`
...
...
@@ -35,3 +42,42 @@ docker run -it -e DTK_VISIBLE_DEVICES=all ubuntu:18.04 # 添加所有HCU设备
docker run
-it
-e
DTK_VISIBLE_DEVICES
=
0 ubuntu:18.04
# 添加HCU设备0
docker run
-it
-e
DTK_VISIBLE_DEVICES
=
0,1 ubuntu:18.04
# 添加HCU设备0、1
```
#### 通过CDI方式
-
首先,生成CDI spec文件
```
sh
$
dtk-ctk cdi generate
--output
=
/etc/cdi/dtk.json
```
-
配置docker开启CDI
```
sh
$
dtk-ctk runtime configure
--runtime
=
docker
--set-as-default
--cdi
.enabled
```
-
使用所有的DCU
```
sh
$
docker run
--rm
--device
c-3000.com/hcu
=
all
-it
ubuntu:18.04
```
-
使用第0块和第1块DCU
```
sh
$
docker run
--rm
--device
c-3000.com/hcu
=
0
--device
c-3000.com/hcu
=
1
-it
ubuntu:18.04
```
### 在podman中使用DCU
podman 需要version 2.0+
-
首先需要修改podman的runtime
```
sh
$
dtk-ctk runtime configure
--runtime
=
podman
--set-as-default
```
-
通过环境变量方式使用
```
sh
$
podman run
-it
-e
DTK_VISIBLE_DEVICES
=
all ubuntu:18.04
```
###列出可使用的DCU
```
sh
$
dtk-ctk cdi list
INFO[0000] Found 3 CDI devices
c-3000.com/hcu
=
0
c-3000.com/hcu
=
1
c-3000.com/hcu
=
2
c-3000.com/hcu
=
all
c-3000.com/hcu
=
hcu-73873c7a6eb008a1
c-3000.com/hcu
=
hcu-73873c7a6eb02041
c-3000.com/hcu
=
hcu-73873c7a6eb040a1
```
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment