VSCode Tutorial: Working with WATGPU

In this tutorial, we'll walk you through the process of setting up and using Visual Studio Code (VSCode) to work with WATGPU. This guide will cover connecting to the login gateway and accessing specific clusters (e.g., watgpu108, watgpu208, ...) after allocating resources.

Note that this method of connecting to WATGPU should be used for debugging and understanding your code via testing and notebooks. If you wish to run long experiments, please use the SBATCH command.

Prerequisites

Before you begin, make sure you have the following prerequisites installed:

Quick steps to install the Remote - SSH extension:

  1. Open Visual Studio Code
  2. Click on the Extensions icon in the Activity Bar on the side of the window.
  3. Search for "Remote - SSH" in the Extensions view search box.
  4. Install the "Remote - SSH" extension.

Step 1: Configuring VSCode

Once the extension is installed, follow these steps to connect to the login gateway (replace your_username with your actual username):

  1. Press Ctrl + Shift + P (Windows/Linux) or Cmd + Shift + P (Mac) to open the command palette.

  2. Type "Remote-SSH: Open SSH Configuration File ...", select it and select the desired file (recommended file: ~/.ssh/config).

  3. Insert the following part and replace <username> and <path/to/private/key> with your username and the path to your private key registered in WatGPU:

    #WATGPU
    Host watGPU
        User <username>
        IdentityFile <path/to/private/key>
        HostName watgpu.cs.uwaterloo.ca
    
    Host watGPU108
        User <username>
        IdentityFile <path/to/private/key>
        HostName watgpu108
        ProxyJump watGPU
    
    Host watGPU208
        User <username>
        IdentityFile <path/to/private/key>
        HostName watgpu208
        ProxyJump watGPU
    
    Host watGPU308
        User <username>
        IdentityFile <path/to/private/key>
        HostName watgpu308
        ProxyJump watGPU
    
  4. Save and refresh the Remote - SSH extension menu.

Step 2: Allocate Resources and Connect to Cluster

After successfully connecting via ssh to watgpu.cs.uwaterloo.ca, you'll need to allocate resources using salloc and then connect to a specific cluster:

  1. Follow the Interactive mode part of the documentation to obtain resource allocation.

  2. Once resources are allocated, connect to the appropriate cluster in VSCode:

That's it! You are now set up to work with WatGPU using Visual Studio Code.