mac で genesis-world の LuisaRender を使いたい
と でインストール方法が違う.不可解
pip install genesis-world
したあと,指示通りサブモジュールの取得と pip install -e ".[render]"
した時点で
Attempting uninstall: genesis-world
Found existing installation: genesis-world 0.2.1
Uninstalling genesis-world-0.2.1:
Successfully uninstalled genesis-world-0.2.1
と言われ,その後 genesisがこわれる.
gs.init(backend=gs.gpu, logging_level="info", precision='32')
^^^^^^^
AttributeError: module 'genesis' has no attribute 'init'
ので,入れ直す
pip uninstall genesis-world
pip install genesis-world
することでgenesisが生き返る
書き忘れた
depencenciesは
conda install -c conda-forge gcc=11.4 gxx=11.4 cmake=3.26.1 minizip zlib libuuid patchelf vulkan-tools vulkan-headers
とあるが,なんか見つからなかったので
brew で入れた.
brew install minizip zlib ossp-uuid patchelf vulkan-tools vulkan-headers
だったかな.
とにかく condaで入ったもの以外は brewで入れた.
gccとgxxはうまく入らなかったので放置した.
# cmake
cmake version 3.31.5
# gcc, g++
Apple clang version 16.0.0 (clang-1600.0.26.6)
Target: arm64-apple-darwin24.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
公式には
cmake -S . -B build -D CMAKE_BUILD_TYPE=Release -D PYTHON_VERSIONS=3.9 -D LUISA_COMPUTE_DOWNLOAD_NVCOMP=ON # Python のバージョンを確認
cmake --build build -j $(nproc)
とあるが,これじゃ luisa::compute::Window
について Undefined symbols for architecture arm64
と出た.
WindowとあるのでGUI関係か?ということで
試行錯誤の末,次のコマンドでビルド,うまく通ったっぽい
cmake -S . -B build -D CMAKE_BUILD_TYPE=Release -D LUISA_COMPUTE_DOWNLOAD_NVCOMP=ON -D LUISA_COMPUTE_ENABLE_GUI=ON -D PYTHON_VERSIONS=3.10
cmake --build build -j $(nproc)
pip install -e ".[render]"
して,
raytrace.py
のimport 文までを実行すると動く.つまりインポートできる.
ただし, AttributeError: module 'genesis' has no attribute 'init'
になって実行できない.なにこれ?
ファーーーーーーーーーーーーーーーーーーーーーーーーーーガソン
ここにあるように, export PYTHONPATH=/path/to/Genesis:$PYTHONPATH
すると挙動が変わった.
Cudaがないと言われるのでmetalを明示してビルドし直す
cmake -S . -B build -D CMAKE_BUILD_TYPE=Release -D LUISA_COMPUTE_DOWNLOAD_NVCOMP=ON -D LUISA_COMPUTE_ENABLE_GUI=ON -D PYTHON_VERSIONS=3.10 -D LUISA_COMPUTE_ENABLE_METAL=ON
render_on_macos.py を参考にしてみるか?
ここにあるように, export PYTHONPATH=/path/to/Genesis:$PYTHONPATH
すると挙動が変わった.
Cudaがないと言われるのでmetalを明示してビルドし直す
AttributeError: dlsym(0x30e0f31e0, glDrawElementsInstancedBaseInstance): symbol not found
conda install python==3.12
で頭からもっかい
3.12 にしたら export PYTHONPATH=/path/to/Genesis:$PYTHONPATH
なしでも動くようになった.けどやっぱりopenglっぽいとこでコケる
AttributeError: dlsym(0x30e0f31e0, glDrawElementsInstancedBaseInstance): symbol not found
cudaがないと怒られるのでバックエンド一覧をチェックしたい
[2025-02-19 12:47:56.095] [console] [error] Backend 'cuda' is not installed.
cuda をビルドしない設定にしてもだめ
どこかで別で指定してる?
installed_backendを表示してみた
[2025-02-19 15:35:55.026] [console] [warning] Installed backends:
[2025-02-19 15:35:55.026] [console] [warning] - cpu
[2025-02-19 15:35:55.026] [console] [warning] - metal
[2025-02-19 15:35:55.026] [console] [warning] - remote
cudaないやんけ なんで渡されるんや!
とりあえず load_backend
に直接 metal渡してみた
[2025-02-19 15:35:55.339] [console] [error] Assertion 'version == "adequate"' failed: Metal 3.0 and higher is required for LuisaCompute (detected: 2.3).
調べたら Metal3が入ってる なぜ2.3という?
metal_device.cpp も書き換えてチェックスルーするようにしたけど,
[2025-02-19 15:44:01.734] [console] [warning] Device extension "DenoiserExt" is not supported on Metal.
と怒られた
飽きたので終わり.誰か