Skip to content

Commit fe3637d

Browse files
author
Prashanth Kanduri
committed
connect to vscode using a container
1 parent 37a4243 commit fe3637d

File tree

1 file changed

+36
-11
lines changed

1 file changed

+36
-11
lines changed

docs/access/vscode.md

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ After downloading, copy the `code` executable to a location in your PATH, so tha
4848
export PATH=$HOME/.local/$(uname -m)/bin:$PATH
4949
```
5050
The `uname -m` command will print `aarch64` or `x86_64`, according to the microarchitecture of the node it is run on.
51-
51+
5252
Then create the path, and copy the `code` executable to the architecture-specific path:
5353
```
5454
mkdir -p $HOME/.local/$(uname -m)/bin
@@ -82,9 +82,9 @@ Once you have finished registering the service with GitHub, in VSCode on your PC
8282
Tunnels
8383
Sign in to tunnels registered with GitHub
8484
```
85-
85+
8686
If you have not signed in to GitHub with VS Code editor, you will be redirected to the browser to sign in.
87-
87+
8888
After signing in and authorizing VSCode, the open tunnel should be visible under REMOTES (TUNNELS/SSH) -> Tunnels.
8989

9090
### Using with uenv
@@ -112,11 +112,6 @@ Once the tunnel is configured, you can access it from VSCode.
112112
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.
113113
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.
114114

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

122117
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 +127,7 @@ If you plan to do computation using your VSCode, then you should first allocate
132127
* `-t120` requests a 2 hour (120 minute) reservation
133128
* `-n1` requests a single rank - only one rank/process is required for VSCode
134129
* `--pty` allows forwarding of terminal I/O, required to sign in to Github
135-
130+
136131
Once the job allocation is granted, you will be prompted to log into GitHub, the same as starting a session on the login node.
137132
If you don't want to use a uenv, the command is even simpler:
138133
```
@@ -148,16 +143,46 @@ If you plan to do computation using your VSCode, then you should first allocate
148143

149144
# start an interactive shell session
150145
srun -t120 -n1 --pty bash
151-
146+
152147
# set up the environment before starting the tunnel
153148
uenv start prgenv-gnu/24.11:v1 --view=default
154149
code tunnel --name=$CLUSTER_NAME-tunnel
155150
```
156-
151+
157152
* `-t120` requests a 2 hour (120 minute) reservation
158153
* `-n1` requests a single rank - only one rank/process is required for VSCode
159154
* `--pty` allows forwarding of terminal I/O, for bash to work interactively
160155

156+
157+
158+
### Using with containers
159+
160+
This will use CSCS's custom **Container Engine** which can easily pull a container from a registry like DockerHub. Same setup process as earlier with GitHub.
161+
162+
#### TOML File with Image and Mount Paths
163+
164+
```toml
165+
image = "nvcr.io#nvidia/pytorch:24.01-py3" # example of PyTorch NGC image
166+
writable = true
167+
mounts = ["/paths/on/scratch/or/home:path/on/the/container",
168+
"/path/if/same/on/both"]
169+
workdir = "default/working/dir/path"
170+
```
171+
172+
#### Launch Container & Tunnel
173+
174+
```bash
175+
# launch container on compute node
176+
srun -N 1 --environment=/absolute/path/to/tomlfile.toml --pty bash
177+
178+
start tunnel
179+
180+
cd /path/to/code/executable
181+
./code tunnel --name=$CLUSTER_NAME-tunnel
182+
```
183+
184+
185+
161186
## Connecting via VSCode UI
162187

163188
!!! warning

0 commit comments

Comments
 (0)