There are three ways to use VSCode on Wharton’s HPC3 systems:
- RECOMMENDED :: Local VSCode Using HPC3 Compute Server via Tunnel
- On the HPC3 Desktop running VSCode on a compute server
- On the HPC3 Desktop as an editor only
On the HPC3 Login Server as an editor only(please do not do this. All VSCode processes on the HPC3 Login Server will be terminated)
All of these options are valid, and each has pluses and minuses. Please never run code on the HPC3 Desktop, as it is not designed for doing work, only to facilitate work on compute servers.
RECOMMENDED! Local VSCode Using HPC3 Compute Server via Tunnel
To be able to use VSCode locally (on your laptop or desktop) and run code remotely on an HPC3 compute server, use the VSCode Remote Tunnels Extension. Continue reading below for instructions for use on the Wharton HPC3 cluster!
Start a VSCode Tunnel to Microsoft or GitHub on HPC3
- Connect to the Wharton or Penn VPN
- In your SSH client, connect to the Wharton HPC3 login server, then:
qlogin # <- other options as needed
# if needed, switch to project directory, load Python version and GCC and virtual environment (next 4 lines)
cd project/my_project_path
module load python/3.12.3
module load gcc/12.2.0
source venv3123/bin/activate
# initialize vscode
module load vscode
# set provider to microsoft if desired (default is GitHub) ... microsoft using @upenn.edu account
code tunnel user login --provider microsoft
# start vscode tunnel
code tunnel --name whartonhpc3-compute
*
* Visual Studio Code Server
*
* By using the software, you agree to
* the Visual Studio Code Server License Terms (https://aka.ms/vscode-server-license) and
* the Microsoft Privacy Statement (https://privacy.microsoft.com/en-US/privacystatement).
*
[2024-08-21 10:58:51] info Using GitHub for authentication, run `code tunnel user login --provider <provider>` option to change this.
To grant access to the server, please log into https://github.com/login/device and use code 2630-B3CA
[2024-08-23 10:58:05] info Creating tunnel with the name: whartonhpc3
[2024-08-23 10:58:05] info Adopting existing tunnel (ID=ID { cluster: "use", id: "tidy-river-0sjvzmr" })
Open this link in your browser https://vscode.dev/tunnel/whartonhpc3-compute/home/mnt/weka/hughmac
NOTE: while you can click on the link in that output, and use the browser-based VSCode, we recommend instead that you connect your laptop / desktop VSCode following the instructions in the section below.
Set Up Local VSCode
- Start Local VSCode normally
- Install VSCode Remote Tunnels extension from https://marketplace.visualstudio.com/items?itemName=ms-vscode.remote-server
- You’ll be prompted to log into Microsoft or GitHub, and enter the code from your HPC3
qlogin
session (mine is2630-B3CA
, above) - After authentication with Microsoft or GitHub, you will get a list of available tunnels to connect to
- More details at https://marketplace.visualstudio.com/items?itemName=ms-vscode.remote-server
NOTES:
- If you use 2FA (recommended!) for your GitHub or Microsoft accounts, the code in
code tunnel
is not the 2FA key. That will be in your 2FA app on your phone. Basically: authenticate normally to GitHub and then it will ask for thecode tunnel
code
HPC3 Desktop VSCode on Compute
To use VSCode on the cluster graphically as an editor with the ability to run code:
- Connect to the Desktop at https://hpc3-desktop.wharton.upenn.edu/
- From the top menu bar, click on the Terminal icon to open a terminal
qlogin
# if needed, switch to project directory, load Python version and GCC and virtual environment (next 4 lines)
cd project/my_project_path
module load python/3.12.3
module load gcc/12.2.0
source venv3123/bin/activate
# initialize vscode
module load vscode
# start vscode
code
HPC3 Desktop VSCode Editor
To use VSCode on the cluster graphically as an editor on the HPC3 Desktop:
- Connect to the Desktop at https://hpc3-desktop.wharton.upenn.edu/
- Navigate to to Applications menu > Programming > Visual Studio Code
A reminder to only use this as an editor, do not run code.
HPC3 Login Server VSCode Editor (DO NOT DO THIS!)
While it’s possible to start VSCode on the HPC3 Login Server using the VSCode SSH-Remote extension, please don’t try: we will very quickly terminate your sessions and lock your account.
Troubleshooting
If you’re having troubles starting a Terminal or anything else, you should stop VSCode, and in your home directory:
cd ~ rm -rf .vscode* rm -rf .config/Code/ rm -rf .cache/Microsoft/DeveloperTools/deviceid