VS Code on HPC Head Node
VS Code is recommended for viewing and editing text files on the HPC. It connects to the cluster using the Remote-SSH extension, allowing you to edit files and manage your projects directly on the login node.
For interactive computing and data analysis, use JupyterLab or RStudio Server instead. These run on compute nodes with dedicated resources.
Installation
- Download and install VS Code on your local machine
- Follow the introductory tutorials on the VS Code website to familiarize yourself with the interface
Recommended Extensions
Install these extensions from the VS Code marketplace (Ctrl+Shift+X or Cmd+Shift+X):
| Extension | Purpose |
|---|---|
| Remote - SSH | Connect to HPC cluster |
| Jupyter | Run Jupyter notebooks |
| Python | Python language support |
| R | R language support |
| Markdown All in One | Markdown editing |
| Prettier - Code formatter | Code formatting |
| Rainbow CSV | CSV file viewing |
Performance tip: Extensions can slow down VS Code startup. Periodically review installed extensions and remove unused ones. Check extension load times in the “LOCAL-INSTALLED” settings.
Connect to HPC via Remote-SSH
Configure SSH Connection
- Open VS Code and press
Ctrl+Shift+P(orCmd+Shift+Pon Mac) - Type “Remote-SSH: Open SSH Configuration File” and select it
- Add an entry for the HPC cluster:
Host hpc
HostName <hpc_ip>
User <username>
Replace <hpc_ip> and <username> with your actual HPC IP address and username from the internal documentation.
Connect to HPC
- Press
Ctrl+Shift+Pand type “Remote-SSH: Connect to Host” - Select your HPC entry
- Enter your password when prompted
- Wait for the connection to establish
The status bar at the bottom of VS Code shows your connection status.
Browse Remote Files
After connecting:
- Use “Remote Explorer” in the sidebar to browse files on the HPC
- Open folders with File > Open Folder
- Edit files directly on the remote system
Jupyter Notebooks in VS Code
VS Code provides excellent Jupyter notebook support when connected to the HPC.
Setup
- Ensure you have the Jupyter and Python extensions installed
- After connecting to HPC via Remote-SSH, install extensions again on the remote server when prompted
- For R notebooks, also install the R extension
Kernel Selection
When you open a notebook (.ipynb file):
- Click “Select Kernel” in the top-right corner of the notebook
- Choose a kernel from your pixi environment (
~/.pixi) - Prefer pixi kernels over system-provided kernels marked “Global”
R Language Support
For R language server support in VS Code, install the language server:
pixi global install --environment r-base r-languageserver
This enables features like autocomplete, go-to-definition, and inline documentation for R code.
Usage Tips
Once connected, you can:
- Browse and edit files on the HPC
- Open an integrated terminal (
Ctrl+``) - Run Python/R scripts
- Work with Jupyter notebooks
- Use Git for version control
Important Limitations: Login Node Only
VS Code connects to the login node only. The login node is shared with other users and has limited resources.
Do not run computationally intensive tasks directly in VS Code. Instead, submit jobs to the cluster using SLURM. See SLURM Quick Start or use VS Code on Compute Nodes, or JupyterLab on a compute node instead.