使用 CentOS 在 AWS GPU 实例上运行 OpenGL [英] Run OpenGL on AWS GPU instances with CentOS

查看:24
本文介绍了使用 CentOS 在 AWS GPU 实例上运行 OpenGL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在带有 CentOS 的 AWS EC2 GPU 实例上执行一些离屏渲染程序.然而,虽然我发现 Ubuntu 很容易设置,但我不能让 CentOS 正常工作.

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.

目标是在 EC2 GPU 实例(无屏幕或 X 客户端)上运行一些基本实用程序/测试工具.在接下来的文章中,我将描述如何设置 Ubuntu 以及 CentOS/Amazon Linux AMI 如何失败.

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.

在 ubuntu 12.04 上,一切都很顺利.我使用的EC2环境是:

On ubuntu 12.04, everything works very smoothly. The EC2 environment I used are:

  • 实例类型:CG1 和 G2 均经过测试且工作正常.
  • AMI 映像:适用于 HVM 实例的 Ubuntu Server 12.04.3 LTS(美国东部的 ami-b93264d0)
  • 大部分其他设置都是默认设置.

实例启动后,执行如下命令:

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

glxgears也可以在后台运行,无需物理屏幕或X客户端:

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

CentOS 或 Amazon Linux AMI

CentOS"和Amazon Linux AMI"均源自 Red Hat Enterprise 版本.但是,我不能让它们中的任何一个工作.

CentOS or Amazon Linux AMI

Both "CentOS" and "Amazon Linux AMI" are derived from Red Hat Enterprise edition. However, I cannot make any of them work.

几天前,AWS 宣布了他们的新 G2 实例类型.在本文中,Amazon Linux AMI with NVIDIA Drivers 推荐用于 Linux 平台.在这个 AMI 中,Nvidia 驱动程序、X 窗口和 OpenGL 库都已安装.但是,在尝试执行 OpenGL 程序时,我只会收到 GLX 错误消息.

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.

使用以下设置启动 EC2 实例:

The EC2 instance is launched with the following setting:

  • AMI 映像:带有 NVIDIA GRID GPU 驱动程序的 Amazon Linux AMI(美国东部的 ami-637c220a)
  • 实例类型:G2
  • 大部分其他设置为默认设置

启动后,重现此问题的步骤非常简单:

After booted, the steps to reproduce this issue is very simple:

sudo X :0 & # Start the X window
glxinfo
glxgears

输出是:

$ 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

/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:

  • 使用干净的 CentOS HVM AMI 并手动安装 Nvidia 驱动程序
  • 尝试了两种 CG1/G2 实例类型
  • 使用 nvidia-xconfig 重新生成 X 窗口配置
  • 使用 Xvfb 代替 X 窗口
  • 安装台面库后重新安装 Nvidia 驱动

...但它们都不起作用.

... but none of them works.

有人对此问题有具体的解决方案吗?我提到的一切都应该是可重现的(我尝试了很多次).如果您能提供可重现的指令以使 OpenGL (GLX) 在具有 CentOS/Amazon Linux AMI 的 EC2 GPU 实例上工作,我将不胜感激.

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.

推荐答案

lspci |grep VGA

您应该看到 busID0:3:0.

使用 sudo,将其添加到您的 xorg.conf 中,如下所示:

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

这应该可以修复 GLX 故障.

This should fix GLX failures.

这篇关于使用 CentOS 在 AWS GPU 实例上运行 OpenGL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆