Key Points
Why VS Code Remote?
- VS Code Remote-SSH provides a full IDE experience for remote HPC development
- It combines VS Code’s features with direct access to your cluster files
- VS Code is recommended for serious code development; command-line editors are better for quick edits
- The Remote-SSH extension creates a seamless local-to-remote development workflow
Installing VS Code
- Install VS Code from code.visualstudio.com for your operating system
- Install the Remote-SSH extension by Microsoft from the Extensions sidebar
- Enable
remote.SSH.showLoginTerminalin settings – this is required for DUO
Setting Up SSH Config
- Configure ~/.ssh/config with a
Host sagehenentry and your Pomona username - Set proper file permissions (600 for config, 700 for .ssh directory)
- SSH keys (Ed25519 recommended) are optional but convenient for frequent users
- Always test
ssh sagehenfrom a terminal before using VS Code Remote-SSH
Connecting to Sagehen HPC
- Use Remote Explorer to connect to Sagehen and select Linux as the platform
-
remote.SSH.showLoginTerminalmust be enabled for DUO prompts to appear - After connecting, open
/rhome/<myusername>to browse your remote files - VS Code automatically attempts reconnection after network interruptions
- Disconnect via the SSH status button when finished
File Editing Basics
- Use the Explorer sidebar or Quick Open (Ctrl+P) to navigate remote files
- Create files with right-click > New File or keyboard shortcuts
- VS Code provides syntax highlighting and IntelliSense automatically
- Save with Ctrl+S; files save to Sagehen, not your local machine
- Drag files from your computer into the Explorer sidebar to upload them
Multi-File Editing
- Open files appear as tabs; use Ctrl+Tab to switch between them
- Split editor (Ctrl+\) enables side-by-side editing of two or more files
- Ctrl+F searches the current file; Ctrl+Shift+F searches across all files
- Compare files with right-click > Compare to see color-coded differences
- Manage folders and files directly from the Explorer sidebar
Integrated Terminal
- The integrated terminal (Ctrl+`) runs on Sagehen, not your local machine
- The login node is for editing and submission only; use srun for interactive compute
- Use sbatch to submit jobs and squeue to check status from the terminal
- Multiple terminal tabs let you edit, submit, and monitor simultaneously
- Custom terminal profiles can auto-load conda envs or request interactive compute nodes
- Use
tmuxto keep interactive sessions alive across VS Code disconnects -
seff JOBIDafter job completion reveals over-provisioned resources - The edit-submit-monitor workflow makes VS Code ideal for iterative HPC work
Running and Debugging Code
- Run quick tests directly in the terminal; submit longer jobs through SLURM
- Use
srunfor interactive GPU sessions for prototyping - tmux sessions persist through disconnections – ideal for long-running monitoring
- VS Code’s debugger works remotely through Remote-SSH with language extensions
- The edit-test-submit cycle is the core HPC development workflow
Extensions for HPC
- Remote extensions run on Sagehen for language support; local extensions handle UI
- Install Python, R, and Jupyter on the remote side for full language features
- Extensions persist on Sagehen between sessions
- Keep 5-10 extensions active to maintain VS Code performance
Customization and Tips
- Customize themes with Ctrl+K Ctrl+T; customize shortcuts with Ctrl+K Ctrl+S
- Workspace settings in
.vscode/settings.jsonapply per-project and can be version-controlled - Settings Sync keeps your VS Code identical across multiple machines
- Recommended HPC settings include format-on-save, trailing whitespace trimming, and increased terminal scrollback