VSCode

There are a number of ways to use VSCode on Wharton’s HPC3 systems:

  • On the HPC3 Desktop as an editor only
  • On the HPC3 Desktop running VSCode on a compute server
  • On the HPC3 Login Server as an editor only
  • On your local computer, and connecting to a VSCode Kernel on a compute node (edit locally, run on compute)

All of these options are valid, and each has pluses and minuses. Please never run code on the HPC3 Desktop or HPC3 Login server, as they are not designed for doing work, only to facilitate work on compute servers.

HPC3 Desktop VSCode Editor

To use VSCode on the cluster graphically as an editor on the HPC3 Desktop:

A reminder to only use this as an editor, do not run code.

HPC3 Desktop VSCode on Compute

To use VSCode on the cluster graphically as an editor with the ability to run code:

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 Login Server VSCode Editor (not recommended!)

While we don’t recommend it, you can use VSCode on the HPC3 Login Server as an editor using the VSCode Remote – SSH Extension. Details on the Remote – SSH Extension page: https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh

Local VSCode Using HPC3 Compute Server Kernel

To be able to use VSCode locally (on your laptop or desktop) and run code remotely on the HPC3 server, use VSCode Remote Tunnels Extension.

Start a VSCode Tunnel to 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

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 the code tunnel code

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