-
Notifications
You must be signed in to change notification settings - Fork 41
connect to vscode using a container #140
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
fe3637d
connect to vscode using a container
94d1a31
address review comments with better process clarification
b114f67
add info about the recent webinar with video/slide link of the setup …
fecf3f7
tweak formatting
bcumming 2c08681
Merge branch 'main' into kanduri-patch-2
bcumming 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
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 |
|---|---|---|
|
|
@@ -11,6 +11,8 @@ There are two ways to set up the connection: | |
| The main challenge with using VSCode is that the most convenient method for starting a remote session is to start a remote tunnel from the VS Code GUI. | ||
| This approach starts a session in the standard login environment on that node, however this won't work if you want to be developing in a container, in a uenv, or on a compute node. | ||
|
|
||
| This process is also demonstrated in a webinar on [Interactive computing on "Alps"](https://www.cscs.ch/publications/tutorials/2025/video-of-the-webinar-interactive-computing-on-alps). Video and slides accessible. | ||
|
|
||
| ## Flexible method: remote server | ||
|
|
||
| The most flexible method for connecting VSCode is to log in to the Alps system, set up your environment (start a container or uenv, start a session on a compute node), and start the remote server in that environment pre-configured. | ||
|
|
@@ -82,9 +84,9 @@ Once you have finished registering the service with GitHub, in VSCode on your PC | |
| Tunnels | ||
| Sign in to tunnels registered with GitHub | ||
| ``` | ||
|
|
||
| If you have not signed in to GitHub with VS Code editor, you will be redirected to the browser to sign in. | ||
|
|
||
| After signing in and authorizing VSCode, the open tunnel should be visible under REMOTES (TUNNELS/SSH) -> Tunnels. | ||
|
|
||
| ### Using with uenv | ||
|
|
@@ -112,11 +114,6 @@ Once the tunnel is configured, you can access it from VSCode. | |
| If you plan to do any intensive work: repeated compilation of large projects or running python code in Jupyter, please see the guide to running on a compute node below. | ||
| Running intensive workloads on login nodes, which are shared resources between all users, is against CSCS [fair usage][ref-policies-fair-use] of Shared Resources policy. | ||
|
|
||
| ### Using with containers | ||
|
|
||
| !!! todo | ||
| write a guide | ||
|
|
||
| ### Running on a compute node | ||
|
|
||
| If you plan to do computation using your VSCode, then you should first allocate resources on a compute node and set up your environment there. | ||
|
|
@@ -132,7 +129,7 @@ If you plan to do computation using your VSCode, then you should first allocate | |
| * `-t120` requests a 2 hour (120 minute) reservation | ||
| * `-n1` requests a single rank - only one rank/process is required for VSCode | ||
| * `--pty` allows forwarding of terminal I/O, required to sign in to Github | ||
|
|
||
| Once the job allocation is granted, you will be prompted to log into GitHub, the same as starting a session on the login node. | ||
| If you don't want to use a uenv, the command is even simpler: | ||
| ``` | ||
|
|
@@ -148,16 +145,49 @@ If you plan to do computation using your VSCode, then you should first allocate | |
|
|
||
| # start an interactive shell session | ||
| srun -t120 -n1 --pty bash | ||
|
|
||
| # set up the environment before starting the tunnel | ||
| uenv start prgenv-gnu/24.11:v1 --view=default | ||
| code tunnel --name=$CLUSTER_NAME-tunnel | ||
| ``` | ||
|
|
||
| * `-t120` requests a 2 hour (120 minute) reservation | ||
| * `-n1` requests a single rank - only one rank/process is required for VSCode | ||
| * `--pty` allows forwarding of terminal I/O, for bash to work interactively | ||
|
|
||
|
|
||
|
|
||
| ### Using with containers | ||
|
|
||
| This will use CSCS's **[Container Engine][ref-container-engine]**. Using this workflow, one can pull a container from a registry like DockerHub. Note that this process also requires that you have a GitHub account, with an authentication and authorization step as described earlier. | ||
|
||
|
|
||
| This will also use the Remote Tunnel extension and the VS Code connected to the GitHub account (see above). | ||
|
|
||
| #### TOML File with Image and Mount Paths | ||
|
|
||
| ```toml | ||
| image = "nvcr.io#nvidia/pytorch:24.01-py3" # example of PyTorch NGC image | ||
| writable = true | ||
| mounts = ["/paths/on/scratch/or/home:path/on/the/container", | ||
| "/path/if/same/on/both" | ||
| "/path/of/code/executable:/path/for/code/executable/in/container"] | ||
| workdir = "default/working/dir/path" | ||
| ``` | ||
|
|
||
| Ensure that the `code` executable is accessible in the container. Either it can be contained in the image, or one of the mounted folders should contain it. | ||
|
|
||
| #### Launch Container & Tunnel | ||
|
|
||
| ```bash | ||
| # launch container on compute node | ||
| srun -N 1 --environment=/absolute/path/to/tomlfile.toml --pty bash | ||
|
|
||
| start tunnel | ||
|
|
||
| cd path/for/code/executable/in/container | ||
| ./code tunnel --name=$CLUSTER_NAME-tunnel | ||
| ``` | ||
|
|
||
| ## Connecting via VSCode UI | ||
|
|
||
| !!! warning | ||
|
|
||
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.
How about directly embedding the video, at the time stamp where VS Code is discussed?
Here is an example of embedding a video:
https://docs.cscs.ch/storage/longterm/#further-documentation
I think it should be enough to embed this: