Running VS Code on an FRCE Compute Node

Open VS Code on your own desktop and have it run inside a Slurm allocation on FRCE. Your terminal, extensions, and tools all run on a compute node, not the login node.

One-time setup

1. Install the extension

In VS Code, install Remote - SSH (publisher: Microsoft).

2. Set up passwordless login to FRCE

VS Code cannot stop to ask for a password partway through connecting, so key-based login is required. Test whether you already have it:

ssh batch.ncifcrf.gov hostname

If that returns a hostname with no password prompt, skip to step 3. Otherwise, replace <your-username> with your FRCE username and run the commands below, one line at a time.

Mac / Linux (in Terminal):

ssh-keygen -t ed25519
ssh-copy-id <your-username>@batch.ncifcrf.gov
ssh <your-username>@batch.ncifcrf.gov hostname

Windows (in PowerShell):

ssh-keygen -t ed25519
type $env:USERPROFILE\.ssh\id_ed25519.pub | ssh <your-username>@batch.ncifcrf.gov "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"
ssh <your-username>@batch.ncifcrf.gov hostname

The Windows command is long but is a single line. Press Enter at every ssh-keygen prompt to accept the defaults and leave the passphrase empty. The last command should return a hostname with no password prompt.

3. Add the hosts to your SSH config

Open your SSH config file:

  • Windows: C:\Users\<you>\.ssh\config
  • Mac / Linux: ~/.ssh/config

Add the three sections below, replacing <your-username> with your FRCE username. Keep the indentation and leave a blank line between each section.

Host frce-*
    User <your-username>
    StrictHostKeyChecking no
    UserKnownHostsFile /dev/null

Host frce-cpu
    ProxyCommand ssh -o LogLevel=QUIET -o ForwardAgent=yes %r@batch.ncifcrf.gov /mnt/nasapps/production/VSCode/vscode-alloc/vscode-alloc cpu

Host frce-gpu
    ProxyCommand ssh -o LogLevel=QUIET -o ForwardAgent=yes %r@batch.ncifcrf.gov /mnt/nasapps/production/VSCode/vscode-alloc/vscode-alloc gpu

Each ProxyCommand is one long line. The only difference between the two is cpu or gpu at the very end.

Connecting

  1. Click the blue >< button in the bottom-left corner of VS Code.
  2. Choose Connect to Host.
  3. Pick frce-cpu or frce-gpu.
  4. Wait. The first connection takes a minute while VS Code sets itself up on the node.
  5. Open a terminal with Ctrl + `. You are now on a compute node.

To confirm where you landed, run hostname to see the compute node name, and squeue -u $USER to see the allocation behind your session.

Which one should I use?

  • frce-cpu for editing, scripting, builds, and anything that does not need a GPU. Time limit: 24 hours.
  • frce-gpu for training, inference, and CUDA work. Time limit: 2 hours.

Use frce-cpu unless you actually need a GPU.

Closing VS Code does not release your allocation. The job keeps running until its time limit, so a GPU you are done with stays tied up. When you finish, cancel it from a terminal on the login node:

scancel -u $USER -n vscode-gpu
scancel -u $USER -n vscode-cpu

GPUs are scarce and shared, so please cancel your GPU session as soon as you are done with it.

Good to know

  • When your allocation expires, VS Code disconnects. Reconnect the same way to get a fresh one.
  • Reconnecting reuses your existing allocation if one is still running, so you will not accidentally grab two nodes.
  • You can hold one CPU and one GPU session at the same time.