X
April 8, 2020

GPU-Enabled Remote Workstation for VSCode

By: Justin Blau | Senior Technical Product Manager

Share

Accessing GPU-enabled workstations can present some challenges for data scientists in their day-to-day work. If an organization decides to provide laptops with GPUs, it can result in higher costs for maintenance and the hardware may be comparatively under-powered for the workloads that need to be run during development. Desktop workstations are another option, but they are not as convenient, portable, or available wherever the data scientist needs to work. To provide data scientists with the power they require for their daily development tasks an ideal solution would include the ability to run a GPU-enabled environment on-demand in the cloud while still maintaining the Integrated Development Environment workflow. This can be achieved by combining a GPU-enabled instance within OCI, Visual Studio Code, the Remote Development Extension, and the Python extension.

Visual Studio Code is growing in popularity due to its extensibility via single-click downloadable extensions. The Remote Development Extension seamlessly integrates a cloud-hosted development environment with the entire feature-set of the IDE. Combined with the Python extension, data scientists can use a familiar set of tools with a cloud-hosted GPU workstation from any device.

Prerequisites

Visual Studio Code

Remote Development Extension

Compute instance deployed with Visual Studio Code Remote Workstation image from the Marketplace into a subnet with public internet access that allows ingress connections on port 22.

IP Address of OCI Instance - Wait for the instance to deploy and then copy the public IP address.

Connecting to the remote workstation

The GPU-enabled remote workstation for VSCode image includes all of the common packages and drivers required to get started. Once the instance is running, open Visual Studio Code. At the bottom left, if the Remote Development extension is installed correctly there will be a green icon. If not, click the link in the prerequisites and install the extension.

  1. Click on the green remote connection icon to open the Command Palette
  2. Select “Remote-SSH: Connect to Host…” and then “Add New SSH Host…”.
  3. In the resulting input box write “ssh ubuntu@<public-ip-address>” of the created instance in the previous step. Make sure to use the correct ssh private key that is paired to the public key provided when creating the instance. Add "-i /path/to/key" after ssh if the key used differs from the default private key.
  4. When successfully connected the green remote connection button will display “SSH: <public-ip-address>”. The VSCode terminal will now execute commands on the remote system and the file browser will operate on the remote system as well. Extensions from the marketplace will also be installed to the remote system.
  5. Next, select the python interpreter by opening the command palette by clicking “View” > “Command Palette” and typing “Python: Select Interpreter”
  6. The image is setup with a basic installation of miniconda, so select the one labelled (‘base’: conda). Additional environments can be configured using the terminal.
  7. A sample from PyTorch (https://pytorch.org/tutorials/beginner/blitz/cifar10_tutorial.html) that runs a CNN against the a CIFAR dataset is available in the samples folder in the home directory. Click File > Open Folder and select samples (/home/ubuntu/samples/)
  8. Click pytorch-cnn-sample.ipynb and under the file tab press the double arrow to run all of the cells

 

 

This is a GPU-enabled workload, which runs through two epochs over the CIFAR dataset.

To get direct access to the instance click “Terminal” > “New Terminal” or use another terminal application and connect through SSH

That’s it! You are ready to begin developing Artificial Intelligence workloads on a OCI GPU-enabled instance!

Senior Technical Product Manager
More about Justin Blau

Share