VSCode: Difference between revisions
m Modified the steps to launch VS Code on compute nodes. |
No edit summary |
||
| Line 47: | Line 47: | ||
3. After configuring SSH, run VSCode natively on your local machine and use the command palette to type `Remote-SSH: Connect to Host....` Select `babel-compute-node` from the list. | 3. After configuring SSH, run VSCode natively on your local machine and use the command palette to type `Remote-SSH: Connect to Host....` Select `babel-compute-node` from the list. | ||
== Connecting to a Compute Node == | |||
You can also ssh directly to a compute node where you have a job already running by doing: | |||
ssh -J babel babel-X-XX | |||
Revision as of 09:58, 27 September 2023
Note: [VSCodium](https://github.com/VSCodium/vscodium) is an open-source variant of Visual Studio Code that provides the same powerful features and extensibility, but without the telemetry and branding associated with the official version.
Using VSCode
When developing on VSCode, it’s important to be cautious about its CPU usage, especially when working on the login node, as it can be CPU-intensive. Certain extensions, such as the GitHub co-pilot extension, can significantly increase CPU usage. To monitor and limit CPU usage while developing on the login node, you can refer to the following articles (1, 2, 3).
Alternatively, you can host a VSCode server on a compute node and establish an SSH tunnel to access it. This approach mostly avoids over consumption on the login node. To set this up, follow these steps:
1. Download the VSCode server release here and extract it in your home directory on the login node.
2. Run the following command on the login node:
$ srun -c 8 --mem 64G --time 1-00:00:00 vscode-server-linux-x64-web/bin/code-server --accept-server-license-terms
3. Once the server starts, take note of the compute node your job lands on (e.g., babel-x-y)and the URL shown (e.g., **http://localhost:port/?tkn=...)**.
4. On the cluster login node, run the following command:
$ ssh -NL <an available port>:0.0.0.0:port babel-x-y
5. On your local machine, run the following command:
$ ssh -NL port:0.0.0.0:<an available port> babel
6. Open your browser and navigate to **http://localhost:port/?tkn=...** to access the VSCode server running on the compute node.
Alternative Option
Another option is to use the remote-ssh functionality of VSCode to connect directly to a compute node. This requires an active job on the compute node. To set up the SSH configuration for connecting to the compute node, follow these steps:
1. Obtain the IP address of the compute node using the ifconfig command.
2. Update your SSH configuration file (~/.ssh/config) with the following entries:
Host babel HostName babel.lti.cs.cmu.edu User <username> IdentityFile <identityfile> ForwardAgent yes
Host babel-compute-node HostName <node ip addr/ node-name (babel-1-10)> User <username> IdentityFile <identityfile> ProxyJump babel StrictHostKeyChecking no UserKnownHostsFile /dev/null LogLevel ERROR
3. After configuring SSH, run VSCode natively on your local machine and use the command palette to type `Remote-SSH: Connect to Host....` Select `babel-compute-node` from the list.
Connecting to a Compute Node
You can also ssh directly to a compute node where you have a job already running by doing:
ssh -J babel babel-X-XX