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 via our Open OnDemand portal.
  • Run VS Code on your local workstation and connect directly to an HPC compute node through an SSH tunnel.

VS Code in Open OnDemand#

This method is the more straightforward of the two options for VS Code, but it 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 to extract the application:
      1
      2
      3
      4
      5
      # Move into your 'Downloads' folder
      $ cd ~/Downloads
      
      # Uncompress the downloaded file. 
      $ 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/VSCode-linux-x64/bin/code and click "Launch".

Tip

You can move the VS Code installation folder anywhere in your home directory. Because your environment and extensions are stored separately in the ~/.vscode folder, moving the core application runtime files will not disrupt your settings.

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. However, this method 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
      # On macOS/Linux:
      $ nano ~/.ssh/config  # or you can use vi/vim
      
      # On Windows PowerShell (ensure line endings are set to Linux-style; LF):
      > cd ~\.ssh
      > code .\config
      
    2. Copy the following lines into the file, replacing [YOUR_HPC_USERNAME] with your HPC username:
      # On all operating systems:
      Host hpc_tunnel
          Hostname hpc-login.rcc.fsu.edu
          User [YOUR_HPC_USERNAME]
      
      # On macOS/Linux:
      Host !hpc-login* hpc-*
          User [YOUR_HPC_USERNAME]
          ProxyJump hpc_tunnel
      
      # On Windows:
      Host !hpc-login* hpc-*
          User [YOUR_RCC_USERNAME]
          ProxyCommand C:\Windows\System32\OpenSSH\ssh.exe -q -W %h.local:22 hpc_tunnel
      
    3. Save the file and test the connection:
      1
      2
      3
      4
      5
      # In the terminal or PowerShell:
      ssh hpc_tunnel
      
      # You should not be prompted for a password
      [USERNAME@h22-login-25 ~]$
      

Each time you connect#

  1. Open VS Code and invoke a terminal (Ctrl+Shift+`).
  2. In the VS Code terminal, log in to the HPC and allocate resources on a compute node for your session:
    1
    2
    3
    4
    5
    6
    7
    8
    # Example job allocation using the backfill2 account and a time limit of 4 hours
    # salloc accepts the same options as srun and sbatch
    $ salloc -n 1 --cpus-per-task=8 -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
    
  3. Note the node name in the last line of the salloc output: hpc-r29-1-4.
  4. Important: Do not close this terminal tab. Closing the terminal or terminating this SSH session will automatically cancel your Slurm allocation, causing your VS Code remote connection to drop.
  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... (do not select Connect current window to host; this option will terminate your Slurm allocation): Alternatively, type CTRL+SHIFT+P and type "Connect to Host"
  7. Type the hostname from the salloc output in step 2: 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 the text input box 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