Open2

nnabla周り自分用メモ

shrytshryt

基本的にはこれに従う
https://github.com/sony/nnabla/blob/master/doc/build/build.md
Ninja、asdf、poetryでビルドするときは以下の通り

# nnablaのビルド
$ cmake -S . -B build -G Ninja \
  -D PYTHON_LIBRARIES=~/.asdf/installs/python/3.11.5/lib \
  -D PYTHON_INCLUDE_DIRS=~/.asdf/installs/python/3.11.5/include
$ cmake --build build

BUILD_CPP_UTILS=ONにするときは、これに従う
https://github.com/sony/nnabla/blob/master/doc/build/build_cpp_utils.md
Ninja、asdf、poetryでビルドするときは以下の通り

$ export CMAKE_FIND_ROOT_PATH="$HOME/nnabla_build_deps/;${CMAKE_FIND_ROOT_PATH}"
$ cmake -S . -B build -G Ninja \
  -D PYTHON_LIBRARIES=~/.asdf/installs/python/3.11.5/lib \
  -D PYTHON_INCLUDE_DIRS=~/.asdf/installs/python/3.11.5/include \
  -D BUILD_CPP_UTILS=ON
$ cmake --build build
# テスト
$ sudo apt install -y liblzma-dev libsndfile1
$ poetry add $(cat python/test_requirements.txt)
$ py.test python/test
shrytshryt

nnabla-ext-cudaをビルドするときは、これに従う
https://github.com/sony/nnabla-ext-cuda/blob/master/doc/build/build.md
Ninja、asdf、poetryでビルドするときは以下の通り

$ cmake -S . -B build -G Ninja \
  -D NNABLA_DIR="$HOME/develop/nnabla" \
  -D CPPLIB_LIBRARY="$HOME/develop/nnabla/build/lib/libnnabla.so" \
  -D PYTHON_LIBRARIES=~/.asdf/installs/python/3.11.5/lib \
  -D PYTHON_INCLUDE_DIRS=~/.asdf/installs/python/3.11.5/include \
  -D BUILD_CPP_UTILS=ON
$ cmake --build build
# テスト
$ cd ../nnabla
$ sudo apt install -y liblzma-dev libsndfile1
$ poetry add $(cat python/test_requirements.txt)
$ export PYTHONPATH=$HOME/develop/nnabla-ext-cuda/python/test:$PYTHONPATH
$ py.test python/test