Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect the correct nvidia lib path for modern ubuntu systems #646

Merged
merged 1 commit into from
Nov 2, 2021

Conversation

wookayin
Copy link
Contributor

@wookayin wookayin commented Nov 2, 2021

I am glad to see that this package is still maintained (and should be), given that mujoco-py is very widely used in the research community, and we are expecting a new release for mujuco 2.1 support as #640 has been finally merged. I think this is another patch that would be very nice to include towards the next release.

To enable GPU extensions, previously either /usr/local/nvidia/lib64 (for dockers) or /usr/lib/nvidia-\d\d\d needed to exist, but in most of the modern debian and ubuntu systems, the nvidia libraries are actually installed under the path /usr/lib/nvidia.

The commit corrects the path to nvidia library path so that GPU extensions can be installed without any hacky workarounds, to name a few: #583 #383 #408, where users had to do the following hack:

sudo mkdir -p /usr/lib/nvidia-000

To enable GPU extensions, previously either /usr/local/nvidia/lib64
(for dockers) or /usr/lib/nvidia-\d\d\d needed to exist, but in
most of the modern debian and ubuntu systems, the nvidia libraries
are actually installed under the path /usr/lib/nvidia.

The commit corrects the path to nvidia library path so that
GPU extensions can be installed without any hacky workarounds.
@wookayin
Copy link
Contributor Author

wookayin commented Nov 2, 2021

/cc @matthiasplappert @MillionIntegrals your attention on this PR would be appreciated.

Copy link
Contributor

@matthiasplappert matthiasplappert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for contributing

@matthiasplappert matthiasplappert merged commit fb4babe into openai:master Nov 2, 2021
@wookayin
Copy link
Contributor Author

wookayin commented Nov 4, 2021

@matthiasplappert Just to confirm: now I understand that the purpose of this detection is to ensure users to have LD_LIBRARY_PATH containing the nvidia lib directory. What shared libraries does the builder expect? Like libGL.so?

Actually, on 'a' Ubuntu machine (20.04, nvidia driver installed from official nvidia driver installation binary), the /usr/lib/nvidia directory contains only few files:

$ ls /usr/lib/nvidia
32/
egl_dummy_vendor.json
glvnd_check
libGLX_installcheck.so.0

So perhaps only just because the builder is able to detect the directory, it just moves forward to building the GPU extensions as expected. In my case libGL.so or other libraries are installed into /lib/x86_64-linux-gnu: but this directory is usually discoverable by ld without any further configurations (see ldconfig -p). To my knowledge, in some other linux systems may have libGL.so, libcuda.so in a /usr/lib/nvidia-XXX directory, depending on how they were installed.

In summary, this PR simply gets rid of a necessity of the hack as in #408 (which would be still good because it can work out-of-box), but if there were some explicit intentions of checking nvidia lib directories, the path to scan might need to be revisted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants