NVIDIAGameWorks / kaolin-wisp

NVIDIA Kaolin Wisp is a PyTorch library powered by NVIDIA Kaolin Core to work with neural fields (including NeRFs, NGLOD, instant-ngp and VQAD).
Other
1.45k stars 133 forks source link

GLError: glGetUniformLocation when running Interactive Training example #13

Closed idaho777 closed 2 years ago

idaho777 commented 2 years ago

I'm trying to run the interactive training example: WISP_HEADLESS=0 python3 app/main_interactive.py --config configs/nglod_nerf_interactive.yaml --dataset-path /path/to/V8 --dataset-num-workers 4 but I'm receiving the following issue:

Traceback (most recent call last):
  File "app/main_interactive.py", line 12, in <module>
    setup_cuda_context()     # Must be called before any torch operations take place
  File "/ssd003/home/joonho/workspace/repos/kaolin-wisp/app/cuda_guard.py", line 29, in setup_cuda_context
    window = app.Window(width=10, height=10, title='dummy', visible=False)
  File "/h/joonho/.conda/envs/kaolin/lib/python3.8/site-packages/glumpy/app/__init__.py", line 188, in __new__
    window = __backend__.Window(*args, **kwargs)
  File "/h/joonho/.conda/envs/kaolin/lib/python3.8/site-packages/glumpy/app/window/backends/backend_glfw_imgui.py", line 248, in __init__
    self.imguiRenderer = GlfwRenderer(self._native_window, attach_callbacks=False)
  File "/h/joonho/.conda/envs/kaolin/lib/python3.8/site-packages/imgui/integrations/glfw.py", line 13, in __init__
    super(GlfwRenderer, self).__init__()
  File "/h/joonho/.conda/envs/kaolin/lib/python3.8/site-packages/imgui/integrations/opengl.py", line 60, in __init__
    super(ProgrammablePipelineRenderer, self).__init__()
  File "/h/joonho/.conda/envs/kaolin/lib/python3.8/site-packages/imgui/integrations/base.py", line 17, in __init__
    self._create_device_objects()
  File "/h/joonho/.conda/envs/kaolin/lib/python3.8/site-packages/imgui/integrations/opengl.py", line 108, in _create_device_objects
    self._attrib_location_tex = gl.glGetUniformLocation(self._shader_handle, "Texture")
  File "/h/joonho/.conda/envs/kaolin/lib/python3.8/site-packages/OpenGL/latebind.py", line 63, in __call__
    return self.wrapperFunction( self.baseFunction, *args, **named )
  File "/h/joonho/.conda/envs/kaolin/lib/python3.8/site-packages/OpenGL/GL/VERSION/GL_2_0.py", line 431, in glGetUniformLocation
    return baseOperation( program, name )
  File "/h/joonho/.conda/envs/kaolin/lib/python3.8/site-packages/OpenGL/platform/baseplatform.py", line 416, in __call__
    return self( *args, **named )
  File "/h/joonho/.conda/envs/kaolin/lib/python3.8/site-packages/OpenGL/error.py", line 231, in glCheckError
    raise self._errorClass(
OpenGL.error.GLError: GLError(
        err = 1282,
        description = b'invalid operation',
        baseOperation = glGetUniformLocation,
        cArguments = (1, b'Texture\x00'),
        result = -1
)

Looking at the documentation for glGetUniformLocation, I see the error section say

GL_INVALID_OPERATION is generated if program is not a program object.

GL_INVALID_OPERATION is generated if program has not been successfully linked.

where GL_INVALID_OPERATION is error code 0x0502 == 1282.

I've setup my conda environment to successfully run the Training NGLOD-NeRF from multiview RGB-D data on a remote server over ssh tunnel + VNC Viewer but cant get the interactive mode working.

idaho777 commented 2 years ago

I played around with the Glumpy library and was able to run their examples fine, but I added the line app.use("glfw_imgui") and got the same error above.

tovacinni commented 2 years ago

Hi, thanks for your interest in our work! Can you provide a little more details about the platform you're running on?

(Not sure if this is related, but I've seen this error before on my M1 Macbook for an unrelated project that also uses Glumpy and specifically the glfw-imgui backend)

tovacinni commented 2 years ago

For the glumpy examples, did you specifically run the imgui examples they have on their repo?

orperel commented 2 years ago

@idaho777 Your error is due to glumpy being unable to obtain an OpenGL context. VNCViewer / wisp should be agnostic to each other, so this is more likely something about the GL setup in your remote machine.

We just added support for opengl via docker this week, you may want to give that option a try: https://github.com/NVIDIAGameWorks/kaolin-wisp#using-docker

idaho777 commented 2 years ago

I got this working on my local Ubuntu machine, so it looks like an issue with the server configuration.

resurgo97 commented 2 years ago

Hi, did you resolve the problem? I am stuck with the same issue.

Actually, I found a workaround from https://github.com/facebookresearch/eft/issues/15 (I have no clue how this works though) Then, I ran into another error

root@gs01:/wisp# WISP_HEADLESS=0 python3 app/main_interactive.py --config configs/nglod_nerf_interactive.yaml --dataset-path /path/to/V8 --dataset-num-workers 4 [i] Using PYGLFW_IMGUI (GL 2.1) Traceback (most recent call last): File "/wisp/app/main_interactive.py", line 12, in setup_cuda_context() # Must be called before any torch operations take place File "/wisp/app/cuda_guard.py", line 34, in setup_cuda_context import pycuda.gl.autoinit File "/wisp/pycuda/pycuda/gl/autoinit.py", line 10, in context = make_default_context(lambda dev: cudagl.make_context(dev)) File "/wisp/pycuda/pycuda/tools.py", line 226, in make_default_context raise RuntimeError( RuntimeError: make_default_context() wasn't able to create a context on any of the 8 detected devices

Anyone help me please

Hippogriff commented 1 year ago

@resurgo97 Did you figure out the problem?