kcheng1021 / GaussianPro

[ICML2024] Official code for GaussianPro: 3D Gaussian Splatting with Progressive Propagation
https://kcheng1021.github.io/gaussianpro.github.io/
MIT License
551 stars 36 forks source link

An illegal memory access was encountered in Propagation.cu at line 1117 #53

Open Eming404 opened 2 weeks ago

Eming404 commented 2 weeks ago

Thanks for your amazing works! I have some troubles in the environment. There was no error during installing the modules. But when I run demo.sh in youtube01, the error occurred and the training progress was terminated:

Training progress:   3%|?                    | 1010/30000 [00:57<25:22, 19.04it/s, Loss=0.2464046]
an illegal memory access was encountered in Propagation.cu at line 1117

Then I debug the code and found the error was raised in the line 436 of utils/graphics_utils.py:

results = propagate(images, intrinsics, poses, depth, normal, depth_intervals, patch_size)

I guess there are some wrong configurations when I build the "gaussianpro" module.

Here is my configs:

I followed the readme to install those modules:

conda env create --file environment.yml
conda activate gaussianpro
pip install ./submodules/Propagation

I modified the submodules/Propagation/setup.py as bellow:

setup(
    name='gaussianpro',
    ext_modules=[
        CUDAExtension('gaussianpro',
            include_dirs=['/usr/local/include/opencv4', '/usr/local/cuda11.6/include', '.'],
            library_dirs=['/root/miniconda3/envs/gaussianpro/lib'],  
            libraries=['opencv_core', 'opencv_imgproc', 'opencv_highgui', 'opencv_imgcodecs'],  
            sources=[
                'PatchMatch.cpp', 
                'Propagation.cu',
                'pro.cpp'
            ],
            extra_compile_args={
                'cxx': ['-O3'],
                'nvcc': ['-O3',
                    '-gencode=arch=compute_80,code=sm_80',
                ]
            }),
    ],
    cmdclass={ 'build_ext' : BuildExtension }
)

It is strange that the building progress could not find my opencv and torch, so I add the path in my ~/.bashrc:

export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/root/miniconda3/envs/gaussianpro/lib/python3.7/site-packages/torch/lib:$LD_LIBRARY_PATH

Then the gaussianpro was installed successfully.

I think there must be some error when I build the gaussianpro but I cannot fix it. Any help on this would be greatly appreciated.

flybiubiu commented 2 weeks ago

Same problem

from setuptools import setup from torch.utils.cpp_extension import BuildExtension, CUDAExtension

import os.path as osp ROOT = osp.dirname(osp.abspath(file))

setup( name='gaussianpro', ext_modules=[ CUDAExtension('gaussianpro', include_dirs=['/home/ubuntu/anaconda3/envs/gaussianpro/include/opencv4', '/usr/local/cuda-11.3/include', '.'], library_dirs=['/home/ubuntu/anaconda3/envs/gaussianpro/lib'], libraries=['opencv_core', 'opencv_imgproc', 'opencv_highgui', 'opencv_imgcodecs'], sources=[ 'PatchMatch.cpp', 'Propagation.cu', 'pro.cpp' ], extra_compile_args={ 'cxx': ['-O3'], 'nvcc': ['-O3', '-gencode=arch=compute_75,code=sm_75', ] }), ], cmdclass={ 'build_ext' : BuildExtension } )

ImportError: /home/ubuntu/anaconda3/envs/gaussianpro/lib/python3.7/site-packages/gaussianpro.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZN2cv3MatC1Ev

kcheng1021 commented 1 week ago

Hi, the opencv library in setup.py is C++ version. So it could be installed by "conda install -c conda-forge opencv".