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.

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.

Connecting with VS Code via SSH

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

  1. If you haven't already you will need to install the Remote-SSH extension for VS Code: Remote-SSH
  2. Open the Settings UI press Ctrl+P or Command+P if on macOS and write “Settings” to go to the Settings page.
  3. On the Settings page, search for remote.SSH.showLoginTerminal. Enable this setting so that you can fill in the two factor authentication code on the console later.
  4. Press Ctrl+Shift+P and write: Connect to Host
  5. You can then fill in the ssh command. Let's say you want to connect to interactive1.hb.hpc.rug.nl, then you would write pNUMBER@interactive1.hb.hpc.rug.nl
  6. You will see a new window appear with a drop-down menu asking which platform type you are connecting to. Choose “Linux”.
  7. At the bottom of that window, a console will appear and show you the same prompt when you first connected to Hábrók, if you want to accept the host key. Write 'yes' and press Enter.
  8. On the same console you will see a prompt for your password and then for the authenticator code. Fill those in as you normally would.
  9. You are now connected! You can use the terminal on Hábrók as you would when connecting via 'ssh' through your computer's terminal. You will see a pop-up informing you that the platform type 'linux' was stored in the settings. You don't need to take any action about this.
  10. To use the file explorer press the files icon on the left hand side and then press on “Open Folder”. A drop-down menu will appear at the top and will have the path to your home directory already filled in. Press Enter.
  11. You will possibly see a large pop-up asking if you accept the the authors of files in the folder, as usually happens when you open a new folder on VS Code. You should press “Yes, I trust the authors”.

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.