Remote Development on OSC¶
Visual Studio Code's Remote-SSH extension allows you to develop on OSC as if you were working locally. This guide shows you how to set it up and use it effectively.
Prerequisites¶
Initial Setup¶
Make sure the Remote-SSH extension is installed and your SSH config is set up.
Connecting to OSC¶
Method 1: Command Palette¶
- Press
Ctrl+Shift+P(orCmd+Shift+Pon macOS) - Type "Remote-SSH: Connect to Host"
- Select
pitzer(orowens) from your SSH config - A new VS Code window opens connected to OSC
Method 2: Remote Explorer¶
- Click the Remote Explorer icon in the sidebar (><)
- Select "SSH Targets" from dropdown
- Click the connect icon next to
pitzer
Method 3: Command Line¶
First Connection¶
On your first connection: 1. VS Code downloads the VS Code Server to OSC 2. This takes 1-2 minutes 3. A progress notification appears in the bottom-right 4. Future connections are much faster
Installing Extensions Remotely¶
Extensions you use locally should also be installed on the remote server. Open the Extensions view (Ctrl+Shift+X) and click "Install in SSH: pitzer" for each extension you need. For recommended extensions, see VS Code Extensions.
File Transfer¶
VS Code supports drag-and-drop uploads and right-click downloads for small files. For bulk transfers, see the File Transfer Guide.
Port Forwarding¶
Access web services running on OSC (Jupyter, TensorBoard, etc.):
Automatic Port Forwarding¶
VS Code automatically detects and forwards ports:
- Start a service on OSC (e.g., Jupyter on port 8888)
- VS Code detects it and shows a notification
- Click "Open in Browser"
Manual Port Forwarding¶
- Click "PORTS" tab in bottom panel (next to Terminal)
- Click "Forward a Port"
- Enter port number (e.g., 8888)
- Access at
http://localhost:8888
Example: Jupyter Notebook¶
VS Code forwards port 8888 automatically. Click the link or open localhost:8888 in your browser.
Running Code¶
Python Scripts¶
Method 1: Terminal¶
Method 2: Run Button¶
- Open a Python file
- Click the "Run" button (▶️) in the top-right
- Or press
Ctrl+Alt+N(if Code Runner extension installed)
Jupyter Notebooks¶
- Open
.ipynbfile in VS Code - Select Python kernel (from OSC)
- Run cells with
Shift+Enter
All execution happens on OSC!
Debugging¶
Set breakpoints and debug remotely:
- Set breakpoints by clicking left of line numbers
- Press
F5to start debugging - Use Debug Console to inspect variables
- All debugging runs on OSC
Best Practices¶
1. Use Login Nodes Appropriately¶
Login nodes (where Remote-SSH connects) are shared among all users. They are fine for:
- Editing code, browsing files, git operations
- Submitting jobs (
sbatch,sinteractive) - AI coding tools (Claude Code, Copilot) — these are network-bound, not CPU-bound
- Quick
pip installoruv add
DO NOT run intensive computations on login nodes: long-running scripts, large builds, pytest on big test suites, or anything GPU-related.
2. Use Compute Nodes for Heavy Work¶
Use sinteractive to get your own compute node from the VS Code terminal:
# CPU-only (for builds, tests, preprocessing)
sinteractive -A PAS1234 -c 4 -t 02:00:00
# With GPU (for training, debugging GPU code)
sinteractive -A PAS1234 -c 4 -g 1 -t 01:00:00
Your home directory is the same NFS mount on both login and compute nodes — same files, same paths. No need to copy anything. When done, type exit to release the node.
For longer unattended runs, use batch jobs:
For full details, see the Interactive Sessions section of the Job Submission Guide.
3. Save Regularly¶
Although Remote-SSH is reliable: - Enable auto-save: "files.autoSave": "afterDelay" - Commit to Git frequently - Keep backups of important work
4. Manage Extensions¶
- Only install necessary extensions remotely
- Some extensions can slow down remote connections
- Disable unused extensions
5. Handle Disconnections Gracefully¶
If connection drops: - VS Code tries to reconnect automatically - Unsaved changes are usually preserved - Terminal sessions may be lost (use tmux or screen for persistence)
Advanced Tips¶
Using tmux for Persistent Sessions¶
This keeps your session alive even if VS Code disconnects.
Workspace Settings for Remote
Create .vscode/settings.json in your project:
{
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python3",
"python.terminal.activateEnvironment": true,
"terminal.integrated.env.linux": {
"PATH": "${workspaceFolder}/.venv/bin:${env:PATH}"
}
}
If using legacy pip+venv with ~/venvs/, replace .venv paths with ${HOME}/venvs/myproject.
SSH Config for Multiple Login Nodes¶
# Primary login
Host pitzer
HostName pitzer.osc.edu
User your.osuusername
# Specific login node (if needed)
Host pitzer01
HostName pitzer-login01.osc.edu
User your.osuusername
Troubleshooting¶
Connection Hangs¶
Problem: "Setting up SSH Host..." hangs indefinitely
Solutions: 1. Check OSC system status 2. Verify SSH connection works: ssh pitzer 3. Delete remote VS Code server:
Extension Installation Fails¶
Problem: Extensions won't install on remote
Solutions: 1. Check disk quota: quota -s on OSC 2. Clear extension cache:
Python Interpreter Not Found¶
Problem: VS Code can't find Python
Solutions: 1. Load Python module in terminal:
2. Set interpreter in VS Code: -Ctrl+Shift+P → "Python: Select Interpreter" - Enter the path from which python3 Terminal Not Loading¶
Problem: Integrated terminal fails to start
Solutions: 1. Check your shell configuration (~/.bashrc) 2. Simplify .bashrc (remove complex startup scripts) 3. Try setting the default profile: "terminal.integrated.defaultProfile.linux": "bash"
Port Forwarding Not Working¶
Problem: Can't access forwarded ports
Solutions: 1. Verify service is running: netstat -tuln | grep <port> 2. Manually add port in VS Code Ports panel 3. Check firewall settings on OSC
Performance Tuning
Reduce remote extension count — install only essentials remotely:
- ms-python.python
- ms-python.vscode-pylance
- ms-toolsai.jupyter
Exclude large directories from the file watcher in .vscode/settings.json:
Next Steps¶
- Set up PyTorch on OSC
- Explore Job Submission Guide
- Read ML Project Template