Note: VSCode v1.98 is what is currently compatible with our system:
https://code.visualstudio.com/updates/v1_98. If you SSH to the Grid in VSCode without following these steps, your VSCode connection won't be set up properly. This will cause VSCode to use resources on the login node Warrior, even if you start an interactive job in VSCode. Any computationally intensive processes on Warrior are prohibited, and you will be warned if you're connecting this way. If you continue to run VSCode without following these steps, your processes on Warrior will be killed.
Follow the steps below to properly set up SSH access to the Grid in Visual Studio Code on Windows or macOS.
Step 1
On the Grid, generate an ED25519 SSH key by running: ssh-keygen -t ed25519 (this will create a key pair in ~/.ssh/)
Step 2
Copy your private key to your local system
- From Warrior: Locate your private SSH key:
~/.ssh/id_ed25519
- To your local system: Copy the key file to the following equivalent location, renaming zz9992 with your own AccessID: %USERPROFILE%\.ssh\id_ed25519_zz9992
Step 3
Generate and set up your SSH config file
- On Warrior: Run this command to generate an SSH configuration file:
/wsu/apps/scripts/generate_vscode_ssh_jump_config.sh (this will create a file named vscode_ssh_config)
- On your local system: Copy the contents of the generated file and save it as your SSH config file: %USERPROFILE%\.ssh\config
Step 4
Secure the .ssh directory
- Windows: To protect your SSH directory, disable inherited permissions by running this command in Windows Command Prompt:
icacls %USERPROFILE%\.ssh /inheritance:d
- macOS: Use the
chmod command to set permissions
chmod 700 ~/.ssh (this sets it so you (owner) can open, modify, and list files in .ssh. No one else can access the folder at all)
chmod 600 ~/.ssh/id_ed25519_zz9992 (this command sets it so only you can read or edit the private key. No one else can read or modify it - renaming zz9992 with your own AccessID)
Step 5
Start a Slurm job:
- Before running VSCode on the Grid, start a Slurm job.
- Check the name of the node your job is on by using this command and checking
NODELIST: qme
Step 6
Test your SSH Connection by Connecting to a Slurm Job Node on your local machine
- You must only SSH to the Grid via a compute node where you have a job running, even for basic functions like reading and editing files.
- You must submit the job from another SSH client, such as PuTTY or the Grid OnDemand in a web browser—you can obtain a shell OnDemand by going to Clusters > HPC Grid Shell Access.
- We recommend submitting a batch script. You can submit it with the command
sbatch jobscript_name. Here is an example that requests minimal resources that you can modify for your needs. You can modify this to request more resources when you require them to run any code:
#!/bin/bash
# Job name
#SBATCH --job-name VSCode
# Submit to the primary QoS
#SBATCH -q primary
# Request one node
#SBATCH -N 1
# Total number of cores (in this example it will be 1 node with 1 core each)
#SBATCH -n 1
# Request memory
#SBATCH --mem=5G
# Mail (when the job begins, ends, fails, and/or requeues)
#SBATCH --mail-type=ALL
# Where to send email alerts
#SBATCH --mail-user=xxyyyy@wayne.edu
# Create an output file that will be output_<jobid>.out
#SBATCH -o output_%j.out
# Create an error file that will be error_<jobid>.out
#SBATCH -e errors_%j.err
# Set maximum time limit - this is 1 day
#SBATCH -t 1-0:0:0
hostname
date
# sleep command - set it to match the time limit of your job
sleep 1d
Step 7
Once you have submitted your job, you can check if it is running and what node it is on with the command: qme
Step 8
In the terminal of either your Mac or your Windows machine, connect to the compute node where your Slurm job is running, replace sfx1 with the correct node name: ssh sfx1
Connect to the Grid Using VSCode.
Once your SSH setup is complete, you can run VSCode remotely on the Grid.
- Open VSCode on Windows
- Press Ctrl+Shift+P
- Type
ssh in the command palette
- Select Connect to Host...
- Enter the node name of your Slurm job