VS Code is an IDE that while not provided on the clusters, many users use on their own machines and connect into the clusters with.
Visual Studio Code (VS Code) and the completely free software version VSCodium (relationship is like Chromium to Chrome) are a commonly used IDEs that many users use on their own machines for development and are capable of SSH-ing into other machines for remote operation, editing, and debugging. While neither are provided on the clusters, many users edit files, run their codes, and debug their codes on the clusters via VS Code or VSCodium run on their own machines. This page is here to point out how to do certain things and avoid certain pitfalls.
None. Users run it on their own machines.
Connecting to Singularity/Apptainer Containers
The following contains a guide how to actively develop in a Singularity/Apptainer container. See Singularity for more information on the
singularity module. Both Singularity and Apptainer are largely compatible with each other, and in fact you run the container with the
singularity command regardless of which module you use.
This guide was contributed by our GPU users Anwai Archit and Arne Nix who kindly provided this documentation. It is lightly edited to fit the format of this page and fix a few typos. Any place you see "singularity", you could replace it with "apptainer" if you use the
apptainer module instead. It was written for the Grete GPU nodes of Emmy, but can be easily translated to other partitions/clusters (see GPU Usage for more information). Obviously, rename any directories and files as makes sense for your user name, the SIF container file you use, and the names of your files and directories.
Starting a Singularity Container
First we need to setup a singularity container and submit it to run on a GPU node. For me this is done by the following SBATCH script:
Important here are four things:
- We need to load
singularityto have it available to our container.
- We need to bind
$HOME/.vscode-serverto the same place in the container.
- We need to remember the name of our container. In this case:
- We need to keep the script running in order to not loose the node. This is achieved by
SSH Config to Connect to the Container
We want to connect to the container via ssh. For this, setup the following configuartion in
~/.ssh/config on your local machine.
This enables three different connections from your local machine:
- Connection to the login node:
- Connection to a compute node that we obtained through the scheduler, e.g.
- Connection to the singularity container running on a compute node, e.g.
Connecting VS-Code to the Container
This follows mostly the tutorial here. Then add the following lines:
Now remote connections should be possible. Before we can connect to the individual cluster nodes, we first need to initialize the
vscode-server on the login nodes. For this we press Ctrl+Shift+P, enter Remote-SSH: Connect to Host and select
hlrn . This should (after typing in the password of your private key) connect our VS-Code to the login node. At the same time the
vscode-server is installed in your home directory on the cluster. Additionally, you should go into the extensions and install all extensions (e.g. python) that you need on the cluster. These two steps cannot be done on the compute nodes, so it is important to do it on the login node beforehand. Finally, we can close the connection to the login node and now connect to the compute node that we have the singularity container running on. This works in the same way as the connection to the login node, but instead of
hlrn , we select