ROCm

来自百合仙子's Wiki
跳转到导航 跳转到搜索

systemd-nspawn 中使用

注意: 并不成功(2023年08月26日)。
sudo systemd-nspawn -D dir --bind /dev/kfd --bind /dev/dri --bind /dev/dri/renderD128

此命令会自动添加相应的 DeviceAllow 属性。

bwrap 中使用

bwrap --unshare-all --ro-bind rootfs / --dev /dev --proc /proc --tmpfs /tmp \
  --dev-bind /dev/kfd /dev/kfd --dev-bind /dev/dri /dev/dri \
  --tmpfs /sys --ro-bind /sys/devices /sys/devices --ro-bind /sys/dev /sys/dev \
  --bind {rootfs,}/home/easyocr/.config --bind {rootfs,}/home/easyocr/.cache \
  --setenv HOME /home/easyocr --setenv HSA_OVERRIDE_GFX_VERSION 10.3.0 \
  python -c 'import torch; print(torch.cuda.is_available())'

rootfs 管理命令:

bwrap --unshare-all --share-net --bind rootfs / --tmpfs /tmp --dev /dev --proc /proc \
  --bind /var/cache/pacman /var/cache/pacman \
  --bind /etc/pacman.d /etc/pacman.d \
  --ro-bind /etc/resolv.conf /etc/resolv.conf --ro-bind /etc/pacman.conf /etc/pacman.conf \
  --uid 0 --gid 0 bash

问题处理

在 Navi23 (gfx1032) 显卡(如 RX 6650 XT)上,旧版 ROCm 需要设置环境变量来使用 gfx1030 目标,不然程序会找不到设备而段错误: [1] [2] [3]

export HSA_OVERRIDE_GFX_VERSION=10.3.0

外部链接

参考资料