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

Not able to make it work with gpu on google cloud #213

Open
nicolasgere opened this issue Mar 15, 2021 · 13 comments
Open

Not able to make it work with gpu on google cloud #213

nicolasgere opened this issue Mar 15, 2021 · 13 comments

Comments

@nicolasgere
Copy link

Hi there, There is no documentation on how to make it work with gpu? I tried so hard a lot of stuff, but I don't even know where to start. What is the best way of having gpu support. Do you have link? blog?

@dhritzkiv
Copy link
Member

Hi Nicolas. Generally, using headless-gl with a GPU is supported. However, specific environments and configurations (that includes GPU hardware, drivers, etc.) may require additional configuration, or may not be supported at all.

That said, "not able to make it work" is not enough information to begin to diagnose the problem. For example, are you able to build/run headless-gl at all? Are you able to run the tests in this repo? Is it your concern that the GPU isn't being utilized at all? What are your system details (Linux or Windows; version; GPU; architecture, etc.)?

@nicolasgere
Copy link
Author

I'm using debian, with t4 gpu. Nvidia driver is installed, and nvidia-smi is working as expected. The issue is, gl is undefined.
We used to make it work with xvfb, but xvfb do not support gpu. Our end goal is to run it in kubernetes using something like https://hub.docker.com/r/nvidia/cudagl.

@dhritzkiv
Copy link
Member

Thank you for the details.

Have you:

  • installed the necessary dependencies, not including xvfb?
  • tried building from source (aka not installing from npm)?

I will admit that I don't have much expertise with GPUs on Linux, so unfortunately, I may not be the one to help you.

@dhritzkiv
Copy link
Member

Also, due to the version of Angle that this library depends on, xvfb may be the only way to derive a context on Linux. Newer versions may support EGL and allow offscreen GPU rendering. However, the work to upgrade ANGLE is substantial.

@marcello3d
Copy link

Would this help? #116

@dhritzkiv
Copy link
Member

Very possibly! There were some changes/clarifications requested of the PR author but they never responded.

Overall, the PR's changes aren't that substantial, so it should be easy to revive. I encourage anyone to take on the task, as I can't say when I would have a chance to get around to it myself.

Merge-ability aside, my primary concerns are: introducing subtle breaking changes (to the existing ANGLE support); additional technical support requirements; passing the test suite; and producing prebuilt binaries. Mesa support could be marked as "experimental" as a way to avoid many of these concerns.

@AlexVestin
Copy link

AlexVestin commented Mar 23, 2021

If you're using NVIDIA GPUs I think the easiest path for this would be to use the NVIDIA EGL implementation. You can do this by removing the dependencies in the bindings.gyp file and instead linking with the -lEGL and -lGLESv2 flags, given that the GL & EGL drivers/libraries are installed. Also this would need to be commented out, since the extensions are already included.

Merge-ability aside, my primary concerns are: introducing subtle breaking changes ... passing the test suite

Running the test suite using the NVIDIA EGL+GLES it does fail ~500 of the tests, however I tried running the tests with a newer version of ANGLE and it failed ~380 of the tests, so there might be some issues with the tests being dated.

@dhritzkiv
Copy link
Member

@AlexVestin thank you for adding more details and suggestions for this issue.

If someone with a NVIDIA GPU is able to try those suggestions, and report back, that'd be great! I do not have a NVIDIA GPU to attempt this on.

@NikyPeng
Copy link

The configuration of Linux is mising libraries in binding.gyp.Maybe it is the reason that running on a Linux system without calling the GPU. As usually, linux server doesn't configure the GPU. So,not support to run on a Linux system without calling GPU by default?

@stepancar
Copy link

@AlexVestin thank you for adding more details and suggestions for this issue.

If someone with a NVIDIA GPU is able to try those suggestions, and report back, that'd be great! I do not have a NVIDIA GPU to attempt this on.

I was followed this advice and it looks like everything works! Thank you!

@stepancar
Copy link

The question how we can change the code of library, I would be happy not to use fork.
@dhritzkiv do you have ideas?

@stepancar
Copy link

I can provide config for gyp without code modification, but I can not configure this line somehow https://github.com/stackgl/headless-gl/blob/master/src/native/webgl.cc#L132

@stepancar
Copy link

Ok, I see, this PR solves the problem #116

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

No branches or pull requests

6 participants