Skip to content

Visual Studio Code

A widely available and versatile code editor that supports remote development via SSH.


Options#

There are two ways to use VS Code on the FSU HPC:

  • Install and use VS Code in the RCC Desktop interactive app in our Open OnDemand portal.
  • Run VS Code on your local workstation and connect to an HPC compute node through an SSH tunnel.

VS Code in Open OnDemand#

This method is the simpler of the two options for VS Code, but does require some initial setup.

  1. Follow the instructions for launching an interactive app in Open OnDemand.
    • Select the RCC Desktop app.
    • Important: Ensure that the Internet Access via Web Proxy checkbox is selected.
  2. Install VS Code (first time only)
    1. Open the web browser from the Applications menu or the quick access toolbar at the bottom of the screen (the globe icon)
    2. Go to https://code.visualstudio.com/Download and select the .tar.gz x64 option. Select the ".tar.gz: x64" download option on the Download Visual Studio Code webpage
    3. Open the terminal app from the Applications menu or the quick-access toolbar at the bottom of the screen (the black icon)
    4. Run the following commands in the terminal:
      1
      2
      3
      4
      5
      6
      7
      8
      9
      # Move into your 'Downloads' folder
      $ cd ~/Downloads
      
      # Show a directory listing of files in the 'Downloads' folder
      $ ls .
      code-stable-x64-1781225422.tar.gz
      
      # Uncompress the downloaded file. Replace ########## with the number shown in the ls command output. 
      $ tar -xzf code-stable-x64-##########.tar.gz
      
  3. Launch VS Code
    1. From the Applications menu in the upper-left corner of the screen, select Run program...
    2. Enter ~/Downloads/VS Code-linux-x64/bin/code and click "Launch".

Tip

You can move the VS Code installation anywhere in your home directory. Your environment and extensions are stored in the ~/.vscode folder, so the location of the runtime files does not matter

Remote connection from your workstation#

This is the more advanced of the two options for VS Code, and it requires additional configuration on your workstation. It provides direct access to a compute node from a VS Code session running on your computer.

Initial setup#

  1. Download and install VS Code from the Visual Studio Code website.
  2. Install the "Remote - SSH" extension in VS Code.
  3. Set up SSH keys following our SSH instructions.
  4. Configure tunneling in your SSH configuration file.
    1. Open the terminal app on Linux or macOS, or open PowerShell on Windows.
      1
      2
      3
      4
      5
      6
      7
      # On Mac/Linux:
      nano ~/.ssh/config  # or you can use vi/vim
      
      # On Windows PowerShell:
      echo $null >> ~\.ssh\config
      cd ~\.ssh
      notepad config
      
    2. Copy the following lines into the file, replacing [YOUR_HPC_USERNAME] with your HPC username:
      1
      2
      3
      4
      5
      6
      7
      Host hpc_tunnel
          Hostname hpc-login.rcc.fsu.edu
          User [YOUR_HPC_USERNAME]
      
      Host !hpc-login* hpc-*
          User [YOUR_HPC_USERNAME]
          ProxyCommand ssh -q -W %h.local:22 hpc_tunnel
      

Each time you connect#

  1. Using your terminal app, log in to the HPC and allocate resources on a compute node for your VS Code session:
    1
    2
    3
    4
    5
    6
    7
    # Example job allocation using the backfill2 account and a time limit of 4 hours
    $ salloc -A backfill2 -t 04:00:00
    salloc: Pending job allocation 12121464
    salloc: job 12121464 queued and waiting for resources
    salloc: job 12121464 has been allocated resources
    salloc: Granted job allocation 12121464
    salloc: Nodes hpc-r29-1-4 are ready for job
    
  2. Note the node name in the last line of the salloc output: hpc-r29-1-4.
  3. You can close the terminal app after the allocation starts; the VS Code connection will use the allocated compute node.
  4. Open VS Code on your workstation.
  5. In the lower-left corner of the window, click the >< icon to connect to a remote system: Alternatively, type CTRL+SHIFT+P and type "Connect to Host"
  6. Select Connect to Host...: Alternatively, type CTRL+SHIFT+P and type "Connect to Host"
  7. Type the hostname from the salloc output in step 1: Enter the compute node hostname in the VS Code Connect to Host prompt
  8. You may see the message similar to the The authenticity of this host can't be established. Type "yes" in text input, and press Enter to continue: Confirm the SSH host authenticity prompt in VS Code
  9. In the lower-right corner of the window, you will see a message while VS Code sets up the remote connection. This might take a few minutes: VS Code setting up the remote SSH connection
  10. If everything worked, the indicator in the lower-left corner of the window will show the compute node you are connected to: VS Code showing the connected compute node in the lower-left corner
  11. If you need Internet access from the compute node, open a terminal window in VS Code by selecting Terminal → New Terminal or pressing Ctrl+Shift+`, then run:
    ml webproxy