Using integrated graphics for headless rendering inside a cloud docker container

5/28/2019

Short version

How can I get an integrated-graphics-accelerated headless X display running inside a Google Cloud Kubernetes Engine pod?

Background

I'm working on a reinforcement learning project that involves running a large number of simulated environments in parallel. I'm doing the simulations using Google Cloud Kubernetes Engine, with panda3d rendering to an Xvfb virtual display.

However, I've noticed that the simulation on my Macbook runs 2x faster than the one on Kubernetes, and profiling suggests the difference is entirely from drawing the frame. Other operations - like linear algebra - are at most 30% slower. My theory is this is because on my Macbook panda3d can take advantage of the integrated graphics, while Xvfb uses software rendering.

My suspicion - gathering together the info in the links below - is the trick is to get a hardware-accelerated headless X server running, then use Virtual GL to fork it across a second Xvfb display. But lord, I am way out of my depth here.

Uncertainties

  • Is hardware vs software rendering actually the source of my slowdown?
  • Do Google Cloud instances have integrated graphics?
  • Can a Kubernetes pod use integrated graphics without modifications to the host?

Useful sources

-- Andy Jones
docker
google-compute-engine
kubernetes
x11
xvfb

1 Answer

5/30/2019

I will answer your questions in order :

  • Most likely yes but it is hard to determine for sure with the information you provided. It depends on how your software and the library you are using (panda3d) handle the rendering.

  • Google Cloud Compute Engine instances do not have integrated graphics, but you can always use GPUs (supported GPUs and related zones listed here). You can enable virtual displays on certain instances as explained in this document.

  • You can setup Kubernetes clusters or node pools in Google Cloud where the nodes are equipped with Nvidia GPUs as it is explained here.

You can take a look in here to check some examples on how to use Kubernetes with GPUs on Google Cloud Platform.

-- marcusp
Source: StackOverflow