Closed yuancaimaiyi closed 9 months ago
Strange, does the gsplat
target build properly?
make gsplat
Have you made any changes?
@pierotofy
[100%] Built target gsplat
I haven't changed anything, but undefined reference appears.
Mm, I can't seem to reproduce it on my machine; if you find a way to fix it, please do share?
Maybe it has to do with the compiler/nvcc version.
@pierotofy the latest update: When I use another machine: ubuntu20.04, cudn11.2, cudnn8.1.1, libtorch1.8.0+cu112. The following error appears:
OpenSplat/optim_scheduler.hpp:11:87: error: ‘struct torch::optim::AdamOptions’ has no member named ‘get_lr’
11 | static_cast<torch::optim::AdamOptions&>(opt->param_groups()[0].options()).get_lr()
OpenSplat/model.cpp:236:46: error: ‘vector_norm’ is not a member of ‘torch::linalg’
236 | torch::Tensor grads = torch::linalg::vector_norm(xys.grad().detach(), 2, { -1 }, false, torch::kFloat32);
Therefore, I suggest that you provide a dockfile to everyone, because the environment is too difficult to configure.
Indeed. There's #12 open (and up for grabs, if you'd like to help with a PR)?
@yuancaimaiyi Thank you for taking the time to test it out! This information is super helpful. It seems like vector_norm
is a newly introduced method in libtorch 1.9.0 from this PR https://github.com/pytorch/pytorch/issues/50214. There should exist a way to make OpenSplat backward compatible with libtorch 1.8.0.
Also, Docker based build and setup is actually on the way. But implementing native builds would significantly enhance the training speed and provides additional opportunities for hardware-level optimization across different software/hardware setups.
Are you working on the Dockerfile? I was trying on my side, but seems my Mac is not the best machine for this
Not yet. I'll probably move to macos or docker build after windows-2022/-2019 build is done. Feel free to put your input at this place.
@pierotofy
update again:
machine: ubuntu20.04, cudn11.3, cudnn8.2.0, 1.10.0+cu113.
This undefined reference error appears again, as follows:
/usr/bin/ld: CMakeFiles/opensplat.dir/spherical_harmonics.cpp.o: in function
SphericalHarmonics::forward(torch::autograd::AutogradContext, int, at::Tensor, at::Tensor)':
spherical_harmonics.cpp:(.text+0x62a): undefined reference to compute_sh_forward_tensor(unsigned int, unsigned int, unsigned int, at::Tensor&, at::Tensor&)' /usr/bin/ld: CMakeFiles/opensplat.dir/spherical_harmonics.cpp.o: in function
SphericalHarmonics::backward(torch::autograd::AutogradContext, std::vector<at::Tensor, std::allocatorcompute_sh_backward_tensor(unsigned int, unsigned int, unsigned int, at::Tensor&, at::Tensor&)' /usr/bin/ld: CMakeFiles/opensplat.dir/cv_utils.cpp.o: in function
imreadRGB(std::string const&)':
cv_utils.cpp:(.text+0x274): undefined reference to cv::imread(std::string const&, int)' /usr/bin/ld: CMakeFiles/opensplat.dir/cv_utils.cpp.o: in function
imwriteRGB(std::string const&, cv::Mat const&)':
cv_utils.cpp:(.text+0x3df): undefined reference to cv::imwrite(std::string const&, cv::_InputArray const&, std::vector<int, std::allocator<int> > const&)' /usr/bin/ld: CMakeFiles/opensplat.dir/cv_utils.cpp.o: in function
floatNxNtensorToMat(at::Tensor const&)':
cv_utils.cpp:(.text+0x6a3): undefined reference to cv::error(int, std::string const&, char const*, char const*, int)' /usr/bin/ld: CMakeFiles/opensplat.dir/project_gaussians.cpp.o: in function
ProjectGaussians::forward(torch::autograd::AutogradContext, at::Tensor, at::Tensor, float, at::Tensor, at::Tensor, at::Tensor, float, float, float, float, int, int, std::tuple<int, int, int>, float)':
project_gaussians.cpp:(.text+0x150): undefined reference to project_gaussians_forward_tensor(int, at::Tensor&, at::Tensor&, float, at::Tensor&, at::Tensor&, at::Tensor&, float, float, float, float, unsigned int, unsigned int, std::tuple<int, int, int>, float)' /usr/bin/ld: CMakeFiles/opensplat.dir/project_gaussians.cpp.o: in function
ProjectGaussians::backward(torch::autograd::AutogradContext, std::vector<at::Tensor, std::allocatorproject_gaussians_backward_tensor(int, at::Tensor&, at::Tensor&, float, at::Tensor&, at::Tensor&, at::Tensor&, float, float, float, float, unsigned int, unsigned int, at::Tensor&, at::Tensor&, at::Tensor&, at::Tensor&, at::Tensor&, at::Tensor&)' /usr/bin/ld: CMakeFiles/opensplat.dir/rasterize_gaussians.cpp.o: in function
binAndSortGaussians(int, int, at::Tensor, at::Tensor, at::Tensor, at::Tensor, std::tuple<int, int, int>)':
rasterize_gaussians.cpp:(.text+0xac): undefined reference to map_gaussian_to_intersects_tensor(int, int, at::Tensor const&, at::Tensor const&, at::Tensor const&, at::Tensor const&, std::tuple<int, int, int>)' /usr/bin/ld: rasterize_gaussians.cpp:(.text+0x173): undefined reference to
get_tile_bin_edges_tensor(int, at::Tensor const&)'
/usr/bin/ld: CMakeFiles/opensplat.dir/rasterize_gaussians.cpp.o: in function RasterizeGaussians::forward(torch::autograd::AutogradContext*, at::Tensor, at::Tensor, at::Tensor, at::Tensor, at::Tensor, at::Tensor, at::Tensor, int, int, at::Tensor)': rasterize_gaussians.cpp:(.text+0x5ba): undefined reference to
rasterize_forward_tensor(std::tuple<int, int, int>, std::tuple<int, int, int>, std::tuple<int, int, int>, at::Tensor const&, at::Tensor const&, at::Tensor const&, at::Tensor const&, at::Tensor const&, at::Tensor const&, at::Tensor const&)'
/usr/bin/ld: CMakeFiles/opensplat.dir/rasterize_gaussians.cpp.o: in function RasterizeGaussians::backward(torch::autograd::AutogradContext*, std::vector<at::Tensor, std::allocator<at::Tensor> >)': rasterize_gaussians.cpp:(.text+0xfcf): undefined reference to
rasterize_backward_tensor(unsigned int, unsigned int, at::Tensor const&, at::Tensor const&, at::Tensor const&, at::Tensor const&, at::Tensor const&, at::Tensor const&, at::Tensor const&, at::Tensor const&, at::Tensor const&, at::Tensor const&, at::Tensor const&)'
collect2: error: ld returned 1 exit status`
I decided to give up . Let’s wait for the dockerfile to come out.
@pierotofy update I solve it ,I use libtorch-cxx11-abi-shared-with-deps-1.10.0+cu113 rather than libtorch-shared-with-deps-1.10.0+cu113 ,the "undefined reference" error disappears!
@pierotofy
Hi, When I compile the program, the following error occurs. My computer environment is ubuntu18.04+cuda10.2+cudnn7:
[100%] Linking CXX executable opensplat CMakeFiles/opensplat.dir/spherical_harmonics.cpp.o: In function ‘SphericalHarmonics::forward(torch::autograd::AutogradContext*, int, at::Tensor, at::Tensor)’: spherical_harmonics.cpp:(.text+0x69c): undefined reference to 'compute_sh_forward_tensor(unsigned int, unsigned int, unsigned int, at::Tensor&, at::Tensor&)' CMakeFiles/opensplat.dir/spherical_harmonics.cpp.o: In function 'SphericalHarmonics::backward(torch::autograd::AutogradContext*, std::vector<at::Tensor, std::allocator<at::Tensor>> in)' in: spherical_harmonics.cpp:(.text+0xec4): undefined reference to 'compute_sh_backward_tensor(unsigned int, unsigned int, unsigned int, at::Tensor&, at::Tensor&)' CMakeFiles/opensplat.dir/project_gaussians.cpp.o: In function 'ProjectGaussians::forward(torch::autograd::AutogradContext*, at::Tensor, at::Tensor, float, at::Tensor, at::Tensor , at::Tensor, float, float, float, float, int, int, std::tuple<int, int, int>, float)': project_gaussians.cpp:(.text+0x137): For 'project_gaussians_forward_tensor(int, at::Tensor&, at::Tensor&, float, at::Tensor&, at::Tensor&, at::Tensor&, float, float, float, float, unsigned int, unsigned int, std::tuple<int, int, int>, float)' undefined reference