Create a virtual GPU-accelerated Linux workstation

This tutorial shows how to create a virtual Linux workstation running Ubuntu 22.04 with an attached display-capable GPU. Cloud de Confiance by S3NS offers four display-capable GPUs: NVIDIA L4, NVIDIA T4, NVIDIA P4, and NVIDIA P100.

To create a Windows workstation, see the tutorial for Creating a virtual GPU accelerated Windows workstation.

After you create the virtual workstation, you learn how to remotely access it using HP Anyware (formerly Teradici CAS), using PC-over-IP (PCoIP®) technology, a remote desktop protocol widely used in the media and entertainment, game development, architecture, and engineering industries. PCoIP offers features essential to these types of workloads, such as color accuracy, support for multiple monitors, lossless display, and tablet pressure sensitivity.

This tutorial assumes you are familiar with the Linux command line.

Architecture

The following diagram shows the components 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, shared storage, an additional instance for serving third-party licenses, and additional infrastructure representing a render or compute farm.

Virtual workstation architecture.

Choose a region

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 region that's geographically closest to you. To learn more about where the different GPUs are available, see GPU regions and zones availability.

  1. Open Cloud Shell. (If you're using the gcloud CLI, 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 region and zone that's physically closest to you.

  3. Set the zone that you want to work with:

    gcloud config set compute/zone ZONE

    Replace ZONE with the name of the zone you're using, such as us-west1-b.

Choose a machine type

NVIDIA L4 GPUs are attached to the G2 machine type. Virtual machines with one or more GPUs have a maximum number of vCPUs for each GPU you add to the instance. For example, each NVIDIA L4 GPU lets you have up to 32 vCPUs and up to 128 GB of memory in your instance machine type. To see the available vCPU and memory ranges for different GPU configurations, see the GPUs list.

The example in this tutorial consists of an 8 vCPU G2 virtual workstation, which is well under the limit of 32 vCPUs for a single NVIDIA L4 GPU.

Create the virtual workstation

  1. In Cloud Shell, create the Compute Engine virtual workstation instance:

    gcloud compute instances create VM_NAME \
        --zone=ZONE \
        --machine-type=MACHINE_TYPE \
        --accelerator=type=ACCELERATOR,count=NUM-GPUS \
        --maintenance-policy="TERMINATE" \
        --image-project=ubuntu-os-cloud \
        --image-family=ubuntu-2204-lts \
        --boot-disk-size=SIZE \
        --boot-disk-type=TYPE \
        --network=NETWORK
    

    Replace the following:

    • VM_NAME is the name of your workstation.
    • ZONE is the zone in which to create the VM.
    • MACHINE_TYPE is the predefined or custom machine configuration.
    • ACCELERATOR is the type of GPU you want to attach, such as nvidia-l4-vws.
    • NUM-GPUS is the number of GPUs to attach to the VM.
    • SIZE is the size of the boot disk, in gigabytes.
    • TYPE is the type of boot disk. To get a list of available disk types, run gcloud compute disk-types list.
    • NETWORK is the network in which to create the VM.

    For example:

    gcloud compute instances create test-workstation \
        --zone=us-west1-b \
        --machine-type=g2-standard-8 \
        --accelerator=type=nvidia-l4-vws,count=1 \
        --maintenance-policy="TERMINATE" \
        --image-project=ubuntu-os-cloud \
        --image-family=ubuntu-2204-lts \
        --boot-disk-size=100 \
        --boot-disk-type=pd-ssd \
        --network=default
    

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

    NAME: test-workstation
    ZONE: us-west1-b
    MACHINE_TYPE: g2-standard-8
    PREEMPTIBLE:
    INTERNAL_IP: 10.138.XX.XXX
    EXTERNAL_IP: XX.XXX.XXX.XXX
    STATUS: RUNNING
    

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

    You can retrieve the external IP address of your virtual workstation at any time using the Cloud de Confiance console.

Sign 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 VM_NAME
  2. Set your account password. Logging into a virtual workstation using the PCoIP software client requires a user password.

    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 HP Anyware PCoIP Client.

Install the base libraries

The default Cloud de Confiance Ubuntu 22.04 image is a minimal installation of Ubuntu. The next step is to install libraries that are necessary to run your virtual workstation as a graphics workstation.

  1. Update the software repositories:

    sudo apt update
  2. Install the base components:

    sudo apt install -y build-essential
    sudo apt install -y libvulkan1
    
  3. Update the gcc version for the NVIDIA driver:

    sudo apt install -y gcc-12
    sudo apt install -y linux-headers-$(uname -r)
    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 12
    sudo update-alternatives --config gcc
    

Install the NVIDIA driver

NVIDIA L4, NVIDIA T4, NVIDIA P4, and NVIDIA P100 GPUs work on Cloud de Confiance only with qualified NVIDIA RTX Virtual Workstation drivers for visualization workloads. These drivers can be downloaded from a public Cloud de Confiance storage bucket.

  1. To install the latest NVIDIA RTX Virtual Workstation driver, follow the instructions (Steps 3 and 4, only).

  2. Reboot the workstation:

    sudo reboot

Install the desktop environment

A desktop environment is necessary to run your virtual workstation as a graphics workstation. For this tutorial, you install the KDE Plasma Desktop.

  1. Install the desktop environment:

    sudo apt update
    sudo apt -y install kubuntu-desktop
    sudo apt -y install dialog
    
  2. Reboot the workstation:

    sudo reboot

Install HP Anyware software

HP Anyware software provides a graphics agent that runs on your virtual workstation, delivering the desktop to your hardware or software client.

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

    gcloud compute ssh VM_NAME
  2. Add the Teradici software repository:

    curl -1sLf \
        https://dl.anyware.hp.com/TOKEN/pcoip-agent/cfg/setup/bash.deb.sh \
        | sudo -E distro=ubuntu codename=jammy bash
    

    Replace the following:

  3. Update the software repositories:

    sudo apt update
  4. Optional: Install USB dependencies, if you need to support USB devices other than keyboards, mice, and pointer devices.

    sudo apt -y install usb-vhci-dkms
  5. Install the HP Anyware software:

    sudo apt -y install pcoip-agent-graphics

Register the Anyware Graphics Agent

To use the Anyware Graphics Agent, you must have an HP Anyware license.

  1. In Cloud Shell, activate your HP Anyware software license:

    pcoip-register-host --registration-code=REGISTRATION-CODE

    Replace REGISTRATION-CODE with the code provided to you by HP Teradici in the form ABCDEFGHIJKL@0123-4567-89AB-CDEF.

  2. Reboot the virtual workstation:

    sudo reboot

Create a firewall rule

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

  • In Cloud Shell (not on the virtual workstation), create a firewall rule that opens the required ports:

    gcloud compute firewall-rules create allow-pcoip \
        --action=ALLOW \
        --rules=tcp:443,tcp:4172,udp:4172 \
        --source-ranges=0.0.0.0/0
    

Sign in to your virtual workstation using the PCoIP client

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

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

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

    In a few seconds, your Linux desktop appears.

Test your virtual workstation

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

You can also learn more about PCoIP performance optimization based on your workload.