X

Using OpenGL to Enhance GPU Use Cases on Oracle Cloud

Marcin Zablocki
Solutions Architect

Modern graphical processing units (GPUs) like the NVIDIA P100 and V100 are computational powerhouses. They work to optimal advantage on Oracle Cloud Infrastructure, with the fast compute, storage, and networking components that we offer. Our customers use them to build complex simulations, train artificial intelligence models, run multidimensional databases, and perform billions of computations per second.

OpenGL is a powerful open source application programming interface (API) for GPU components that can weave together all the components needed to orchestrate these complicated workloads. This tutorial helps you do that in a few simple steps.

Install

Start by launching an instance. Here we’ll use Oracle-Linux-7.7-Gen2-GPU-2020.03.23-0 on a VM.GPU2.1 shape. Oracle GPU-based images already have the required drivers installed, so the process is accelerated.

After the instance is running, log in to it by using SSH. Then, install X Window System, a display manager (GNOME/GDM), and a desktop environment (MATE):

# sudo yum groupinstall "X Window System"
# sudo yum install gdm
# sudo yum groupinstall "MATE Desktop"

Now, install a VNC server and VirtualGL. VirtualGL is an open source toolkit that lets any Linux or UNIX console run OpenGL applications with full hardware acceleration. The complementary TurboVNC is tuned to provide peak performance for 3D and video workloads.

Binaries are available on sourceforge.net. Here, we point yum to the RPM files directly:

# sudo yum install https://downloads.sourceforge.net/project/virtualgl/2.6.3/VirtualGL-2.6.3.x86_64.rpm
# sudo yum install https://downloads.sourceforge.net/project/turbovnc/2.2.4/turbovnc-2.2.4.x86_64.rpm

Configure the X Server

After the required software is installed, configure the X server to enable GPU sharing for virtual sessions. Run the following commands:

# sudo nvidia-xconfig --use-display-device=none --busid="PCI:4:0:0"
vglserver_config -config +s +f -t

Note that this isn’t the most secure configuration, and in the long run, you might want to add specific users to the vglusers group and lock down the configuration, as follows:

vglserver_config -config -s -f -t

To avoid being locked out when the screen saver launches, set the local user password to something you can use later.

TurboVNC provides multiple authentication options. I like to use a one-time password every time I connect. To do that, edit the /etc/turbovncserver-security.conf file and change the value for permitted-security-types as follows:

permitted-security-types = OTP

Enable and start GDM:

systemctl enable gdm --now

Then, launch a VNC server:

[opc@instance-20200331-1205 ~]$ /opt/TurboVNC/bin/vncserver -wm mate-session -vgl -otp
Desktop 'TurboVNC: instance-20200331-1205:1 (opc)' started on display instance-20200331-1205:1

One-Time Password authentication enabled. Generating initial OTP ...
Full control one-time password: 12345678
Run '/opt/TurboVNC/bin/vncpasswd -o' from within the TurboVNC session or
'/opt/TurboVNC/bin/vncpasswd -o -display :1' from within this shell
to generate additional OTPs
Starting applications specified in /home/opc/.vnc/xstartup.turbovnc
(Enabling VirtualGL)
Log file is /home/opc/.vnc/instance-20200331-1205:1.log

Note the display number (:1 after the instance name). You might want to use this in the future to generate additional passwords.

Connect to the Service

If you want to access the VNC server directly without SSH forwarding, ensure that your security list allows connections on port 5901/tcp. You can add more ports if you’re planning to use more than one session at a time. The standard VNC port is 5900 plus a display number (for example, 5901 for :1, 5902 for :2).

Allow access in local firewall settings as follows:

sudo firewall-cmd --zone=public --permanent --add-port=5901/tcp
sudo firewall-cmd --reload

Connect to the system by using the TurboVNC or TigerVNC client. Other options might be available, but these two clients work best with the TurboVNC server.

Enter the IP address of the server and the display number. For example:

192.0.2.1:1

Authenticate with a one-time password and enjoy your new 3D accelerated remote Linux workstation.

Screenshot that shows the About page for the TurboVNC graphical user interface ParaView.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.