如何在带有GPU的Google Compute Engine上运行Gazebo?



我正在尝试在具有1个NVIDIA Tesla K80 GPU的Ubuntu 16.04 Google Compute Engine实例中运行Gazebo。GPU 使用以下驱动程序进行配置,这些驱动程序是必需的,因为我也在应用程序中使用 Tensorflow。

这里给出了类似问题的解决方案,但是我没有成功实施JLiviero或Jose Luis Rivero的答案。根据 JLiviero 的解决方案设置 Xvfb 后,以详细模式运行 Gazebo 失败并产生以下输出:

jonathon@full-algo-1-gpu:~/catkin_ws$ gazebo --verbose
Gazebo multi-robot simulator, version 7.14.0
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org
[Msg] Waiting for master.
[Msg] Waiting for master.
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 10.138.0.8
[Msg] Publicized address: 10.138.0.8
[Err] [RenderEngine.cc:734] Can't open display: 
[Wrn] [RenderEngine.cc:97] Unable to create X window. Rendering will be disabled
[Wrn] [RenderEngine.cc:301] Cannot initialize render engine since render path type is NONE. Ignore this warning ifrendering has been turned off on purpose.
[Err] [RenderEngine.cc:734] Can't open display: 
[Wrn] [RenderEngine.cc:97] Unable to create X window. Rendering will be disabled
[Wrn] [RenderEngine.cc:301] Cannot initialize render engine since render path type is NONE. Ignore this warning ifrendering has been turned off on purpose.
[Wrn] [GuiIface.cc:99] gazeb: cannot connect to X server 

我在实例中使用的软件:

  • 凉亭版本:7.14
  • 蟒蛇版本:2.7.12
  • 张量流版本:1.10.1

如何让凉亭在不崩溃的情况下运行?

看起来Gazebo正在尝试使用X-server。我怀疑安装一些显示环境包可能会有所帮助。

试试这个:

sudo apt-get install gnome-core

我不知道你是否最终解决了这个问题,但在网上找不到解决方案,所以在这里我公开了它为我工作的方式。

您指出的解决方案在这种情况下不起作用Xvfb,正如这里指出的那样:"Xvfb 是一个 X 服务器,其全部目的是在没有专用图形硬件的情况下提供 X11 服务"。在那里,他们提出了各种方法,但有效的方法是直接在GPU上设置无头xorg服务器。在此处查看更多信息。

因此,如果您的 nvidia 驱动程序设置正确(您可以运行nvidia-smi(,只需安装xterm并使用 aptxorg即可。然后正确配置/etc/X11/xorg.conf。对我有用的文件是:

# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig:  version 460.91.03
Section "ServerLayout"
Identifier     "Layout0"
Screen      0  "Screen0" 0 0
#InputDevice    "Keyboard0" "CoreKeyboard"
#InputDevice    "Mouse0" "CorePointer"
EndSection
Section "Files"
EndSection
Section "InputDevice"
# generated from default
Identifier     "Mouse0"
Driver         "mouse"
Option         "Protocol" "auto"
Option         "Device" "/dev/psaux"
Option         "Emulate3Buttons" "no"
Option         "ZAxisMapping" "4 5"
EndSection
Section "InputDevice"
# generated from default
Identifier     "Keyboard0"
Driver         "kbd"
EndSection
Section "Monitor"
Identifier     "Monitor0"
VendorName     "Unknown"
ModelName      "Unknown"
Option         "IgnoreEDID"
EndSection
Section "Device"
Identifier     "Device0"
Driver         "nvidia"
VendorName     "NVIDIA Corporation"
EndSection
Section "Screen"
Identifier     "Screen0"
Device         "Device0"
Monitor        "Monitor0"
DefaultDepth    24
Option         "AllowEmptyInitialConfiguration" "True"
SubSection     "Display"
Virtual     1280 1024
Depth       24
EndSubSection
EndSection

之后,使用以下命令运行 xserver:sudo xinit.您应该能够看到在GPU上运行的Xorg进程。如果由于某种原因已经有一个 Xorg 进程正在运行,您可以使用sudo systemctl stop gdm3sudo systemctl stop lightdm.service杀死它,具体取决于显示管理器。

之后,检查DISPLAYenv 变量是否已:0设置并启动gzserver。您还应该能够看到 GPU 上运行的gzserver进程。

最新更新