software:vscode:darwin

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
software:vscode:darwin [2024-03-27 15:54] anitasoftware:vscode:darwin [2024-04-26 17:35] (current) – [Connect VSCode to compute node] anita
Line 1: Line 1:
 ====== Using VSCode Backend on DARWIN ====== ====== Using VSCode Backend on DARWIN ======
-<note warning> 
  
-**This page is under construction.** 
-</note> 
 ==== Download and install ==== ==== Download and install ====
   - Install the [[http://code.visualstudio.com/download|Stable Build VSCode]] on the local machine. **DO NOT** install the VSCode Insiders Build, as it will not work with the proxy.   - Install the [[http://code.visualstudio.com/download|Stable Build VSCode]] on the local machine. **DO NOT** install the VSCode Insiders Build, as it will not work with the proxy.
Line 10: Line 7:
  
 ==== Setting up remote connections ==== ==== Setting up remote connections ====
-First, open VSCode on your computer. You'll see an icon on the left-hand side that looks like a square with some smaller squares inside it; this is the ''Extensions'' icon. Click on that icon to open the ''Extensions'' view. In the search bar at the top, type ''Remote - SSH'' and hit Enter. You'll see the ''Remote - SSH'' extension in the search results. Click on the gearwheel icon located on the right side of the extension, and a drop-down menu will appear. Select ''Extension Settings'' from this menu.+First, open VSCode on your computer. You'll see an icon on the left-hand side that looks like a square with some smaller squares inside it; this is the ''Extensions'' icon (labeled 1). Click on that icon to open the ''Extensions'' view. In the search bar at the top, type ''Remote - SSH'' and hit Enter. You'll see the ''Remote - SSH'' extension in the search results. Click on the gearwheel icon (labeled 2) located on the right side of the extension, and a drop-down menu will appear. Select ''Extension Settings'' from this menu.
  
 {{:software:vscode:vscode-1.png?600|}} {{:software:vscode:vscode-1.png?600|}}
  
-You will need to create a separate SSH Config file for the "Remote - SSHextensionwithout altering the regular SSH Config file. Throughout this guidewe use the user name ''traine'' and the path for the Config file ''~/vscode-remote-ssh/config'' for illustrative purposes only. You will need to use your user name on DARWIN and absolute paths on your local machine to save the Config file. The ''Connect Timeout'' also needs to increase to 300 seconds in order to allow Slurm time to schedule and launch the interactive job.+The ''remote.SSH'' settings are written as a JSON dictionary and can be edited by clicking on the icon for ''Open Settings (JSON)'' located in the upper right corner below the title bar of the window (marked with large red arrow).This will open a the ''{} settings.json'' file and display each ''remote.SSH'' settings.  **Note:** You will need to create a separate SSH Config file for the 'Remote - SSHextension without modifying the regular SSH Config file, referred to as ''~/vscode-remote-ssh/config'' below.
  
-From the settings pageensure the following options are checked: +To ensure the settings are correctremove all existing lines in ''{} settings.json'' and replace them with these lines between the ''{'' ''}'' 
-  - Enable Dynamic Forwarding +<code> 
-  Enable Remote Command +    "remote.SSH.configFile": "~/vscode-remote-ssh/config", 
-  Enable X11 Forwarding +    "remote.SSH.connectTimeout": 300, 
-  - Enable Use Local Server +    "remote.SSH.defaultForwardedPorts"[], 
-{{:software:vscode:vscode-2.png?400|}} +    "remote.SSH.maxReconnectionAttempts"0, 
-{{:software:vscode:vscode-3.png?400|}}+    "remote.SSH.localServerDownload""off", 
 +    "remote.SSH.lockfilesInTmp": true, 
 +    "remote.SSH.useLocalServer"true, 
 +    "remote.SSH.useExecServer"false, 
 +    "remote.SSH.enableRemoteCommand"true 
 +</code> 
 +  
 +Clicking on the ''X'' next to ''{} settings.json'' will prompt you to save the settings file. Again keep in mind ''~/vscode-remote-ssh/config'' is used for illustrative purposes. You can change this to specify the path and filename of choice. The ''Connect Timeout'' is set to 300 seconds in order to allow Slurm enough time to schedule and launch the interactive job.
  
 <note important> <note important>
-The ''remote.SSH'' settings are written as a JSON dictionary and can be edited by clicking the ''Edit in settings.json'' as shown in the above picture. Also, the path of ''settings.json'' can be found at:+The path of ''{} settings.json'' can be found at:
                      
  
Line 34: Line 38:
 </note> </note>
  
-<note important> +Nowclick on the ''X'' to close the ''Settings'' tab for the ''Remote - SSH Extensions Settings''. On the lower left corner, click the button ''Open a Remote Window''(or ''F1''), select ''Connect Current Window to Host'' and then ''Configure SSH Hosts''
-On the Windows machine, the default value for option ''Remote.SSH: Use Local Server'' is evaluated to be false, so it is necessary to manually add the line ''"remote.SSH.useLocalServer":true'' to ''settings.json.'' +
-<code> +
-    "remote.SSH.configFile": "<path-to-your-config-file>", +
-    "remote.SSH.connectTimeout": 300, +
-    "remote.SSH.defaultForwardedPorts": [], +
-    "remote.SSH.maxReconnectionAttempts": 0, +
-    "remote.SSH.localServerDownload": "off", +
-    "remote.SSH.lockfilesInTmp": true, +
-    "remote.SSH.enableRemoteCommand": true +
-</code> +
-</note> +
- +
-Now, close the ''Settings'' tab. On the lower left corner, click the button ''Open a Remote Window''(or ''F1''), select ''Connect Current Window to Host'' and then ''Configure SSH Hosts''+
  
 {{:software:vscode:vscode-4.png?400|}} {{:software:vscode:vscode-4.png?400|}}
Line 54: Line 45:
 {{:software:vscode:vscode-7.png?400|}} {{:software:vscode:vscode-7.png?400|}}
  
-It will open the Config file located in the path ''<path-to-your-config-file>'', you can have multiple configurations used on DARWIN with different host names. For example, in the following Config file, ''Host Darwin'' starts the interactive job on ''idle'' partition and request one CPU for the remote shell to use. ''Host DarwinGPU'' request to use the GPU and ''Host DarwinMPI'' can be used for MPI. +It will open the Config file located in the path specified by ''~/vscode-remote-ssh/config''. You can have multiple configurations used for DARWIN with different Host definitions. For example, in the following Config file, ''Host DARWIN'' starts the interactive job on ''it_css'' partition and requests one CPU for the remote shell to use. ''Host DARWINGPU'' requests to use GPU and ''Host DARWINMPI'' can be used for MPI.  
 + 
 +For this example,  the Config file ''~/vscode-remote-ssh/config'' contains the following definitions (remember User ''traine'' should be replace with your username as well as possible partition and other options)
 <code> <code>
 # Read more about SSH config files: https://linux.die.net/man/5/ssh_config # Read more about SSH config files: https://linux.die.net/man/5/ssh_config
 # Request CPU in idle partition # Request CPU in idle partition
-Host Darwin+Host DARWIN
     HostName darwin.hpc.udel.edu     HostName darwin.hpc.udel.edu
     User traine     User traine
Line 66: Line 59:
  
 # Request GPU use     # Request GPU use    
-Host DarwinGPU+Host DARWINGPU
     HostName darwin.hpc.udel.edu     HostName darwin.hpc.udel.edu
     User traine     User traine
Line 74: Line 67:
  
 # For MPI code development     # For MPI code development    
-Host DarwinMPI+Host DARWINMPI
     HostName darwin.hpc.udel.edu     HostName darwin.hpc.udel.edu
     User traine     User traine
Line 126: Line 119:
 Do not run the script ''vscode-shell-proxy'' itself on the login node, as it will start a remote interactive session. Do not run the script ''vscode-shell-proxy'' itself on the login node, as it will start a remote interactive session.
 </note> </note>
 +
 +
 +==== Connect VSCode to compute node ====
 +Now, we can connect the VSCode to the compute node. Follow the similar steps when adding the Config file from the [[:software:vscode:darwin#setting-up-remote-connections|Setting up Remote Connections]] except step 3. Since we created the host named "DARWIN", choose it and enter the credentials for DARWIN login (or [[software:vscode:darwin#using-ssh-keys| use SSH keys]]). 
 +
 +{{:software:vscode:vscode-4.png?400|}}
 +{{:software:vscode:vscode-5.png?400|}}
 +{{:software:vscode:vscode-10.png?400|}}
 +
 +After successful login, you will now connect to the compute node. You can use the bash shell as the SSH terminal or develop code in VSCode.
 +
 +<code>
 +[(it_css:traine)@r1n00 ~]$ hostname
 +r1n00
 +</code>
 +
 +You also can open the file on your home directory in ''DARWIN'' and edit it. After completing the job, click ''Close Remote Connection'' to stop the job.
 +{{:software:vscode:vscode-9.png?400|}}
  
 ==== Using SSH keys ==== ==== Using SSH keys ====
-SSH public key authentication is a secure way to authenticate with an SSH host by combining a local "private" key with a "public" key associated with your user account. Once you set up the SSH keys, you will not need to enter the password for every login. Please only generate the SSH keys on the trusted computer. For macOS / Linux, you can run the following command in a local terminal:+SSH public key authentication is a secure way to authenticate with an SSH host by combining a local "private" key with a "public" key associated with your user account. Once you set up the SSH keys, you will not need to enter the password for every login. If you have previously set up your SSH keys (i.e. you can login with SSH to DARWIN without having to enter your password), then you do not need to do this step unless you want to create SSH keys specifically for VSCode.  Please only generate the SSH keys on the trusted computer. For macOS / Linux, you can run the following command in a local terminal:
 <code> <code>
 ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519-remote-darwin ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519-remote-darwin
Line 137: Line 148:
 For Windows, run the following command in a local PowerShell as administrator: For Windows, run the following command in a local PowerShell as administrator:
 <code> <code>
-ssh-keygen -t ed25519 -f "$HOME\.ssh\id_ed25519-remote-darwin.pub"+ssh-keygen -t ed25519 -f "$HOME\.ssh\id_ed25519-remote-darwin"
 $USER_AT_HOST="your-user-name@darwin.hpc.udel.edu" $USER_AT_HOST="your-user-name@darwin.hpc.udel.edu"
 $PUBKEYPATH="$HOME\.ssh\id_ed25519-remote-darwin.pub" $PUBKEYPATH="$HOME\.ssh\id_ed25519-remote-darwin.pub"
Line 148: Line 159:
  
 <code> <code>
-Host Darwin+Host DARWIN
     HostName darwin.hpc.udel.edu     HostName darwin.hpc.udel.edu
     User traine     User traine
Line 158: Line 169:
  
 For more information, please refer to [[https://code.visualstudio.com/docs/remote/troubleshooting|SSH tips]]. For more information, please refer to [[https://code.visualstudio.com/docs/remote/troubleshooting|SSH tips]].
-==== Connect VSCode to compute node ==== 
-Now, we can connect the VSCode to the compute node. Follow the similar steps when adding the Config file from the [[:software:vscode:darwin#setting-up-remote-connections|Setting up Remote Connections]] except step 3. Since we created the host named "Darwin", choose it and enter the credentials for DARWIN login (or [[software:vscode:darwin#using-ssh-keys| use SSH keys]]).  
- 
-{{:software:vscode:vscode-4.png?400|}} 
-{{:software:vscode:vscode-5.png?400|}} 
-{{:software:vscode:vscode-10.png?400|}} 
- 
-After successful login, you will now connect to the compute node. You can use the bash shell as the SSH terminal or develop code in VSCode. 
- 
-<code> 
-[(it_css:traine)@r1n00 ~]$ hostname 
-r1n00 
-</code> 
- 
-You also can open the file on your home directory in ''DARWIN'' and edit it. After completing the job, click ''Close Remote Connection'' to stop the job. 
-{{:software:vscode:vscode-9.png?400|}} 
  • software/vscode/darwin.txt
  • Last modified: 2024-04-26 17:35
  • by anita