Running Visual Studio (VS) Code on Slurm Compute Nodes via VS Code Tunnel
- 1 Overview
- 2 Step 1. Request an Interactive Slurm job
- 3 Step 2. Download the Standalone VS Code CLI (One-Time Setup)
- 4 Step 3. Start a VS Code Tunnel
- 5 Step 4. Authenticate
- 6 Step 5. Tunnel Starts
- 7 Step 6: Connect VS Code
- 8 Step 7. Open a Terminal
- 9 Step 8. Navigate to Your Project
- 10 Step 9. Open a Different Folder
- 11 Step 10. Verify You're on the Compute Node
Overview
This workflow allows users to run VS Code entirely on a Slurm-allocated compute node, instead of running the VS Code Server on the login node.
Architecture:
Windows/Linux/macOS Laptop
(VS Code Desktop or vscode.dev)
│
HTTPS (TLS)
│
Microsoft VS Code Tunnel Service
│
Slurm Compute Node (Allocated Job)
-------------------------------------------
VS Code CLI
VS Code Server
Extension Host
Integrated Terminal
Python / C++ / Git / DebuggerAdvantages:
VS Code Server runs on the compute node.
No
.vscode-serverprocesses run on the login node.CPU and memory usage are charged to the Slurm job.
Users still get IntelliSense, Git, debugging, terminals, extensions, and AI assistants.
Step 1. Request an Interactive Slurm job
Request an interactive compute node from Slurm.
HPC Cluster:
srun \
--partition=batch \
--nodes=1 \
--time=04:00:00 \
--cpus-per-task=4 \
--mem=4G \
--propagate=NONE \
--pty bash -lNote: Please adjust the time, CPU count and memory allocation as needed.
DGX Cluster:
Request an interactive GPU node from Slurm.
srun \
--propagate=NONE \
--gres=gpu:1 \
--cpus-per-task=4 \
--time=04:00:00 \
--mem=80G \
--pty $SHELL -iPlease adjust the job runtime, CPU count, GPU count, and memory allocation as needed. The maximum job runtime on the DGX cluster is 7 days (168 hours), and the maximum number of GPUs that can be requested per job is 8.
Verify that you're on a compute node
Run:
hostname
echo $SLURM_JOB_IDExample output:
uagc25-02
349876If a compute node hostname and a valid Slurm job ID are displayed, the interactive job has started successfully.
Step 2. Download the Standalone VS Code CLI (One-Time Setup)
Create a directory for the CLI.
mkdir -p /network/rit/lab/<your lab folder>/software/vscode-cli
cd /network/rit/lab/<your lab folder>/software/vscode-cliDownload the standalone CLI.
curl -L \
'https://code.visualstudio.com/sha/download?build=stable&os=cli-alpine-x64' \
--output vscode_cli.tar.gzExtract it.
tar -xf vscode_cli.tar.gzVerify installation.
./code --versionStep 3. Start a VS Code Tunnel
Run
./code tunnel --accept-server-license-termsThe CLI will ask:
How would you like to log in?
Microsoft Account
GitHub AccountUse up-down arrow to choose. Here, for example:
GitHubStep 4. Authenticate
Open the URL displayed by the CLI, for example
https://github.com/login/deviceComplete GitHub authentication.
After authentication, the CLI asks for a tunnel name.
Example:
What would you like to call this machine?
vscode-slurmYou could input any name you like but machine names must be 20 characters or fewer.
Step 5. Tunnel Starts
The CLI prints something similar to
Visual Studio Code Tunnel
Tunnel:
vscode-slurm
Open:
https://vscode.dev/tunnel/vscode-slurm/...Keep this process running.
Do not close the Slurm job or press Ctrl+C.
Step 6: Connect VS Code
There are two different connections. One is the VS Code Web, the other is the VS Code Desktop.
Step 6A. Connect Using VS Code Web
Open the URL printed by the CLI in your browser.
Example:
https://vscode.dev/tunnel/vscode-slurm/...The browser asks
What type of account did you use to start this tunnel?Choose
GitHubSign in with the same GitHub account used when creating the tunnel.
After authentication, the VS Code Web interface opens and connects directly to the compute node.
Step 6B. Connect Using VS Code Desktop (Recommended)
Step 1. Install the Remote - Tunnels Extension
Open Extensions (Ctrl+Shift+X).
Search for
Remote - TunnelsInstall the extension.
Step 2. Sign in to GitHub
If VS Code is not already signed in, click the Accounts icon (bottom-left corner).
Select:
Sign in to use GitHub Copilot...Although it mentions Copilot, this signs VS Code into your GitHub account, which is also used by the Remote - Tunnels extension.
Important: Use the same GitHub account that was used to run
code tunnelon the compute node.
After signing in, restart VS Code Desktop if necessary.
Step 3. Connect to the Tunnel
Press
Ctrl+Shift+PSearch for:
Remote Tunnelsor
Connect to TunnelYou should see the tunnel you created:
vscode-slurmSelect it.
VS Code Desktop will connect directly to the compute node.
Step 7. Open a Terminal
In either VS Code Web or Desktop:
Terminal
→ New Terminalor press
Ctrl + Shift + `The terminal opens on the compute node.
Example prompt:
(base) bash-5.1$Step 8. Navigate to Your Project
The terminal behaves like any Linux terminal.
Examples:
pwd
ls
cd ..
cd ~/projectStep 9. Open a Different Folder
The Explorer does not automatically follow the terminal.
To change the workspace:
File
→ Open Folder...or
Ctrl+Shift+P
File: Open Folder...Choose your project directory, for example
/network/rit/lab/<your lab folder>/head01The Explorer will now show the selected project.
Step 10. Verify You're on the Compute Node
Run
hostname
echo $SLURM_JOB_ID
pwdYou should see
uagc25-02
349876
/network/rit/lab/<your lab folder>/openclaw_testconfirming that the terminal is executing on the Slurm compute node.