I need to execute some off-screen rendering program on AWS EC2 GPU instance with CentOS. However, while I found that Ubuntu is very easy to setup, I cannot let CentOS work properly.
The goal is to run some essential utility/test tool on EC2 GPU instance (without screen or X client). In the following article, I will describe how the Ubuntu can be setup and how CentOS/Amazon Linux AMI fails.
On ubuntu 12.04, everything works very smoothly. The EC2 environment I used are:
After the instance is launched, the following commands are executed:
# Install the Nvidia driver sudo apt-add-repository ppa:ubuntu-x-swat/x-updates sudo apt-get update sudo apt-get install nvidia-current # Driver installation needs reboot sudo reboot now # Install and configure X window with virtual screen 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 & # OpenGL programs are now workable. Ex. glxinfo, glxgears DISPLAY=:0 glxinfo
The glxgears
can also run in the background without physical screen or X client:
$ DISPLAY=:0 glxgears 95297 frames in 5.0 seconds = 19059.236 FPS 95559 frames in 5.0 seconds = 19111.727 FPS 94173 frames in 5.0 seconds = 18834.510 FPS
Both "CentOS" and "Amazon Linux AMI" are derived from Red Hat Enterprise edition. However, I cannot make any of them work.
A few days ago, AWS announced their new G2 instance type. In this article, the Amazon Linux AMI with NVIDIA Drivers is recommended for Linux platform. In this AMI, the Nvidia driver, X window and OpenGL libraries are all installed. However, I just get GLX error messages when trying to execute OpenGL programs.
The EC2 instance is launched with the following setting:
After booted, the steps to reproduce this issue is very simple:
sudo X :0 & # Start the X window glxinfo glxgears
The output is:
$ glxinfo name of display: :0 Xlib: extension "GLX" missing on display ":0". Xlib: extension "GLX" missing on display ":0". Xlib: extension "GLX" missing on display ":0". Xlib: extension "GLX" missing on display ":0". Xlib: extension "GLX" missing on display ":0". Error: couldn't find RGB GLX visual or fbconfig Xlib: extension "GLX" missing on display ":0". Xlib: extension "GLX" missing on display ":0". Xlib: extension "GLX" missing on display ":0". Xlib: extension "GLX" missing on display ":0". Xlib: extension "GLX" missing on display ":0". $ glxgears Xlib: extension "GLX" missing on display ":0". Error: couldn't get an RGB, Double-buffered visual
The following error is found in /var/log/Xorg.0.log
:
[139017.484] (EE) Failed to initialize GLX extension (Compatible NVIDIA X driver not found)
I have googled and tried a lot of possible solution, such as:
... but none of them works.
Does anyone have a concrete solution for this issue? Everything I mentioned should be reproducible (I tried many times). I'll appreciate if you can provide reproducible instructions to make OpenGL (GLX) works on EC2 GPU instances with CentOS/Amazon Linux AMI.
Amazon ec2 Linux instances do not come with a GUI. By default, you need terminal access for all application configuration.
Log on to your Windows instance and download the 64-bit NVIDIA driver appropriate for the instance type from http://www.nvidia.com/Download/Find.aspx . For Product Type, Product Series, and Product, use the options in the following table. Open the folder where you downloaded the driver and launch the installation file.
lspci | grep VGA
You should see the busID
is 0:3:0
.
Using sudo, add this into your xorg.conf like so:
Section "Device" Identifier "Device0" Driver "nvidia" VendorName "NVIDIA Corporation" BoardName "GRID K520" BusID "0:3:0" EndSection
This should fix GLX failures.
Just an additional find:
I did this to get the X Server running:
sudo /usr/bin/X :0 &
However, my OpenGL application was still not using the GPU for image rendering, and was therefore being REALLY slow.
This is what saved me -- setting a DISPLAY environment variable to the same display (ID: 0) that the X Server is using:
export DISPLAY=:0.0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With