Vitis AIでdocker_build_gpu.shが失敗するメモ

本サイトはアフィリエイト広告を利用しています。
AI

VItis AIでGPU版のDockerをビルドすると失敗しました。

エラーの症状とメッセージ、ログをメモしておきます。

また原因を調べてみました。

 

スポンサーリンク

Vitis AIでdocker_build_gpu.shが失敗するメモ

Vitis AIをGPUで動作させようとdocker環境を構築しようとしたのですが失敗しました。

内部のコンパイルが繰り返され、フリーズするような形となりました。

(「libtool: compile:…」が常に失敗して、繰り返されていました)

 

終了した最後の実行結果をみると下記メッセージです。

Error response from daemon: No such image: xilinx/vitis-ai-gpu:2.0.0.1103

libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I.. -pthread -DHAVE_PTHREAD=1 -DHAVE_ZLIB=1 -Wall -Wno-sign-compare -O2 -g -DNDEBUG -MT google/protobuf/descriptor.pb.lo -MD -MP -MF google/protobuf/.deps/descriptor.pb.Tpo -c google/protobuf/descriptor.pb.cc -o google/protobuf/descriptor.pb.o >/dev/null 2>&1
make[2]: Leaving directory '/tmp/protobuf-3.4.0/src'
Makefile:1488: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/tmp/protobuf-3.4.0'
Makefile:1395: recipe for target 'all' failed
make: *** [all] Error 2
The command '/bin/bash -c cd /tmp; wget --progress=dot:mega https://codeload.github.com/google/protobuf/zip/v3.4.0     && unzip v3.4.0     && cd protobuf-3.4.0     && ./autogen.sh     && ./configure     && make -j     && make install     && ldconfig     && rm -fr /tmp/*' returned a non-zero code: 2
Error response from daemon: No such image: xilinx/vitis-ai-gpu:2.0.0.1103
Error response from daemon: No such image: xilinx/vitis-ai-gpu:2.0.0.1103
Error response from daemon: No such image: xilinx/vitis-ai-gpu:2.0.0.1103

 

Vitis AIの環境

OSとVitis AIの環境としては下記です。

  • Ubuntu 20.04.4 LTS ※Ubuntu18.04でも確認済
  • VItis AI 2.5

 

Vitis AIをインストールした際の記事は下記です。

VItis AI 2.5やPetaLinuxなどインストールしてみたメモ

VItis AI 2.5やPetaLinuxなどインストールしてみたメモ
Vitis AIの最新版2.5やPetaLinuxインストールしてみました。 ダウンロードからの一連の流れを簡単に紹介します。

 

PCスペック

PCスペックは下記の通りです。

  • CPU…Core i5 6400
  • GPU…NVIDIA GeForce GT 710
  • メモリ…16GB
  • SSD…500GB

 

デスクトップで一応グラフィックボードを積んでいますが、低スペックのGPUです。

一応、下記記事でNVIDIAのドライバで動かせるようにまでは実施しています。

中古のPCにグラボを増設してみた!NVIDIA GeForce GT 710編

中古のPCにグラボを増設してみた!NVIDIA GeForce GT 710編
中古のデスクトップにグラボを増設(後付け)してみました。 格安のNVIDIA GeForce GT 710ですが、問題なく動作確認できています。 中古PCの購入から、グラフィックボードの増設までの流れを紹介します。

 

nvidiaのドライバは動作している

下記コマンドでNVIDIAのドライバが動作していることを確認しています。

Vitis AI 2.5だとCUDAのVerが11.0以上が要求されていますが、11.4で問題無しです。

CUDA Version: 11.4

iotengineer@iotengineer-Inspiron-3650:~$ nvidia-smi
Sat Sep  3 06:05:55 2022       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 470.141.03   Driver Version: 470.141.03   CUDA Version: 11.4     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ...  Off  | 00000000:01:00.0 N/A |                  N/A |
| 40%   39C    P8    N/A /  N/A |     13MiB /   980MiB |     N/A      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

 

dockerも動作しています

dockerも正常に動作していることを確認しています。

(Vitis AIはdocker環境で動作します。)

Hello from Docker! This message shows that your installation appears to be working correctly.

iotengineer@iotengineer-Inspiron-3650:~$ docker run hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

 

エラー原因はPCのメモリ不足の様子

原因はPCのメモリ不足のようです。(筆者のデスクトップPCのメモリが16GBです)

dmesgでdockerをビルドのログを見ると「Out of memory」となっていました。

Out of memory: Killed process 56305 (cc1plus)…

[63003.216656] [  57115]     0 57115     1833       16    57344        0             0 g++
[63003.216658] [  57116]     0 57116    16168     2536   151552        0             0 cc1plus
[63003.216660] [  57125]     0 57125     5942     1794    86016        0             0 as
[63003.216661] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/docker/bf814ef9517f6a5f626371f90c1383d080effdba2c0309753d92e2bc6515752f,task=cc1plus,pid=56305,uid=0
[63003.216670] Out of memory: Killed process 56305 (cc1plus) total-vm:221920kB, anon-rss:158936kB, file-rss:0kB, shmem-rss:0kB, UID:0 pgtables:456kB oom_score_adj:0
[63003.224677] oom_reaper: reaped process 56305 (cc1plus), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB

 

下記の方と同様な現象でした。その方はメモリを+16GBして32GBだと動作できた様子です。

 https://github.com/Xilinx/Vitis-AI/issues/716

 

ただ筆者の中古デスクトップPCが古く、メモリがDDR3で最大16GBなので対応できません。

暫くはVitis AIのdockerはCPU版で動かそうかと思います。(結構手間です)

 

暫定の対応方法

メモリが足りないので、メモリスワップの容量を増やせば対応可能です。

16GB増やしましたところ、上記のエラーは出なくなりました。

sudo dd if=/dev/zero of=/var/swap bs=1M count=16384
sudo mkswap /var/swap
sudo swapon /var/swap

 

まとめ

今回のエラーはPCのメモリ不足が原因でした。

もし同様なエラーで困っている方はメモリを増やすか、スワップ容量を増やしてみて下さい。

 

GPUボードを新しく用意して、GPUのDocker環境を立ち上げるまで実施しました。

下記記事で紹介しています。(リンク先はこちら)

Vitis AI GPU dockerの環境構築をしたメモ

Vitis AI GPU dockerの環境構築をしたメモ
XilinxのFPGAのAI開発環境である、Vitis-AI 2.5のGPU版を立ち上げてみました。 dockerやCUDAなど多くのものを事前にインストールする必要があります。 実際にGPU dockerの環境構築をした手順を紹介します。

 

今回の記事含めて、第6回AIエッジコンテストの一環でした。

下記にてコンテストでテスト・実施したことのまとめを紹介しています。

第6回AIエッジコンテストが凄く難しいけど勉強になった感想

第6回AIエッジコンテストが凄く難しいけど勉強になった感想
第6回AIエッジコンテストに参加していました。 RISC-Vを使って、画像とLIDAR点群からの3D物体検出が課題でした。 ただ貴重な勉強の機会になりましたし、自身への忘備録としても内容を紹介します。

コメント