Skip to content

Visual Studio Code

Simon Byrne edited this page Apr 17, 2023 · 14 revisions

Running on the cluster

Install VSCode CLI on the cluster

  1. SSH to the login node on the cluster

  2. Download and extract the "x64 CLI" binary from https://code.visualstudio.com/download# by running the following:

    wget https://code.visualstudio.com/sha/download\?build\=stable\&os\=cli-alpine-x64 -O vscode-cli.tar.gz
    tar -xzf vscode-cli.tar.gz

    Move the code executable somewhere in your PATH.

  3. Check that it works by running the following

    code tunnel

    , or

    ./code tunnel

    in the code directory if code is not in your PATH, and follow the prompts.

  4. You can connect either via the browser, or via your local VSCode by installing the "Remote - tunnels" extension, and connecting via the remote explorer tab.

  5. You can close the session on the server via Ctrl-C.

Create script a script to run code tunnel

Save the following as vscode.sh:

#!/bin/bash

#SBATCH --job-name=vscode
#SBATCH --output=vscode.out
#SBATCH --time=8:00:00
#SBATCH --reservation=clima
#SBATCH --cpus-per-task=8

module load git/2.37.2 julia/1.8.5 cuda/11.2 ucx/1.13.1_cuda-11.2 openmpi/4.1.5_cuda-11.2 hdf5/1.14.0-ompi415
export JULIA_CUDA_USE_BINARYBUILDER=false
export JULIA_CUDA_MEMORY_POOL=none
export JULIA_NUM_PRECOMPILE_TASKS=8

# disables encryption of login token, so you don't need to re-enter code when switching machines
export VSCODE_CLI_DISABLE_KEYCHAIN_ENCRYPT=1 

code tunnel

Submit and connect

  1. Submit the job via sbatch vscode.sh.
  2. Check the output of cat vscode.out and authenticate the token.
  3. You should now be able to connect as before, but this time you should be running on a compute node.

Shutting down

You can close the server by canceling the slurm job

scancel --me --name=vscode
Clone this wiki locally