Vitis AIの構造を勉強してみる(3日目)

ソフトウェアからハードウェアの呼び出しは分かったのでハードウェアがどこにあるか探してみる。

ハードウェアはどこからアクセスされる?

そういえば、SDカードはhttps://www.xilinx.com/bin/public/openDownload?filename=xilinx-zcu104-dpu-v2020.2-v1.3.0.img.gzからダウンロードして書き込んだだけでした。

じゃぁ、BitStreamは事前に用意されていたってことですね。

そして、ハードウェアの前にlibvitis_ai_library-facedetectを通過して実際のハードウェアにたどり着くんですよね?

まだ、ソフトウェア層が残っていました。

このライブラリを探してみます。

おそらく、./Vitis-AI/tools/Vitis-AI-Library/facedetectでよいのでしょう。

$ find ./Vitis-AI/tools/Vitis-AI-Library/facedetect
./Vitis-AI/tools/Vitis-AI-Library/facedetect
./Vitis-AI/tools/Vitis-AI-Library/facedetect/.gitignore
./Vitis-AI/tools/Vitis-AI-Library/facedetect/test
./Vitis-AI/tools/Vitis-AI-Library/facedetect/test/test_facedetect_batch.cpp
./Vitis-AI/tools/Vitis-AI-Library/facedetect/test/test_facedetect.cpp
./Vitis-AI/tools/Vitis-AI-Library/facedetect/test/test_accuracy_facedetect.cpp
./Vitis-AI/tools/Vitis-AI-Library/facedetect/include
./Vitis-AI/tools/Vitis-AI-Library/facedetect/include/vitis
./Vitis-AI/tools/Vitis-AI-Library/facedetect/include/vitis/ai
./Vitis-AI/tools/Vitis-AI-Library/facedetect/include/vitis/ai/facedetect.hpp
./Vitis-AI/tools/Vitis-AI-Library/facedetect/src
./Vitis-AI/tools/Vitis-AI-Library/facedetect/src/facedetect.cpp
./Vitis-AI/tools/Vitis-AI-Library/facedetect/src/detect_imp.cpp
./Vitis-AI/tools/Vitis-AI-Library/facedetect/src/detect_imp.hpp
./Vitis-AI/tools/Vitis-AI-Library/facedetect/CMakeLists.txt

たぶん、このディレクトリをcmakeしてmakeすればライブラリができるのだろう。

試しにビルドしてみよう。

$ mkdir build
$ cd build/
$ cmake ../
CMake Warning (dev) in CMakeLists.txt:
  No project() command is present.  The top-level CMakeLists.txt file must
  contain a literal, direct call to the project() command.  Add a line of
  code such as

    project(ProjectName)

  near the top of the file, but after cmake_minimum_required().

  CMake is pretending there is a "project(Project)" command on the first
  line.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:18 (include):
  include could not find load file:

    XilinxVersion

CMake Error at CMakeLists.txt:51 (install):
  install EXPORT given no DESTINATION!

-- Configuring incomplete, errors occurred!
See also "/home/hidemi/workspace/VitisAI/VitisAI_2020.2/Vitis-AI/tools/Vitis-AI-Library/facedetect/build/CMakeFiles/CMakeOutput.log".

エラーが出た。

あぁ、Vitisの環境セットアップをしてなかったのでセットアップしてからcmakeしてみる。

$ source /opt/Xilinx/Vitis/2020.2/settings64.sh 
$ cmake ../
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:16 (cmake_minimum_required):
  CMake 3.5 or higher is required.  You are running version 3.3.2

-- Configuring incomplete, errors occurred!
See also "/home/hidemi/workspace/VitisAI/VitisAI_2020.2/Vitis-AI/tools/Vitis-AI-Library/facedetect/build/CMakeFiles/CMakeOutput.log".

cmakeのバージョンエラーになった。

今、見えているcmakeのバージョンは?

3.3.2だよね。

どこにあるんだろう?

$ which cmake
/opt/Xilinx/Vitis/2020.2/tps/lnx64/cmake-3.3.2/bin/cmake
$ cmake --version
cmake version 3.3.2

CMake suite maintained and supported by Kitware (kitware.com/cmake).

Vitisツール配下のcmakeを使っているではないか!

それでバージョンエラーとはこれ如何に?

なんか当たるところを違ってそうなので明日にしよう。

write: 2021/01/10/ 00:00:00