Table of Contents

Advanced: Connecting to Hábrók with Visual Studio Code

Microsoft Visual Studio Code (VS Code) is a popular source code editor and IDE that is available for free and which can run on Linux, Windows and macOS systems. It allows connecting to remote environments and working from them and the installation of extensions to support different programming languages and make use of additional development tools. Because of this, it is suitable for connecting to Hábrók to perform software development tasks. There are two main ways to use VS Code from Hábrók, either by connecting your local VS Code installation client via SSH to a VS Code server running in one of the access nodes, or by running it directly on your browser through our web portal.

There is a separate section on using Python virtual environments: Using Python modules in VScode

Using the web portal

The simplest and most straightforward way of using VS Code on Hábrók is by using our web portal. Simply login with your university account and open the VS Code Server Interactive App by navigating in the top bar to Interactive Apps → VS Code Server or by clicking the shortcut in the main page after logging in. From the VS Code Server page, you can queue a job with the necessary memory and CPU requirements for your use case and the root directory for your VS Code session. After that, simply launch the job and wait for a while until your job begins, often this takes only just a moment.

As soon as the job has started and is ready, you should see a blue button to Connect to VS Code. This will automatically start up your VS Code session in the compute node your job is running.

If you are using VS Code to program in Python, you should take a look at the Using Python modules in VScode documentation page to be setup your environment.

Connecting with VS Code via SSH

Connecting via SSH requires the setup below, which involves a number of steps. If you simply mean to quickly edit a script or do basic software development, then the web portal method described above will likely provide a much more streamlined user experience. If you require advanced features provided by the local Visual Studio Code installation on your PC, or want to frequently execute your code on local files, then the setting up the SSH connection may be worthwhile.

If you'd like to run the VS Code client natively in your desktop, you can also do so by setting up a Remote-SSH connection. This takes some additional setup when compared with the connection via the web portal.

Connecting with VS Code via SSH to an access node

Connecting with VS Code via SSH to a compute node

In addition to connecting to one of the login or interactive nodes, you may choose to connect directly to a compute node in order to have a similar environment and restrictions as you have for your compute jobs. You could even use a debugger to interactively debug your program in an identical environment as those your jobs run in. To do so, you should follow the same instructions as above, but there are a few extra steps and details to take into account:

#!/bin/bash
#SBATCH --time=00:30:00
#SBATCH --partition=regular
#SBATCH --nodes=1
#SBATCH --cpus-per-task=4
#SBATCH --mem=8GB
 
sleep 1800

Visual Studio Code, VS Code, and the Visual Studio Code icon are trademarks of Microsoft Corporation. All rights reserved.