[機械学習] nglod の sdfRender 再現ガイド (コンパイルの落とし穴: [CMakeFiles/sdfRenderer.dir/build.make:187: sdfRenderer] エラー 1)

公式 Readme ドキュメント

ニューラル SDF レンダラー

これはリアルタイム レンダリング コードです。

組み立て説明書

まず、インストールされていることを確認しますcub(新しいバージョンの CUDA にはプリインストールされています)。

次に、PyTorch Web サイトから libtorch をダウンロードし、ディレクトリlibtorchに解凍しますthird-partyそれから:

mkdir build
cd build
cmake ../
make -j8

走る、

./sdfRenderer {path_to_model.npz}

主な落とし穴

1.libtorchのバージョンの問題

  • 私の環境
    • 無料20.04
    • 奇跡 11.1
    • nvidia 3090、計算能力 86、pytorch1.8.0 がインストールされています
    • gcc/g++ バージョン 9.4.0
  • 試したlibtorchのバージョン
    • cxx11 より前の ABI
      • libtorch 1.8.2+cu102 が失敗しました まず cuda のバージョンが間違っているのでしょうか?
      • libtorch 1.8.2+cu111 が失敗しました。libtorch のバージョンが pytorch のバージョンに対応していませんか? (必ずしも)
      • libtorch 1.8.0+cu111 に失敗しました libtorch のバージョンと pytorch のバージョンの対応がまだうまくいきません cxx のバージョンに問題があるのでしょうか?
    • cxx11 ABI
      • libtorch-1.8.0+cu111 は成功しました

1.1 故障結果記録

ここに画像の説明を挿入

/usr/bin/ld: CMakeFiles/sdfRenderer.dir/sdfRenderer.cpp.o: 関数main': sdfRenderer.cpp:(.text+0x297c): undefined reference to SPC::LoadNPZ(std::string) 内 '
/usr/bin/ld: sdfRenderer.cpp:(.text+0x29c0): SDF::loadWeights(std::string)' /usr/bin/ld: liblib_sdf.a(SDF.cu.o): in function c10::StorageImpl::StorageImpl(c10::StorageImpl::use_byte_size_t, unsigned long, c10::DataPtr, c10::Allocator*, bool)' への未定義の参照: tmpxft_00218957_00000000-6_SDF.cudafe1.cpp:(. text._ZN3c1
011StorageImplC2ENS0_15use_byte_size_tEmNS_7DataPtrEPNS_9AllocatorEb [_ZN3c1011StorageImplC5ENS0_15use_byte_size_tEmNS_7DataPtrEPNS_9AllocatorEb]+0x158): c10::IndexError::Error(c10::SourceLocation, std::__cxx11::basic_string<char, std::char_traits, std::allocator) への未定義の参照c10::Error::Error(c10::SourceLocation, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)' /usr/bin/ld: liblib_sdf.a(SDF.cu.o): in function >)':
tmpxft_00218957_00000000-6_SDF.cudafe1.cpp:(.text._ZN3c1010IndexErrorCI2NS_5ErrorEENS_14SourceLocationENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIceEEE[_ZN3c1010IndexErrorCI5NS_5ErrorE ENS_14SourceLocationENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x30): c10::Error::Error(c10::SourceLocation, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)' /usr/bin/ld: liblib_sdf.a(SDF.cu.o): in function at::Context::getDeviceFromPtr(void*, c10::DeviceType)' への未定義の参照:
tmpxft_00218957_00000000-6_SDF.cudafe1.cpp:( .text._ZN2at7Context16getDeviceFromPtrEPvN3c1010DeviceTypeE[_ZN2at7Context16getDeviceFromPtrEPvN3c1010DeviceTypeE]+0x106): c10::DeviceTypeName[abi:cxx11](c10::DeviceType, bool)' /usr/bin/ld: tmpxft_00218957_00000000-6_SDF.cudafe1.cpp:(.text._ZN2at7Context16getDeviceFromPtrEPvN3c1010DeviceTypeE[_ZN2at7Context16getDeviceFromPtrEPvN3c1010DeviceTypeE]+0x172): undefined reference to c10::detail::torchCheckFail への未定義の参照(char const*, char const*, unsigned int, std::__cxx11: :basic_string<char, std::char_traits, std: :allocator > const&)'
/usr/bin/ld: liblib_sdf.a(SDF.cu.o): 関数内at::from_blob(void*, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::TensorOptions const&)': tmpxft_00218957_00000000-6_SDF.cudafe1.cpp:(.text._ZN2at9from_blobEPvN3c108ArrayRefIlEES3_RKNS1_13TensorOptionsE[_ZN2at9from_blobEPvN3c108ArrayRefIlEES3_RKNS1_13TensorOptionsE]+0x1c2): undefined reference to c10::detail::torchCheckFail(char const*, char const*, unsigned int, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)' /usr/bin/ld:
liblib_sdf .a(SDF.cu.o): 関数内c10::ValueError::Error(c10::SourceLocation, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)': tmpxft_00218957_00000000-6_SDF.cudafe1.cpp:(.text._ZN3c1010ValueErrorCI2NS_5ErrorEENS_14SourceLocationENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN3c1010ValueErrorCI5NS_5ErrorEENS_14SourceLocationENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x30): undefined reference to c10::Error::Error(c10::SourceLocation, std::__cxx11::basic_string<char, std::char_traits, std::allocator >)' /usr
/ bin/ld: liblib_sdf.a(SDF.cu.o): 関数内c10::intrusive_ptr<c10::StorageImpl, c10::detail::intrusive_target_default_null_type<c10::StorageImpl> > c10::intrusive_ptr<c10::StorageImpl, c10::detail::intrusive_target_default_null_type<c10::StorageImpl> >::make<c10::StorageImpl::use_byte_size_t, unsigned long&, c10::DataPtr, c10::Allocator*&, bool&>(c10::StorageImpl::use_byte_size_t&&, unsigned long&, c10::DataPtr&&, c10::Allocator*&, bool&)': tmpxft_00218957_00000000-6_SDF.cudafe1.cpp:(.text._ZN3c1013intrusive_ptrINS_11StorageImplENS_6detail34intrusive_target_default_null_typeIS1_EEE4makeIJNS1_15use_byte_size_tERmNS_7DataPtrERPNS_9AllocatorERbEEES5_DpOT_[_ZN3c1013intrusive_ptrINS_11StorageImplENS_6detail34intrusive_target_default_null_typeIS1_EEE4makeIJNS1_15use_byte_size_tERmNS_7DataPtrERPNS_9AllocatorERbEEES5_DpOT_]+0x1cf): undefined reference to c10::Error::Error(c10::SourceLocation, std::__cxx11::basic_string<char, std::char_traits, std::allocator > )'
/usr/bin/ld: liblib_sdf.a(SDF.cu.o): 関数内c10::intrusive_ptr<c10::StorageImpl, c10::detail::intrusive_target_default_null_type<c10::StorageImpl> >::retain_()': tmpxft_00218957_00000000-6_SDF.cudafe1.cpp:(.text._ZN3c1013intrusive_ptrINS_11StorageImplENS_6detail34intrusive_target_default_null_typeIS1_EEE7retain_Ev[_ZN3c1013intrusive_ptrINS_11StorageImplENS_6detail34intrusive_target_default_null_typeIS1_EEE7retain_Ev]+0xdc): undefined reference to c10::Error::Error(c10::SourceLocation, std::__cxx11::basic_string<char, std::char_traits, std::allocator >)'
/usr/bin/ld: include/spc/libspc.a(SPC.cu.o): 関数内at::TensorAccessor<int, 2ul, at::DefaultPtrTraits, long> at::Tensor::accessor<int, 2ul>() const &': tmpxft_0021899f_00000000-6_SPC.cudafe1.cpp:(.text._ZNKR2at6Tensor8accessorIiLm2EEENS_14TensorAccessorIT_XT0_ENS_16DefaultPtrTraitsElEEv[_ZNKR2at6Tensor8accessorIiLm2EEENS_14TensorAccessorIT_XT0_ENS_16DefaultPtrTraitsElEEv]+0xf4): undefined reference to c10::detail::torchCheckFail(char const*, char const*, unsigned int, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)' /usr/bin/ld:
include /spc/libspc.a(spc_raytrace_cuda.cpp.o): 関数内spc_raytrace(at::Tensor, at::Tensor, at::Tensor, at::Tensor, at::Tensor, unsigned int)': spc_raytrace_cuda.cpp:(.text+0x156a): undefined reference to c10::detail::torchCheckFail(char const*, char const*, unsigned int, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)'
/usr/bin/ld: spc_raytrace_cuda.cpp:(.text+0x1617): c10::detail::torchCheckFail への未定義の参照c10::detail::torchCheckFail(char const*, char const*, unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' /usr/bin/ld: spc_raytrace_cuda.cpp:(.text+0x16b3): undefined reference to (char const*, char const*, unsigned int, std: :__cxx11::basic_string<char, std::char_traits, std::allocator > const&)'
/usr/bin/ld: spc_raytrace_cuda.cpp:(.text+0x174c): への未定義の参照c10::detail::torchCheckFail(char const*, char const*, unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' /usr/bin/ld: include/spc/libspc.a(spc_raytrace_cuda.cpp.o):spc_raytrace_cuda.cpp:(.text+0x181e): more undefined references to c10::detail::torchCheckFail(char const*, char const*, unsigned int, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)' followcollect2: エラー: ld が 1 を返しまし
た終了ステータス
make[2]: *** [CMakeFiles/sdfRenderer.dir/build.make:187: sdfRenderer] エラー 1
make[1]: *** [CMakeFiles/Makefile2:177: CMakeFiles/sdfRenderer.dir/all]エラー 2
make: *** [Makefile:91: all] エラー 2

失敗後、カブがインストールされていないのが問題だと思いました。

まず、インストールされていることを確認しますcub(新しいバージョンの CUDA にはプリインストールされています)。

ただし、インストール後も上記のエラーは報告されるため、cub の問題ではないはずです。

1.2 インストールの成功

1.2.1 手順

cd third-party
wget https://download.pytorch.org/libtorch/cu111/libtorch-cxx11-abi-shared-with-deps-1.8.0%2Bcu111.zip
unzip libtorch-cxx11-abi-shared-with-deps-1.8.0+cu111.zip
cd ../build
cmake ..
make -j8

[LibTorch & Linux] LibTorch のさまざまなバージョンをダウンロードする

1.2.2 成功したスクリーンショット

ここに画像の説明を挿入

sdfRenderを使用する

おすすめ

転載: blog.csdn.net/weixin_43693967/article/details/126966508