TheCodez / dynamic-occupancy-grid-map

Implementation of "A Random Finite Set Approach for Dynamic Occupancy Grid Maps with Real-Time Application"
MIT License
281 stars 39 forks source link

Segmentation fault in framebuffer.cpp (cudaGraphicsGLRegisterImage) #97

Closed fredd2409 closed 2 years ago

fredd2409 commented 2 years ago

Hi,

thanks for providing this implementation. I'm trying to run the demo but unfortunately I'm getting a segmentation fault (core dumped).

I narrowed down the problem to line 26 in framebuffer.cpp:

CHECK_ERROR(cudaGraphicsGLRegisterImage(&resource, texture, GL_TEXTURE_2D, cudaGraphicsRegisterFlagsReadOnly));

Unfortunately, no further error message is given.

I've tested the following environments (in Docker) but the error is the same in all of them:

Do you have any hints what could be wrong?

Thanks in advance!

TheCodez commented 2 years ago

@fredd2409 what GPU do you have? The issue is most likely related to that.

fredd2409 commented 2 years ago

I have an NVIDIA Quadro RTX 3000 with driver version 515.65.01

TheCodez commented 2 years ago

Could you try this step from the README?

To verify that your CUDA installation is working, consider compiling and running one of the examples from /usr/local/cuda/samples. In particular ones that use OpenGL+CUDA, e.g. samples/2_Graphics/Mandelbrot.

Without any error it is hard to know what's wrong unfortunately.

fredd2409 commented 2 years ago

@TheCodez Thanks for the hint. Indeed, the sample did not work, neither in Docker nor on the host. The problem was that OpenGL used the internal Intel GPU of my notebook instead of the NVIDIA GPU.

As information for anyone who stumbles over this: The solution for me was to run sudo prime-select nvidia and reboot.

With that it works on the host. I have yet to figure out how to do this in Docker.

Anyway, I'll close the issue since this is not related to your project.

Thanks for the quick support!

fredd2409 commented 2 years ago

For completeness sake if someone else wants to run this in a container.

ENV NVIDIA_VISIBLE_DEVICES=all
ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility,graphics  

need to be added to the Dockerfile.

Can confirm that this also works in Ubuntu 22.04 with Cuda 11.7.