Creating a virtual GPU-accelerated Linux workstation

This tutorial shows how to create a virtual Linux workstation running CentOS with an attached display-capable GPU. (To create a Windows Workstation, see the tutorial for Creating a virtual GPU accelerated Windows workstation.) Google Cloud Platform (GCP) offers three display-capable GPUs: NVIDIA T4, NVIDIA Tesla P4, and NVIDIA Tesla P100.

After you create the virtual workstation, you learn how to remotely access it using Teradici PC-over-IP (PCoIP), a remote desktop protocol widely used in the media and entertainment industry. PCoIP offers features essential to media production workloads, such as color accuracy and support for lossless display.

Overview

A virtual workstation (VWS) is a cloud-based workstation that can be accessed from anywhere using an internet connection. The concept of remote computing dates back to the 1960s with so-called dumb terminals, but a virtual workstation built using modern cloud infrastructure is a powerful, economical alternative to an expensive workstation at your desk.

With virtual workstations, there is no capital expense. You can customize the size and power of the VWS to the exact specifications required for a particular task. You pay only for the resources used, when they're used, and you're billed by the second.

You don't pay for electricity to power the workstation or for the HVAC to keep it cool. You also don't have to pay a staff of IT professionals to build physical workstations, upgrade motherboards, add RAM, or replace outdated GPUs; all of this is managed on GCP.

Objectives

  • Create a Compute Engine instance with a GPU. This instance serves as the foundation for a virtual workstation.
  • Install NVIDIA drivers on the virtual workstation.
  • Install Teradici PCoIP Cloud Access Software on the virtual workstation.
  • Connect to the virtual workstation from your Mac or Windows computer using a PCoIP software client or Zero Client, a type of hardware endpoint. To access the virtual workstation from a Linux computer, contact your Teradici representative.

Costs

This tutorial uses the following billable components of GCP:

You can use the pricing calculator to generate a cost estimate based on your projected usage. As of the time of writing, the approximate cost for a typical media workstation configuration illustrated in this tutorial is US$2.30 per hour.

The resources that make up the virtual workstation and the factors that affect cost in this tutorial are:

Internet egress represents data that streams from your virtual workstation to your local display client and is billed at internet egress rates. Variables that affect data egress during a PCoIP session are bandwidth, screen resolution, number of display monitors, applications used, and the type of activity on each monitor. The cost in the example is based on an average usage of 10 Mbps. Teradici's Workflow Planning Guide can help you understand different workload requirements.

Before you begin

This tutorial uses gcloud and gsutil commands, which you can run from a Cloud Shell instance launched from the GCP Console. If you want to use gcloud and gsutil on your local workstation, install the Cloud SDK. The tutorial shows you how to run commands in Cloud Shell; if you use the Cloud SDK on your workstation, adjust the instructions accordingly.

  1. Sign in to your Google Account.

    If you don't already have one, sign up for a new account.

  2. Select or create a GCP project.

    Go to the Project selector page

  3. Make sure that billing is enabled for your Google Cloud Platform project.

    Learn how to enable billing

  4. Enable the Compute Engine API.

    Enable the API

In addition, make sure you have the following:

  • A GCP project with quota for Virtual Workstation GPUs in your selected zone. You can get a listing of GPU availability using the gcloud compute accelerator-types list command.
  • A Teradici Zero Client or the latest Teradici software client for Windows, Mac, or Linux to access the virtual workstation.
  • A CAS license of Teradici PCoIP. You can sign up for a trial license, or contact your Teradici representative. You will be provided with a 60-day trial registration code to use for this virtual workstation.

Understanding the architecture

The following diagram shows the components that are used in this tutorial to deploy a single virtual workstation. Optional components shown in the diagram include different ways to connect to your virtual workstation, object and shared storage, and an additional instance for serving third-party licenses.

Virtual workstation architecture

Choosing an accelerator

An important factor when you deploy a virtual workstation is the latency between your location and the instance you create. The lower the latency, the better the experience. Therefore, you want to work in a zone that's geographically closest to you. To learn more about regions and zones, see our Cloud Locations documentation.

  1. Open Cloud Shell. (If you're using the Cloud SDK, open a terminal window on your computer.)

    GO TO Cloud Shell

  2. Get a list of the zones in which GPUs are available:

    gcloud compute accelerator-types list

    Take note of the zone that's physically closest to you.

  3. Set the zone that you want to work with. For [ZONE], substitute the name of the zone you're using, such as us-west2-b:

    gcloud config set compute/zone [ZONE]

Choosing a machine type

You can attach P4 GPUs to any machine type, but each GPU that's added to a virtual workstation must be coupled with a minimum number of vCPUs. This prevents oversubscription of any one resource. For the NVIDIA Tesla P4, you can attach up to 24 vCPUs to one GPU. To add more than 24 vCPUs to your virtual workstation, you must add an additional P4 GPU for every additional 24 vCPUs. For example, a 48 vCPU virtual workstation would require you to attach two P4 GPUs.

The example in this tutorial consists of a 24 vCPU virtual workstation, which is the maximum number of vCPUs allowed per NVIDIA Tesla P4 GPU.

Creating the virtual workstation

The Teradici Graphics Agent (which you install on your virtual workstation later in this tutorial) requires you to enable IP forwarding and to allow HTTPS server traffic during virtual workstation creation.

  1. In Cloud Shell, create the Compute Engine virtual workstation instance. You must provide values for the placeholders in brackets, such as [NAME].

    gcloud compute instances create [NAME] \
        --machine-type [MACHINE-TYPE] \
        --accelerator type=[ACCELERATOR],count=[NUM-GPUS] \
        --can-ip-forward \
        --maintenance-policy "TERMINATE" \
        --tags "https-server" \
        --image-project centos-cloud \
        --image-family centos-7 \
        --boot-disk-size [SIZE]

    For example:

    gcloud compute instances create test-vws \
        --machine-type custom-24-32768 \
        --accelerator type=nvidia-tesla-p4-vws,count=1 \
        --can-ip-forward \
        --maintenance-policy "TERMINATE" \
        --tags "https-server" \
        --image-project centos-cloud \
        --image-family centos-7 \
        --boot-disk-size 100

    After the virtual workstation is created, the machine status is displayed. It looks similar to the following:

    Created https://www.googleapis.com/compute/v1/projects/[PROJECT]/zones/us-west2-b/instances/test-vws.
    NAME ZONE MACHINE_TYPE PREEMPTIBLE INTERNAL_IP EXTERNAL_IP STATUS test-vws us-west2-b custom (24 vCPU, 32.00 GiB) 10.168.0.3 XX.XXX.XX.XXX RUNNING

    Your virtual workstation is created in your project's default VPC network. If you want to create your virtual workstation in a different VPC network, you can specify a different network by adding --network=[NETWORK] to the command.

  2. Note the virtual workstation's external IP address. You will use it later in the tutorial.

Signing in to your virtual workstation

After you create the virtual workstation, you sign in to the machine so that you can configure it.

  1. In Cloud Shell, connect to the new virtual workstation:

    gcloud compute ssh test-vws
  2. Set your account password. Teradici PCoIP requires a user password to be set.

    sudo passwd `whoami`

    When you're prompted, enter a password. You will use this password later in the tutorial to log on to your virtual workstation with the Teradici PCoIP Client.

Installing graphics libraries and a window manager

The default Google Cloud CentOS 7 image is a minimal installation of CentOS 7.x. The next step is to install libraries that are necessary to run your virtual workstation as a graphics workstation. For this tutorial, you also install the KDE window manager.

  1. Install the required components:

    sudo yum -y update
    sudo yum -y install kernel-devel
    sudo yum -y groupinstall "KDE desktop" "X Window System" "Fonts"
    sudo yum -y groupinstall "Development Tools"
    sudo yum -y groupinstall "Server with GUI"
  2. Reboot the workstation:

    sudo reboot

    Your connection from Cloud Shell will be closed.

Installing the NVIDIA driver

NVIDIA T4, NVIDIA Tesla P4, and NVIDIA Tesla P100 GPUs work on GCP only with qualified NVIDIA Quadro Virtual Data Center Workstation (vWS) drivers for both compute and display workloads. These drivers can be downloaded from a public storage bucket.

  1. When the virtual workstation has restarted, in Cloud Shell, reconnect to the virtual workstation:

    gcloud compute ssh test-vws
  2. On your virtual workstation, use gsutil to get a listing of the latest drivers:

    gsutil ls gs://nvidia-drivers-us-public/GRID

    For this tutorial, you use the latest graphics drivers that are available at the time of writing: GRID8.0 Linux driver (version 418.70). The latest qualified driver can always be found under the GRID directory with the highest version number; if you find a newer driver, use that one.

  3. Download and install the driver. If you're using a version of the driver that's more recent than 418.70, change the command accordingly.

    curl -O \
    https://storage.googleapis.com/nvidia-drivers-us-public/GRID/GRID8.0/NVIDIA-Linux-x86_64-418.70-grid.run
    sudo bash NVIDIA-Linux-x86_64-418.70-grid.run

    During driver installation, you might see some prompts:

    • If you're prompted to install 32-bit binaries, choose Yes.
    • If you're prompted to modify the x.org file, choose No.
  4. Verify the driver is installed and working:

    nvidia-smi

    You see results like the following:

    Thu Sep 20 21:58:23 2018
    +-----------------------------------------------------------------------------+
    | NVIDIA-SMI 418.70       Driver Version: 418.70       CUDA Version: 10.1     |
    |-------------------------------+----------------------+----------------------+
    | GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
    | Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
    |===============================+======================+======================|
    |   0  Tesla P4            On   | 00000000:00:04.0 Off |                    0 |
    | N/A   34C    P8     7W /  75W |      0MiB /  7611MiB |      0%      Default |
    +-------------------------------+----------------------+----------------------+
    
    +-----------------------------------------------------------------------------+
    | Processes:                                                       GPU Memory |
    |  GPU       PID   Type   Process name                             Usage      |
    |=============================================================================|
    |  No running processes found                                                 |
    +-----------------------------------------------------------------------------+
    

If you don't see output that's similar to this listing, refer to the Troubleshooting section later in this tutorial.

Installing the Teradici Cloud Access Software

Teradici Cloud Access Software (CAS) provides a Graphics Agent that runs on your virtual workstation, delivering the desktop to your hardware or software client.

  1. On your virtual workstation, add the Teradici software:

    sudo rpm --import https://downloads.teradici.com/rhel/teradici.pub.gpg
    sudo yum -y install wget
    sudo wget -O /etc/yum.repos.d/pcoip.repo \
        https://downloads.teradici.com/rhel/pcoip.repo
  2. Update the software repositories:

    sudo yum -y update
  3. Install the Cloud Access Software:

    sudo yum -y install pcoip-agent-graphics
  4. Set display state to graphical:

    sudo systemctl set-default graphical.target
  5. Reboot the virtual workstation:

    sudo reboot

Register your Teradici agent

To use the Teradici agent, you must have a license, as noted earlier in the tutorial.

  1. In Cloud Shell, reconnect to the virtual workstation:

    gcloud compute ssh test-vws
  2. On your virtual workstation, activate your CAS license:

    pcoip-register-host --registration-code=[REGISTRATION_CODE]

Creating a firewall rule

The PCoIP client communicates with your virtual workstation using several ports. You must set firewall rules that allow traffic to and from your virtual workstation.

  • In Cloud Shell, create a firewall rule that opens the required ports:

    gcloud compute firewall-rules create allow-teradici \
        --allow tcp:443,tcp:4172,udp:4172,tcp:60443

Logging into your virtual workstation using PCoIP

  1. On your local computer, go to the PCoIP Clients section on the Teradici support page, and then download, install, and launch the PCoIP Client application for your operating system.

  2. Select New Connection.

  3. In the Host Address field, enter the external IP address of your virtual workstation. If you want, you can enter a name for the connection.

    Assigning an external IP address to the virtual workstation

  4. When you are connected, authenticate by entering the username and password that you created earlier for the virtual workstation:

    Authenticating in the virtual workstation

  5. Select the desktop to run and then click Connect:

    Selecting a desktop to connect to

    In a few seconds, you see your Linux desktop:

    Linux desktop in the virtual workstation

Testing your virtual workstation

After you've deployed your virtual workstation, you can test performance and interactivity using a number of tools:

  • Run GPU benchmark tools, such as glxgears or glmark2, which are simple programs to test graphics performance on a Linux workstation.
  • Install Blender, an open source 3D software package.
  • Run render benchmarking tools for popular renderers such as V-Ray, Octane, or Maxon.
  • Use Google Chrome to browse your favorite sites or play YouTube videos.

Troubleshooting

This section lists issues you might encounter when you set up or connect to the workstation.

NVIDIA-SMI has failed

Issue: NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver.

Solution: Reinstall the driver and try running nvidia-smi again. If the command still fails, try uninstalling the NVIDIA driver, installing the dkms module, and then reinstalling the driver. Doing this registers the dkms module into the kernel so that updates of the kernel won't require a reinstallation of the graphics driver.

X11 doesn't start

Issue: X11 doesn't start as intended.

Solution: Ensure that the Nouveau graphics driver isn't present in your installation. Nouveau drivers are open source graphics drivers included in some Linux versions. To check if the Nouveau driver is present, run this command in the virtual workstation shell:

lsmod | grep nouveau

If you see any results, follow these steps to disable loading of the Nouveau driver before you install the qualified NVIDIA graphics driver:

  1. As the superuser in the virtual workstation shell, open a text editor and add the following to the last line in the file /etc/modprobe.d/blacklist.conf:

    blacklist nouveau
  2. Reboot the virtual workstation:

    sudo reboot
  3. When the virtual workstation is rebooted, reconnect to it from Cloud Shell:

    gcloud compute ssh test-vws
  4. As the superuser, edit the file /etc/default/grub.

  5. Find the entry named GRUB_CMDLINE_LINUX entry, or add it if it's not already there, and then add the following value to the entry:

    rd.driver.blacklist=nouveau nouveau.modeset=0

    Make sure that this value is inside the quotation marks. For example:

    GRUB_CMDLINE_LINUX="crashkernel=auto console=ttyS0,38400n8 rd.driver.blacklist=nouveau nouveau.modeset=0"
  6. Generate a new grub configuration to include the changes:

    sudo grub2-mkconfig -o /boot/grub2/grub.cfg
  7. Reboot your virtual workstation again:

    sudo reboot
  8. After the virtual workstation has restarted, reconnect to it from Cloud Shell:

    gcloud compute ssh test-vws
  9. Ensure that the Nouveau driver is no longer present:

    lsmod | grep nouveau

    A blank string means that the Nouveau driver is not installed. For more information on the Nouveau driver, see Common Problems in the NVIDIA documentation.

Unable to connect to the virtual workstation

Issue: You are using a PCoIP Zero Client, and you are unable to connect to your virtual workstation.

Solution: Ensure that your Zero Client has firmware version 6.1 or later installed before you connect to the virtual workstation. For more information, contact your Teradici representative.

Cleaning up

To avoid incurring charges to your Google Cloud Platform account for the resources used in this tutorial:

After you've finished the tutorial, clean up the resources you created on GCP so you won't be billed for them in the future.

Stop your virtual workstation

Stopped virtual workstations incur costs for persistent disk, but can be restarted at any time. To stop your virtual workstation, run the following command in Cloud Shell:

gcloud compute instances stop test-vws

Delete the project

  1. In the GCP Console, go to the Projects page.

    Go to the Projects page

  2. In the project list, select the project you want to delete and click Delete .
  3. In the dialog, type the project ID, and then click Shut down to delete the project.

Delete all the components

  1. Delete the virtual workstation.
  2. Delete the firewall rule.

What's next

Was this page helpful? Let us know how we did:

Send feedback about...