Search open search form

VSCode

Connecting to Login/Interactive nodes to edit files directly in VSCode. 

Be sure your version of VSCODE is up-to-date before continuing then follow the bullets below. Note these commands are for mac/linux, Windows users should adapt as needed.

  • Create an SSH config entry for the cluster in ~/.ssh/config . If the ssh folder does not exists on your machine create on with 'mkdir ~/.ssh & touch ~/.ssh/config & chmod 700 ~/.ssh & chmod 600 ~/.ssh/config.
  • Add something like the following to your ~/.ssh/config, substituting your username and save. (The control path entry allows vscode to reuse the existing SSH connection to the cluster)
Host hpc
Hostname login.hpc.caltech.edu
User yourusername
ControlMaster auto
ControlPath ~/.ssh/control:%h:%p:%r
  • First test that the above entry works by opening a terminal and running 'ssh hpc'. If things look OK proceed. 
  • Launch VSCode, navigate to extensions. Search for and install the "remote-ssh" extension provided by Microsoft.
  • Launch the command palette (Shift Command P or F1) and enter "remote-ssh" to show available options. Selecting "Connect to Host" should now show you a list of entries available in ~/.ssh/config. 
  • Select the "HPC" entry, it should now prompt for both the password and Duo multifactor authentication. 
  • Upon first connection, it will install a small vscode server into your home directory. If you do no have enough space the installation will fail at which point you'll need to clean up additional space in your cluster home dir. 

Direct connection to compute nodes (not login/interactive nodes) via SSH/VSCode

The following script and its features are not support by IMSS staff. Most users will probably intend to login into an interactive node as shown in the example above.  The following contributed scripts allow one to ssh into a cluster compute node after allocating one via slurm. This is useful for connecting VSCode directly to a compute resource without having to manually shell into the login nodes first. 

https://gist.github.com/haakon-e/e444972b99a5cd885ef6b29c86cb388e

Remote VSCode Troubleshooting

1. If you receive a message 'The terminal process failed to launch: A native exception occurred during launch (forkpty) 

Try renaming ~/.vscode-server/ to ~/.vscode-server-backup on the cluster side and attempt a new vscode connection.