ylabbe / cosypose

Code for "CosyPose: Consistent multi-view multi-object 6D pose estimation", ECCV 2020.
MIT License
301 stars 89 forks source link

eglInitialize() failed with error: 3008 #54

Open lahavlipson opened 3 years ago

lahavlipson commented 3 years ago

When I try to run the bullet_scene_renderer, I get an eglInitialize() failed with error: 3008 error. I am able to reproduce the issue with the following code

import os
import subprocess
import xml.etree.ElementTree as ET
import pkgutil
import pybullet as pb

_client_id = pb.connect(pb.DIRECT)
os.environ['MESA_GL_VERSION_OVERRIDE'] = '3.3'
os.environ['MESA_GLSL_VERSION_OVERRIDE'] = '330'
# Get EGL device
assert 'CUDA_VISIBLE_DEVICES' in os.environ
devices = os.environ.get('CUDA_VISIBLE_DEVICES', ).split(',')
device_id = str(devices[-1])
out = subprocess.check_output(['nvidia-smi', '--id='+device_id, '-q', '--xml-format'])
tree = ET.fromstring(out)
gpu = tree.findall('gpu')[0]
dev_id = gpu.find('minor_number').text
os.environ['EGL_VISIBLE_DEVICES'] = str(dev_id)
egl = pkgutil.get_loader('eglRenderer')
assert egl
pb.loadPlugin(egl.get_filename(), "_eglRendererPlugin", physicsClientId=_client_id) # Fails here

Which outputs:

pybullet build time: May 24 2021 16:57:46 
EGL device choice: 8 of 13 (from EGL_VISIBLE_DEVICES) 
eglInitialize() failed with error: 3008   

The rendering code works when I change "_eglRendererPlugin" to "eglRendererPlugin" but then the rendering slows down a ton.

It looks like the error is maybe triggered here. For reference, I am working on a headless machine / cluster. Please let me know if there is any additional information I can provide. Thanks!

dedoogong commented 2 years ago

me too I got the same issue!! I want to train cosypose on the GPU server~! but I seems like, EGL prevent it. It supports only local, GUI available environment... Please help us.

lahavlipson commented 2 years ago

@dedoogong NVidia seems to have released a driver update which may fix this issue: https://forums.developer.nvidia.com/t/linux-solaris-and-freebsd-driver-465-27-new-feature-branch-release/176631

In any event, I wrote my own renderer using pytorch3d which creates nearly identical renders: https://github.com/princeton-vl/Coupled-Iterative-Refinement/blob/main/utils/pt_renderer.py

You can substitute this for the pybullet renderer and cosypose will still get the exact same performance.