1. 安装
-
下载项目
git clone --recursive https://github.com/nvlabs/instant-ngp cd instant-ngp -
安装环境
pip install -r requirements.txt cmake -S . -B build-
问题1
CMake Error: The source directory "/home/xxx/graphics_primitives/instant-ngp/build" does not appear to contain CMakeLists.txt. Specify --help for usage, or press the help button on the CMake GUI. # 老版本cmake会读取build下的配置文件, 新版本不用, 所以升级cmake版本 或 CMake Error at CMakeLists.txt:9 (cmake_minimum_required): CMake 3.19 or higher is required. You are running version 3.10.2 -- Configuring incomplete, errors occurred!- 解决: 升级CMake
非root安装cmake wget https://github.com/Kitware/CMake/releases/download/v3.23.0/cmake-3.23.0.tar.gz tar zxvf cmake-3.23.0.tar.gz && cd cmake-3.23.0 ~~./bootstrap~~ ./bootstrap -- -DCMAKE_USE_OPENSSL=OFF # 非root下可以选择关闭openssl防止报错 ./configure --prefix=/.../cmake # 设置在自己目录下 make make install vim ~/.bashrc export PATH=/home/xxx/cmake/bin:$PATH source ~/.bashrc-
问题: ./bootstrap时报错
CMake Error at Utilities/cmcurl/CMakeLists.txt:586 (message): Could not find OpenSSL. Install an OpenSSL development package or configure CMake with -DCMAKE_USE_OPENSSL=OFF to build without OpenSSL.-
解决: 没有开发版OpenSSL, 不使用openssl
# apt-get install libssl-dev # 非root ./bootstrap -- -DCMAKE_USE_OPENSSL=OFF
-
-
问题: ./configure –prefix=/…/cmake 地址写错或没有权限
-- No release type specified. Setting to 'Release'. CMake Error at CMakeLists.txt:38 (message): Some instant-ngp dependencies are missing. If you forgot the "--recursive" flag when cloning this project, this can be fixed by calling "git submodule update --init --recursive".
-
CMAKE_CUDA_ARCHITECTURES must be valid if set.
- 解决: 删除build文件夹
cmake --build build --config RelWithDebInfo -j 16-
问题1: nvcc fatal : Unsupported gpu architecture ‘compute_80+PTX’
[ 1%] Building CUDA object dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/cpp_api.cu.o [ 3%] Building CUDA object dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/cutlass_mlp.cu.o [ 5%] Building CUDA object dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/loss.cu.o [ 7%] Building CUDA object dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/common.cu.o [ 10%] Building CUDA object dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/encoding.cu.o [ 10%] Building CUDA object dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/common_device.cu.o [ 12%] Building CUDA object dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/network.cu.o [ 14%] Building CUDA object dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/optimizer.cu.o [ 18%] Building CUDA object dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/object.cu.o [ 18%] Building CUDA object dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/reduce_sum.cu.o [ 20%] Building CUDA object dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/fully_fused_mlp.cu.o nvcc fatal : Unsupported gpu architecture 'compute_80+PTX' nvcc fatal : Unsupported gpu architecture 'compute_80+PTX' dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/build.make:103: recipe for target 'dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/cpp_api.cu.o' failed make[2]: *** [dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/cpp_api.cu.o] Error 1 make[2]: *** Waiting for unfinished jobs.... nvcc fatal : Unsupported gpu architecture 'compute_80+PTX' nvcc fatal : Unsupported gpu architecture 'compute_80+PTX' dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/build.make:145: recipe for target 'dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/loss.cu.o' failed make[2]: *** [dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/loss.cu.o] Error 1 nvcc fatal : Unsupported gpu architecture 'compute_80+PTX' dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/build.make:75: recipe for target 'dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/common.cu.o' failed make[2]: *** [dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/common.cu.o] Error 1 dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/build.make:117: recipe for target 'dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/cutlass_mlp.cu.o' failed make[2]: *** [dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/cutlass_mlp.cu.o] Error 1 nvcc fatal : Unsupported gpu architecture 'compute_80+PTX' nvcc fatal : Unsupported gpu architecture 'compute_80+PTX' dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/build.make:89: recipe for target 'dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/common_device.cu.o' failed make[2]: *** [dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/common_device.cu.o] Error 1 nvcc fatal : Unsupported gpu architecture 'compute_80+PTX' dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/build.make:159: recipe for target 'dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/network.cu.o' failed make[2]: *** [dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/network.cu.o] Error 1 nvcc fatal : Unsupported gpu architecture 'compute_80+PTX' dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/build.make:131: recipe for target 'dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/encoding.cu.o' failed make[2]: *** [dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/encoding.cu.o] Error 1 dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/build.make:187: recipe for target 'dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/optimizer.cu.o' failed make[2]: *** [dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/optimizer.cu.o] Error 1 nvcc fatal : Unsupported gpu architecture 'compute_80+PTX' nvcc fatal : Unsupported gpu architecture 'compute_80+PTX' dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/build.make:173: recipe for target 'dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/object.cu.o' failed make[2]: *** [dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/object.cu.o] Error 1 dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/build.make:215: recipe for target 'dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/fully_fused_mlp.cu.o' failed make[2]: *** [dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/fully_fused_mlp.cu.o] Error 1 dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/build.make:201: recipe for target 'dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/reduce_sum.cu.o' failed make[2]: *** [dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/reduce_sum.cu.o] Error 1 CMakeFiles/Makefile2:305: recipe for target 'dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/all' failed make[1]: *** [dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... [ 49%] Built target glfw_objects Makefile:90: recipe for target 'all' failed make: *** [all] Error 2-
解决: 在instant-ngp/CMakeLists.txt顶部添加:
后面的数字是显卡的算力, 以nccl中设定的算力为准
set( ENV{TCNN_CUDA_ARCHITECTURES} 75 )
-
-
问题2: make[1]: *** [dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/all] Error 2
Consolidate compiler generated dependencies of target tiny-cuda-nn [ 29%] Built target glfw_objects [ 30%] Building CUDA object dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/optimizer.cu.o /home/xxx/graphics_primitives/instant-ngp/dependencies/tiny-cuda-nn/include/tiny-cuda-nn/optimizers/shampoo.h(753): error: identifier "cublasSetWorkspace" is undefined detected during: instantiation of "tcnn::ShampooOptimizer<T>::ShampooOptimizer(const tcnn::json &) [with T=float]" /home/xxx/graphics_primitives/instant-ngp/dependencies/tiny-cuda-nn/src/optimizer.cu(71): here instantiation of "tcnn::Optimizer<T> *tcnn::create_optimizer<T>(const tcnn::json &) [with T=float]" /home/xxx/graphics_primitives/instant-ngp/dependencies/tiny-cuda-nn/include/tiny-cuda-nn/optimizers/average.h(65): here /home/xxx/graphics_primitives/instant-ngp/dependencies/tiny-cuda-nn/include/tiny-cuda-nn/optimizers/shampoo.h(771): error: identifier "cublasSetWorkspace" is undefined detected during: instantiation of "tcnn::ShampooOptimizer<T>::ShampooOptimizer(const tcnn::json &) [with T=float]" /home/xxx/graphics_primitives/instant-ngp/dependencies/tiny-cuda-nn/src/optimizer.cu(71): here instantiation of "tcnn::Optimizer<T> *tcnn::create_optimizer<T>(const tcnn::json &) [with T=float]" /home/xxx/graphics_primitives/instant-ngp/dependencies/tiny-cuda-nn/include/tiny-cuda-nn/optimizers/average.h(65): here /home/xxx/graphics_primitives/instant-ngp/dependencies/tiny-cuda-nn/include/tiny-cuda-nn/optimizers/shampoo.h(794): error: identifier "cublasSetWorkspace" is undefined detected during: instantiation of "tcnn::ShampooOptimizer<T>::ShampooOptimizer(const tcnn::json &) [with T=float]" /home/xxx/graphics_primitives/instant-ngp/dependencies/tiny-cuda-nn/src/optimizer.cu(71): here instantiation of "tcnn::Optimizer<T> *tcnn::create_optimizer<T>(const tcnn::json &) [with T=float]" /home/xxx/graphics_primitives/instant-ngp/dependencies/tiny-cuda-nn/include/tiny-cuda-nn/optimizers/average.h(65): here 3 errors detected in the compilation of "/home/xxx/graphics_primitives/instant-ngp/dependencies/tiny-cuda-nn/src/optimizer.cu". dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/build.make:187: recipe for target 'dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/optimizer.cu.o' failed make[2]: *** [dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/optimizer.cu.o] Error 1 CMakeFiles/Makefile2:305: recipe for target 'dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/all' failed make[1]: *** [dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/all] Error 2 Makefile:90: recipe for target 'all' failed make: *** [all] Error 2-
原因: nccl对应cuda版本是11.0, 不是11.4.
解决: 重装cuda或nccl
-
-
cmake查错: 后面加
-v, 能显示报错的行.
只需要python虚拟环境的服务器中的配置
pip install -r requirements.txt export TCNN_CUDA_ARCHITECTURES=86-
下载并安装 OptiX,并设置 OptiX_INSTALL_DIR 环境变量
[https://developer.download.nvidia.cn/designworks/optix/secure/7.4.0/NVIDIA-OptiX-SDK-7.4.0-linux64-x86_64.sh?Y1wWl64XXNqxb7ETeQnMC1FDmN-fg1gq7yFZP75uvqo80VkyJjPEU3cEJtIRP3v6wmsgw55EbgwyzswJ4A0GXWe5B-UAyQ5Xb5u7L5Sn7Ty8RTcxARIb_EABVVHU-MCH_g75f9_YxdflsT30csKrIWTrIdMjRbKKwOb4lXPIGyZcCQo_3zg&t=eyJscyI6ImdzZW8iLCJsc2QiOiJodHRwczpcL1wvd3d3Lmdvb2dsZS5jb21cLyJ91](https://developer.download.nvidia.cn/designworks/optix/secure/7.4.0/NVIDIA-OptiX-SDK-7.4.0-linux64-x86_64.sh?Y1wWl64XXNqxb7ETeQnMC1FDmN-fg1gq7yFZP75uvqo80VkyJjPEU3cEJtIRP3v6wmsgw55EbgwyzswJ4A0GXWe5B-UAyQ5Xb5u7L5Sn7Ty8RTcxARIb_EABVVHU-MCH_g75f9_YxdflsT30csKrIWTrIdMjRbKKwOb4lXPIGyZcCQo_3zg&t=eyJscyI6ImdzZW8iLCJsc2QiOiJodHRwczpcL1wvd3d3Lmdvb2dsZS5jb21cLyJ91112#) -
需要将 CUDA 升级至 11.4,可以多版本 CUDA 并存,但是将环境变量链接至
export OptiX_INSTALL_DIR=/home/xxx/Install/NVIDIA-OptiX-SDK-7.4.0-linux64-x86_64 -
2. 测试
-
使用现有图片进行测试
./build/testbed --scene data/nerf/fox # or python scripts/run.py --scene ./data/my_data/lego_car/ --mode nerf --save_mesh ./output/lego_car.ply --gui-
问题
./build/testbed: relocation error: ./build/testbed: symbol cublasSetWorkspace_v2 version libcublas.so.11 not defined in file libcublas.so.11 with link time reference-
使用python scripts/run.py查看错误
Traceback (most recent call last): File "scripts/run.py", line 25, in <module> import pyngp as ngp # noqa ImportError: /home/xxx/graphics_primitives/instant-ngp/build/pyngp.cpython-37m-x86_64-linux-gnu.so: symbol cublasSetWorkspace_v2 version libcublas.so.11 not defined in file libcublas.so.11 with link time reference- 原因, 环境配置错误
-
-
-
图片transform
python scripts/colmap2nerf.py --run_colmap --colmap_matcher exhaustive --images ./data/image_samples/crocodile/image --aabb_scale 16 --out ./data/image_samples/crocodile/transforms.json
3. docker
docker build - < Dockerfile
docker run --runtime=nvidia --name [name] --gpus all -it -p 10022:22 [Container ID]
docker start [Container ID]
docker exec -i -t [Container ID] bash
# 使用Dockerfile配置文件
docker install X11
apt-get install -y xserver-xorg-core
apt-get install x11-xserver-utils
export DISPLAY=[client ip addr]:0.0
xhost +
python scripts/run.py
4. colmap
-
install ceres-solver
git clone https://github.com/ceres-solver/ceres-solver cd ./ceres-solver git checkout 2.0.0 mkdir ./build cd build cmake ../ -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF -DCMAKE_INSTALL_PREFIX:PATH=/home/xxx/Install make -j make install -
set ceres enviroment
# cuda export CUDA_HOME=/home/xxx/Install/cuda-11.4.2 export PATH=/home/xxx/Install/cuda-11.4.2/bin:$PATH export LD_LIBRARY_PATH=/home/xxx/Install/cuda-11.4.2/lib64:$LD_LIBRARY_PATH # cmake export PATH=/home/xxx/Install/cmake/bin:$PATH # ceres export CERES_LIBRARIES=/home/xxx/Install/lib:$CERES_LIBRARIES export CERES_INCLUDE_DIRS=/home/xxx/Install/inculde:$CERES_INCLUDE_DIRS # $HOME all export LD_LIBRARY_PATH=/home/xxx/Install/lib:$LD_LIBRARY_PATH export PATH=/home/xxx/Install/bin:$PATH # OptiX export OptiX_INSTALL_DIR=/home/xxx/Install/NVIDIA-OptiX-SDK-7.4.0-linux64-x86_64 -
install colmap
git clone https://github.com/colmap/colmap cd ./colmap mkdir ./build cd build cmake .. # -DCMAKE_INSTALL_PREFIX:PATH=/home/xxx/Install make -j make install colmap -h- 问题METIS_INCLUDE_DIRS-NOTFOUND
- 解决方法安装libmetis-dev
- 问题METIS_INCLUDE_DIRS-NOTFOUND