Visual Studio Code
Visual Studio Code (VSCode) is a popular code integrated development environment. CHPC provides several ways to launch it directly on our systems. We list these alternatives below. Apart from that, many users install it on their local machines and set it up to remotely access CHPC machines. Below we describe how to do that while avoiding getting the interactive node abuse e-mails.
Remote development/computing with VSCode
Open OnDemand VSCode Server
VSCode Desktop in FastX or Open OnDemand
Remote development/computing with VSCode
Locally installed VSCode has the option to remotely connect to other machines, which makes it a natural choice for connection to CHPC via SSH. The problem is that by default users SSH to the interactive nodes, which means the VSCode remote server runs on the interactive node, putting load on it, and occasionally resulting in abuse warnings from CHPC's Arbiter interactive node monitoring.
The way around this is to set up a remote SSH connection to a SLURM job running on a compute node. Below are the steps to do that.
Initial setup steps 1 and 2 only need to be done once.
To start remote connection, steps 3-9 need to be repeated every time a new remote session is established.
1. Modify ~/.ssh/config
on your client (on Windows C:/User/username/.ssh/config
.
For notchpeak:
Host !notchpeak* notch*
ProxyJump uNID@notchpeak1.chpc.utah.edu
User uNID
Host notch###
Hostname notch###
For kingspeak:
Host !kingspeak* kp*
ProxyJump uNID@kingspeak1.chpc.utah.edu
User uNID
Host kp###
Hostname kp###
uNID being your University ID, in form of u0123456. ### is the host name returned in step 4 below, e.g. notch001. For other clusters, such as Lonepeak, use lonepeak instead of kingspeak, and lp instead of kp.
2. On Notchpeak interactive node create a SLURM script called tunnel.slr
which contains:
#!/bin/bash
#SBATCH --job-name="tunnel"
#SBATCH --time=4:00:00 # walltime
#SBATCH --cpus-per-task=2 # number of cores
#SBATCH --mem-per-cpu=8G # memory per CPU core
#SBATCH --partition=notchpeak-shared-short
#SBATCH --account=notchpeak-shared-short
# Set job comment to BatchHost
scontrol update JobId="$SLURM_JOB_ID" Comment="`hostname -s`"
# Sleep. This holds the job in running state, the user has to scancel their job if they are done early.
sleep 4h
NOTE - change the walltime and sleep if you want longer session than 4 hours, and also account and partition if needed.
The SBATCH options can be different if you want to use other account/partition, e.g.
owner nodes, and can be on different clusters (which necessitates having that cluster
also listed in the local ~/.ssh/config
, in step 1). When choosing account/partition, ensure that the job starts before doing
the remote SSH (step 5). For that reason the general partitions are not the best choice
as they tend to be oversubscribed, and as such jobs on them often don't start right
away. Also use the shared equivalent of the partition to only use a portion of the node - unless you plan to
run heavy computation in the VSCode you will likely not need the whole node.
3. Submit this interactive job in an interactive node terminal:
sbatch tunnel.slr
4. Run squeue command on the same cluster where you submitted the job to check what node it runs on:
squeue --me --name=tunnel --states=R -h -O Comment
5. In the VSCode on the client, click to Open a Remote Window (lower left corner), then choose "Connect to Host ... Remote SSH".
6. If the node name listed in step 4 is not in the list, go to VS Code Remote explorer
of the Remote – SSH. At the top, next to REMOTES (TUNNELS/SSH), click on the reload button and update the changes in ~/.ssh/config
. Then, in the lower left corner of the VSCode window, click and then choose Connect to Host… and select the node with the running session.
If the node name is already on the list, select it.
7. Enter your password twice when prompted, one for the notchpeak interactive node and the other for the compute node.
8. If running for the first time VSCode will install the remote server pieces and then get connected, on subsequent connections it connects right away.
9. If you are done with your VSCode session, make sure to scancel the job to free up the resources.
Installing GitHub Copilot
1. In the remote VSCode window, select Extensions, find the GitHub Copilot and choose to install it on XXX node.
2. You may be already signed in from the local session, if not, click sign to GitHub, and follow instructions to sign in.
Open OnDemand VSCode Server
In the Open OnDemand, there is a VSCode Server app, which launches the VSCode in a server mode inside of an interactive job. Follow the intuitive Open OnDemand interactive app instructions to start the job. The disadvantage of the VSCode Server is that it does not allow authentication under a different identity (e.g. GitHub for the Copilot).
VSCode Desktop in FastX or Open OnDemand
To be able to authenticate under a different identity, we also offer the VSCode Desktop
application, which is available under the vscode
module, and as an Open OnDemand VSCode Desktop app.
Installing GitHub Copilot
GitHub needs web browser for authentication. Because the default Firefox browser on the interactive and compute nodes is very slow, we recommend to switch to Google Chrome first (you need to do the steps 1-3 below only once).
1. Open a FastX XFCE remote desktop or OnDemand Interactive Desktop session
2. Change the default browser from Firefox to Chrome
- Select upper left corner menu Applications - Settings - Default Applications
- Replace Mozilla Firefox with Google Chrome under the Web Browser pull-down
3. On the interactive node, start VSCode client, or RStudio Desktop, enable GitHub
Copilot and sign into GitHub
Below are the steps how to authenticate to GitHub with the Open OnDemand VSCode Desktop app. It will be the same if you load the module and start the program from the terminal.
1. Start the VSCode Desktop Open OnDemand job
2. Find and install the GitHub Copilot extension
3. Click on the User symbol in the lower left corner and choose Sign in GitHub to use GitHub Copilot.
4. A Chrome browser window will appear with a dialog window talking about XDG, approve
that and a Failed to open URI window will show. Click Close on the window, and close Chrome - this authentication
way does not work because of a missing browser plugin in our OS installation
5. Click Cancel in the VSCode Github authentication window, it will offer to try a different way. Click Yes to that.
6. After some time another browser window pops up saying You are signed in. Close the browser, VSCode should be signed to GitHub and Copilot should be available.