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
habrok:connecting_to_the_system:connecting_via_vsc [2024/04/15 12:10] – ↷ Page moved from habrok:connecting_via_vsc to habrok:connecting_to_the_system:connecting_via_vsc pedrohabrok:connecting_to_the_system:connecting_via_vsc [2024/12/05 12:47] (current) – [Connecting with VS Code via SSH to a compute node] fokke
Line 1: Line 1:
 ====== Advanced: Connecting to Hábrók with Visual Studio Code ====== ====== Advanced: Connecting to Hábrók with Visual Studio Code ======
  
-[[https://code.visualstudio.com/|Microsoft Visual Studio Code]] (VS Code) is a popular source code editor and IDE that is available for free and which can run on Linux, Windows and macOS systems. It allows connecting to remote environments and working from them and the installation of extensions to support different programming languages and make use of additional development tools. Because of this, it is suitable for connecting to Hábrók to perform software development tasks.+[[https://code.visualstudio.com/|Microsoft Visual Studio Code]] (VS Code) is a popular source code editor and IDE that is available for free and which can run on Linux, Windows and macOS systems. It allows connecting to remote environments and working from them and the installation of extensions to support different programming languages and make use of additional development tools. Because of this, it is suitable for connecting to Hábrók to perform software development tasks. There are two main ways to use VS Code from Hábrók, either by connecting your local VS Code installation client via SSH to a VS Code server running in one of the access nodes, or by running it directly on your browser through our [[https://portal.hb.hpc.rug.nl/|web portal]].
  
-===== Connecting with VS Code to a login node=====+ 
 +===== Using the web portal ===== 
 +The simplest and most straightforward way of using VS Code on Hábrók is by using our [[https://portal.hb.hpc.rug.nl/|web portal]]. Simply login with your university account and open the VS Code Server Interactive App by navigating in the top bar to Interactive Apps -> VS Code Server or by clicking the shortcut in the main page after logging in. From the VS Code Server page, you can queue job with the necessary memory and CPU requirements for your use case and the root directory for your VS Code session. After that, simply launch the job and wait for a while until your job begins, often this takes only just a moment. As soon as the job has started and is ready, you should see a blue button to Connect to VS Code. This will automatically start up your VS Code session in the compute node your job is running. 
 + 
 +===== Connecting with VS Code via SSH ===== 
 +If you'd like to run the VS Code client natively in your desktop, you can also do so by setting up a Remote-SSH connection. This takes some additional setup when compared with the connection via the [[https://portal.hb.hpc.rug.nl/|web portal]]. 
 + 
 +==== Connecting with VS Code via SSH to an access node ====
  
   - If you haven't already you will need to install the Remote-SSH extension for VS Code: [[https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh|Remote-SSH]]   - If you haven't already you will need to install the Remote-SSH extension for VS Code: [[https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh|Remote-SSH]]
Line 9: Line 16:
   - On the Settings page, search for ''remote.SSH.showLoginTerminal''. Enable this setting so that you can fill in the two factor authentication code on the console later. {{ :habrok:connecting_to_the_system:vscode_remote_ssh_settings.png?direct&600 |}}   - On the Settings page, search for ''remote.SSH.showLoginTerminal''. Enable this setting so that you can fill in the two factor authentication code on the console later. {{ :habrok:connecting_to_the_system:vscode_remote_ssh_settings.png?direct&600 |}}
   - Press ''Ctrl+Shift+P'' and write: Connect to Host {{ :habrok:connecting_to_the_system:remote_ssh_connect_to_host.png?direct&600 |}}   - Press ''Ctrl+Shift+P'' and write: Connect to Host {{ :habrok:connecting_to_the_system:remote_ssh_connect_to_host.png?direct&600 |}}
-  - You can then fill in the ssh command. Let's say you want to connect to ''interactive1.hb.hpc.rug.nl'', then you would write ''ssh pNUMBER@interactive1.hb.hpc.rug.nl''+  - You can then fill in the ssh command. Let's say you want to connect to ''interactive1.hb.hpc.rug.nl'', then you would write ''pNUMBER@interactive1.hb.hpc.rug.nl''
   - You will see a new window appear with a drop-down menu asking which platform type you are connecting to. Choose "Linux".   - You will see a new window appear with a drop-down menu asking which platform type you are connecting to. Choose "Linux".
   - At the bottom of that window, a console will appear and show you the same prompt when you first connected to Hábrók, if you want to accept the host key. Write 'yes' and press ''Enter''. {{ :habrok:connecting_to_the_system:accept_hostkey.png?direct&400 |}}   - At the bottom of that window, a console will appear and show you the same prompt when you first connected to Hábrók, if you want to accept the host key. Write 'yes' and press ''Enter''. {{ :habrok:connecting_to_the_system:accept_hostkey.png?direct&400 |}}
Line 18: Line 25:
  
  
-===== Connecting with VS Code to a compute node=====+==== Connecting with VS Code via SSH to a compute node ====
  
 In addition to connecting to one of the login or interactive nodes, you may choose to connect directly to a compute node in order to have a similar environment and restrictions as you have for your compute jobs. You could even use a debugger to interactively debug your program in an identical environment as those your jobs run in. To do so, you should follow the same instructions as above, but there are a few extra steps and details to take into account: In addition to connecting to one of the login or interactive nodes, you may choose to connect directly to a compute node in order to have a similar environment and restrictions as you have for your compute jobs. You could even use a debugger to interactively debug your program in an identical environment as those your jobs run in. To do so, you should follow the same instructions as above, but there are a few extra steps and details to take into account:
Line 36: Line 43:
   * Press ''Ctrl+P'' or ''Command+P'' once more and enter "Connect to Host".   * Press ''Ctrl+P'' or ''Command+P'' once more and enter "Connect to Host".
   * From the drop-down menu, select "+ Add New SSH Host...".   * From the drop-down menu, select "+ Add New SSH Host...".
-  * Input the ''ssh'' command to connect, but this time with the information to connect to the relevant compute node. Assuming your job is running on ''node2'', you would write: ''ssh -J pNUMBER@login1.hb.hpc.rug.nl node2''.+  * Input the ''ssh'' command to connect, but this time with the information to connect to the relevant compute node. Assuming your job is running on ''node2'', you would write: ''ssh -J pNUMBER@login1.hb.hpc.rug.nl pNUMBER@node2''.
   * You will then be asked what configuration file to save the information at. Any of the suggested options should work, the ''.ssh/config/'' you presumably have on your home directory is a good option.   * You will then be asked what configuration file to save the information at. Any of the suggested options should work, the ''.ssh/config/'' you presumably have on your home directory is a good option.
   * Again press ''Ctrl+P'' or ''Command+P'' and write "Connect to Host". Then, choose the appropriate connection, in this case ''node2''.   * Again press ''Ctrl+P'' or ''Command+P'' and write "Connect to Host". Then, choose the appropriate connection, in this case ''node2''.