Skip to content

Commit 0e1bb09

Browse files
authored
connect to vscode using a container (#140)
1 parent 6d8e765 commit 0e1bb09

File tree

1 file changed

+43
-8
lines changed

1 file changed

+43
-8
lines changed

docs/access/vscode.md

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@ There are two ways to set up the connection:
1111
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.
1212
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.
1313

14+
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):
15+
16+
<iframe width="100%"
17+
height="315"
18+
src="https://www.youtube.com/embed/cLVpJO_fE6I?si=bTmmsS_9QvTHpUqK&amp;start=2257"
19+
title="YouTube video player"
20+
frameborder="0"
21+
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
22+
referrerpolicy="strict-origin-when-cross-origin"
23+
allowfullscreen>
24+
</iframe>
25+
1426
## Flexible method: remote server
1527

1628
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.
@@ -112,11 +124,6 @@ Once the tunnel is configured, you can access it from VSCode.
112124
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.
113125
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.
114126

115-
### Using with containers
116-
117-
!!! todo
118-
write a guide
119-
120127
### Running on a compute node
121128

122129
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.
@@ -158,10 +165,38 @@ If you plan to do computation using your VSCode, then you should first allocate
158165
* `-n1` requests a single rank - only one rank/process is required for VSCode
159166
* `--pty` allows forwarding of terminal I/O, for bash to work interactively
160167

168+
### Using with containers
169+
170+
This will use CSCS's **[Container Engine][ref-container-engine]**.
171+
Using this workflow, one can pull a container from a registry like DockerHub.
172+
Note that this process also requires that you have a GitHub account, with an authentication and authorization step as described earlier.
173+
174+
This will also use the Remote Tunnel extension and the VS Code connected to the GitHub account (see above).
175+
176+
```toml title="EDF file with image and mount paths"
177+
image = "nvcr.io#nvidia/pytorch:24.01-py3" # example of PyTorch NGC image
178+
writable = true
179+
mounts = ["/paths/on/scratch/or/home:path/on/the/container",
180+
"/path/if/same/on/both"
181+
"/path/of/code/executable:/path/for/code/executable/in/container"]
182+
workdir = "default/working/dir/path"
183+
```
184+
185+
!!! note
186+
Ensure that the `code` executable is accessible in the container.
187+
It can either be contained in the image, or in one of the mounted folders.
188+
189+
```bash title="Launch container and tunnel"
190+
# launch container on compute node
191+
srun -N 1 --environment=/absolute/path/to/tomlfile.toml --pty bash
192+
193+
start tunnel
194+
195+
cd path/for/code/executable/in/container
196+
./code tunnel --name=$CLUSTER_NAME-tunnel
197+
```
198+
161199
## Connecting via VSCode UI
162200

163201
!!! warning
164202
This approach is not recommended, because while it may be easier to connect via the VS Code UI, it is much more difficult to configure the connection so that you can use uenv, containers or compute nodes.
165-
166-
!!! todo
167-
Write the guide

0 commit comments

Comments
 (0)