Skip to article frontmatterSkip to article content

VSCode for Remote Development

Visual Studio Code

VSCode is an editor made by Microsoft for Windows, Linux and macOS.

Feature-rich compared to Vi, nano, etc., with extensions for

  • Git
  • linting
  • intelligent code completion
  • Remote Development
  • and more!

Install Visual Studio Code here.


SSH

Secure Shell (SSH) is a network communication protocol that allows two computers to communicate, e.g. your laptop and Baskerville.

Pre-requisite: For VSCode Remote Development to work, you need an SSH Client installed.

OSInstructions
Windows 10+Install the Windows OpenSSH Client
Earlier WindowsInstall Git for Windows
macOSComes pre-installed
Debian/UbuntuRun sudo apt-get install openssh-client
RHEL/Fedora/CentOSRun sudo yum install openssh-clients

Install Remote - SSH Extension


Add New SSH Host


Close Remote Connection


Install Remote Explorer


Port Forwarding

You might want to run an application on Baskerville that launches a server remotely and view it on your local browser.

Port forwarding is a way to redirect the remote application’s server address and port to your local browser.

Run this command on your local machine

ssh -N -L <local_port>:bask-pg0XXXuXXX:<remote_port> baskerville

where

  • bask-pg0XXXuXXX is the nodename of the Baskerville compute node you are running the remote application
  • <local_port> is any number from 0 to 65353 (that’s not already in use)
  • <remote_port> is the port number your remote application is using (usually able to manually define this)

Port Forwarding - Tensorboard


tmux

Using tmux on Baskerville allows you to create interactive jobs that you can detach from. If you get disconnected from the cluster, for example by putting your laptop to sleep, your resource allocation on Baskerville will be terminated and your job killed.

You can avoid this with tmux, where you can detach gracefully from a session Baskerville and tmux will continue your session in the background until you come back.

Baskerville is a shared resource. Please don’t leave your job idle, and remember to scancel your job when you are finished.


Interactive Job without tmux


Interactive Job with tmux


Summary

  • VSCode is a powerful, feature-rich text editor
  • VSCode Extensions can aid remote development on Baskerville HPC clusters, such as
    • Remote - SSH
    • Remote explorer
  • Port forward to view remote applications in your local web browser
  • tmux keeps your terminal session alive when your connection to the cluster drops

Useful resources