-
Notifications
You must be signed in to change notification settings - Fork 4
Add VSCode Remote SSH connection guide #402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Amanda-dong
wants to merge
20
commits into
main
Choose a base branch
from
jupyter-with-vscode-on-torch
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
a07e1e8
Add VSCode Remote SSH connection guide
Amanda-dong 2767dc1
Create 10_use_jupyter_notebooks_in_vscode_on_torch.mdx
Amanda-dong 9614a9f
Update 10_use_jupyter_notebooks_in_vscode_on_torch.mdx
Amanda-dong 784df98
Update 09_vscode_remote_ssh_torch.mdx
Amanda-dong d0a42cc
Update 09_vscode_remote_ssh_torch.mdx
Amanda-dong 25e199e
Update 10_use_jupyter_notebooks_in_vscode_on_torch.mdx
Amanda-dong bb9a339
Update 09_vscode_remote_ssh_torch.mdx
Amanda-dong 68b0dfb
Revise VSCode connection instructions for Torch
Amanda-dong 862f78e
Update 09_vscode_remote_ssh_torch.mdx
Amanda-dong 1450610
Add testfile.mdx with initial content
Amanda-dong 4848bd7
Delete docs/hpc/06_tools_and_software/testfile.mdx
Amanda-dong 38a5098
Update 09_vscode_remote_ssh_torch.mdx
Amanda-dong ab9ef3d
Merge branch 'main' into jupyter-with-vscode-on-torch
Amanda-dong 2a47be3
Update 09_vscode_remote_ssh_torch.mdx
Amanda-dong ea0e496
Update headings for consistency in Jupyter notebook guide
Amanda-dong 1a4d130
Create 08_vscode.mdx
Amanda-dong b9bf809
Add files via upload
Amanda-dong 0c92872
Update 05_environment_variables.mdx
Amanda-dong ad71d0d
Update 08_vscode.mdx
Amanda-dong e85de50
Update 09_vscode_remote_ssh_torch.mdx
Amanda-dong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
docs/hpc/06_tools_and_software/09_vscode_remote_ssh_torch.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # Connect VSCode to Torch | ||
| This page introduces two ways to connect VSCode to Torch. | ||
|
|
||
| For most users, the recommended way to use a VSCode-like environment on Torch is `code-server` through Open OnDemand. This avoids the Microsoft device authentication prompts required by local VSCode Remote - SSH. | ||
|
|
||
| See [Use code-server on Torch through Open OnDemand](docs/hpc/09_ood/08_vscode.mdx) before using the local VSCode Remote - SSH workflow below. | ||
|
|
||
| Use the following steps only if you specifically need to connect from your local VSCode application. | ||
|
|
||
| ## Step 1: Configure Your SSH Client | ||
|
|
||
| Before using local VSCode Remote - SSH, configure your SSH client for Torch by following [Configuring your SSH client](docs/hpc/02_connecting_to_hpc/01_connecting_to_hpc.mdx). | ||
|
|
||
| ## Step 2: Connect | ||
| Install the VSCode Remote - SSH extension. | ||
|
|
||
| Configure Remote - SSH settings: | ||
| - Enable `Remote.SSH: Lockfiles In Tmp` | ||
| - Unable `Remote.SSH: Use Flock` | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| Because Torch requires Microsoft device authentication during SSH login, VSCode may time out before you finish entering the device code. If this happens, search for Remote.SSH: Connect Timeout and set it to 120. | ||
|
|
||
| Before connecting, open https://microsoft.com/devicelogin and keep it ready. In VSCode Remote Explorer, connect to the Torch login node: torch. When VSCode prompts for Microsoft device authentication, enter the code on the device login page. This may take a few attempts. VSCode may also prompt more than once during setup because it can open multiple SSH connections. | ||
|
|
||
| After authentication, VSCode may take a while to install or start the VSCode server on Torch. If the connection fails during this step, try connecting again. Once the server is installed successfully, future connections are usually more consistent. | ||
|
|
||
| Once connected, open a terminal in the VSCode remote session. The prompt should show that you are on a Torch login node, for example: | ||
| ```bash | ||
| [NetID@torch-login-... ~]$ | ||
| ``` | ||
|
|
||
|
|
||
54 changes: 54 additions & 0 deletions
54
docs/hpc/06_tools_and_software/10_use_jupyter_notebooks_in_vscode_on_torch.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| # Use Apptainer Jupyter Notebooks in VSCode on Torch | ||
|
|
||
| This page builds on the general VSCode access instructions in 09_vscode_remote_ssh_torch. Before following this workflow, complete that setup and connect VSCode to the Torch login node. | ||
|
|
||
| ## Step 1: Install VSCode Jupyter Support | ||
|
|
||
| After connecting VSCode to the Torch login node, open the Extensions view in the VSCode remote window and search for Jupyter. | ||
|
|
||
| Install or enable the Microsoft Jupyter extension in the remote SSH environment. If the extension is not already installed remotely, VSCode should show an option such as: | ||
|
|
||
| `Install in SSH: torch` | ||
|
|
||
| ## Step 2: Start a Dummy Batch Job and Connect to the Compute Node | ||
|
|
||
| After the Jupyter extension is installed or enabled, open a terminal in the VSCode remote session on a Torch login node. | ||
|
|
||
| Interactive jobs on Torch may experience intermittent issues. Some compute nodes may work as expected, while others may not. As a workaround, submit a lightweight dummy batch job and then ssh to the allocated compute node after the job is running. | ||
|
|
||
| For example: | ||
|
|
||
| ```bash | ||
| sbatch -c4 -t2:00:00 --mem=4G --account=<account_name> --wrap "sleep infinity" | ||
| ``` | ||
|
|
||
| Replace `<account_name>` with the account for your project. After submitting the job, Slurm will print a job ID, for example: | ||
|
|
||
| ```bash | ||
| Submitted batch job <job_id> | ||
| ``` | ||
|
|
||
| Once the job is running, identify the assigned compute node and connect to it from the VSCode terminal using SSH. | ||
| Check the job status and assigned node: | ||
| ```bash | ||
| squeue -u $USER | ||
| ``` | ||
|
|
||
| ```bash | ||
| ssh csXXX | ||
| ``` | ||
|
|
||
| After connecting, the terminal prompt should show the compute node: | ||
| ```bash | ||
| [NetID@csXXX ~]$ | ||
| ``` | ||
|
|
||
| ## Step 3: Open the Notebook | ||
|
|
||
| Open the target .ipynb notebook in VSCode. | ||
|
|
||
| ## Step 4: Select the Apptainer kernel | ||
|
|
||
| Use the notebook kernel picker to select the Apptainer kernel for the notebook. | ||
|
|
||
| If the Apptainer kernel does not appear, confirm that the kernel is installed and visible on Torch before retrying in VSCode. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # Use `code-server` on Torch through Open OnDemand | ||
|
|
||
| Torch provides `code-server` as an Open OnDemand interactive app that runs a VSCode-like editor in your web browser. | ||
|
|
||
| For most users who want a VSCode-like development environment on Torch, `code-server` is the recommended option. It avoids the Microsoft device authentication prompts required by local VSCode Remote - SSH. | ||
|
|
||
| ## Step 1: Launch the `code-server` App | ||
|
|
||
| From the Open OnDemand dashboard, open **Interactive Apps** from the top navigation bar and select **Code Server**. | ||
|
|
||
|  | ||
|
|
||
| Configure the session options for your work. For example, select the number of cores, memory, GPU type, Slurm account, working directory, and session duration. | ||
|
|
||
|  | ||
|
|
||
| Click **Launch**. Open OnDemand will submit a job for the `code-server` session. | ||
|
|
||
| ## Step 2: Connect to the `code-server` Session | ||
|
|
||
| After the job starts running, the session card will show the assigned host, session status, and remaining time. | ||
|
|
||
| Click `Connect to VS Code`. | ||
|
|
||
|  | ||
|
|
||
| This opens a VSCode-like editor in your browser. You can browse and edit files on Torch and use the terminal provided in the session. | ||
|
|
||
| ## Why Use `code-server` Instead of Local VSCode Remote - SSH? | ||
|
|
||
| Using `code-server` through Open OnDemand can be easier than using local VSCode Remote - SSH because authentication and job submission are handled through Open OnDemand. Users do not need to complete separate Microsoft device authentication prompts in VSCode, submit a dummy batch job manually, or connect to the assigned compute node from a local VSCode session. | ||
|
|
||
| If you specifically need to use the local VSCode desktop application, see [Connect VSCode to Torch](docs/hpc/06_tools_and_software/09_vscode_remote_ssh_torch.mdx). |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect list-item indent: add 2 spaces list-item-indent remark-lint