Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run OpenGL on AWS GPU instances with Ubuntu

I'm trying to get opengl working for headless offscreen rendering on a Amazon p2 instance with Ubuntu Ubuntu Server 16.04.

After instance creation I've installed the appropriate nvidia drivers according to this amazon article, and they seem to be working as expected:

$ lsmod | grep nvidia
nvidia_drm             53248  0
nvidia_modeset        790528  1 nvidia_drm
nvidia              11911168  1 nvidia_modeset
drm_kms_helper        155648  3 cirrus,nouveau,nvidia_drm
drm                   364544  7 ttm,drm_kms_helper,cirrus,nouveau,nvidia_drm

$ nvidia-smi -q | head
==============NVSMI LOG==============

Timestamp                           : Thu Jan 19 11:22:38 2017
Driver Version                      : 375.20

Attached GPUs                       : 1
GPU 0000:00:1E.0
Product Name                    : Tesla K80
Product Brand                   : Tesla

I'm then trying the steps from this related question:

sudo apt-get install xserver-xorg libglu1-mesa-dev freeglut3-dev mesa-common-dev libxmu-dev libxi-dev
sudo nvidia-xconfig -a --use-display-device=None --virtual=1280x1024
sudo /usr/bin/X :0 &

Which does start X but running glxinfo does not work:

$ DISPLAY=:0 glxinfo
name of display: :0
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".
(... line repeats couple of times ...)
Error: couldn't find RGB GLX visual or fbconfig

Changing the BusID in Xorg.conf as mentioned in the related stackoverflow question did not help.

$ lspci|grep VGA
00:02.0 VGA compatible controller: Cirrus Logic GD 5446

/etc/X11/xorg.conf
Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "Tesla K80"
    BusID          "PCI:0:2:0"
EndSection

I've googled quite intensively and it's unclear to me how to proceed next... Any help would be appreciated

like image 663
Filidor Wiese Avatar asked Jan 19 '17 11:01

Filidor Wiese


People also ask

How do I install Nvidia driver in EC2 instance?

To install the NVIDIA GRID driver on your instanceInstall gcc and make, if they are not already installed. Update your package cache and get the package updates for your instance. Upgrade the linux-aws package to receive the latest version. Reboot your instance to load the latest kernel version.


1 Answers

The official documentation about this is http://www.nvidia.com/content/PDF/remote-viz-tesla-gpus.pdf "REMOTE VISUALIZATION ON SERVER-CLASS TESLA GPUS". Read page 15. You have to add BusID to nvidia-xconfig.

First, run nvidia-xconfig --query-gpu-info. This is my p2 instance result.

Number of GPUs: 1

GPU #0:
  Name      : Tesla K80
  UUID      : GPU-f13e8e90-5d2f-f9fb-b7a8-39edf9500698
  PCI BusID : PCI:0:30:0

  Number of Display Devices: 0

Then you need to run this.

sudo nvidia-xconfig --busid=PCI:0:30:0 --use-display-device=none --virtual=1280x1024

You can run Xorg server by sudo Xorg :1 .

The DISPLAY=:1 glxinfo result.

name of display: :1
display: :1  screen: 0
direct rendering: Yes
server glx vendor string: NVIDIA Corporation
server glx version string: 1.4
server glx extensions:
    GLX_ARB_context_flush_control, GLX_ARB_create_context,
...
like image 173
Yu Kobayashi Avatar answered Oct 03 '22 21:10

Yu Kobayashi