Skip to content

Commit 3e14c27

Browse files
committed
make container running on non-gpu platforms, set default to cpu
1 parent 55e977e commit 3e14c27

File tree

3 files changed

+23
-17
lines changed

3 files changed

+23
-17
lines changed

.devcontainer/devcontainer.linux.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@
4747
"XAUTHORITY": "${localEnv:XAUTHORITY}"
4848
},
4949
"runArgs": [
50-
"--gpus=all",
5150
"--interactive",
5251
"--net=host",
5352
"--ipc=host",
54-
"--runtime=nvidia"
53+
// "--gpus=all", //use only with GPU
54+
// "--runtime=nvidia" //use only with GPU
5555
],
5656
"postCreateCommand": "python -m pip install -e '.[test,gpu]'",
5757
"remoteUser": "vscode"

.devcontainer/devcontainer.wsl2.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@
5555
"PULSE_SERVER": "${localEnv:PULSE_SERVER}" // WSL2
5656
},
5757
"runArgs": [
58-
"--gpus=all",
5958
"--interactive",
6059
"--net=host",
61-
"--ipc=host",
62-
"--runtime=nvidia"
60+
"--ipc=host"
61+
// "--gpus=all", //use only with GPU
62+
// "--runtime=nvidia" //use only with GPU
6363
],
6464
"postCreateCommand": "python -m pip install -e '.[test,gpu]'",
6565
"remoteUser": "vscode"

README.md

+18-12
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,31 @@
1-
### Using the project with vscode devcontainer
1+
### Using the project with VSCode devcontainers
2+
3+
**Running on CPU**: by default the containers run on CPU. You don't need to take any action.
4+
5+
**Running on GPU**: The devcontsainers can easily run using your computer's NVIDIA GPU on Linux and Windows. In order to work you need to install the [CUDA Toolkit](https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&Distribution=WSL-Ubuntu&target_version=2.0&target_type=deb_local), [NVIDIA Container runtime](https://developer.nvidia.com/container-runtime) for your computer. Finally, enable GPU access to the devcontainers by setting the commented out `"--gpus=all"` and `"--runtime=nvidia"` flags in `devcontainer.json`.
6+
7+
28
**Linux**
39

4-
0. Install docker: https://docs.docker.com/engine/install/ (, and make sure docker daemon is running)
5-
2. Install [vscode](https://code.visualstudio.com/), with [devcontainer extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers), and [remote dev pack](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker).
10+
1. Install [Docker](https://docs.docker.com/engine/install/) (, and make sure Docker Daemon is running)
11+
2. Install [VSCode](https://code.visualstudio.com/), with [devcontainer extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers), and [remote dev pack](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker).
612
3. Clone this project's code. Rename `/.devcontainer/devcontainer.linux.json` to `/.devcontainer/devcontainer.json`.
7-
4. Open this project in vscode. Vscode should automatically detect the devcontainer and prompt you to `Reopen in container`. If not, see [here](https://code.visualstudio.com/docs/devcontainers/containers#_quick-start-open-an-existing-folder-in-a-container). Note: Opening the container for the first time might take a while (up to 10mins), as the container is pulled from the web and build.
13+
4. Open this project in VSCode. VSCode should automatically detect the devcontainer and prompt you to `Reopen in container`. If not, see [here](https://code.visualstudio.com/docs/devcontainers/containers#_quick-start-open-an-existing-folder-in-a-container) to open manually. Note: Opening the container for the first time might take a while (up to 15 min), as the container is pulled from the web and build.
814

915
**Windows** (requires Windows 10 or later)
1016

11-
For windows, we require WSL2 to run the devcontainer. Full instructions can be found [in the official docs](https://code.visualstudio.com/blogs/2020/07/01/containers-wsl#_getting-started). Here are the important steps:
12-
1. Install docker: https://docs.docker.com/desktop/setup/install/windows-install/, and WSL2, and Ubuntu 22.04 LTS (, and make sure docker daemon is running)
13-
2. Docker will recognize that you have WSL installed and prompt you via Windows Notifications to enable WSL integration -> confirm with `Enable WSL integration`. If not, open `Docker Desktop`, navigate to the settings, and manually enable WSL integration. (There are TWO setting options for this. Make sure to enable both!)
14-
3. Install [vscode](https://code.visualstudio.com/), with the [WSL extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-wsl), [devcontainer extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers), and [remote dev pack](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker).
15-
4. Clone the source code for the exercises in the WSL2 file system to `/home` (`~`), or wherever you like. (Performance when working on the WSL file system is much better compared to Windows filesystem). You can access the WSL filesystem either by starting a WSL/Ubuntu console, or via the Windows File Explorer at `\\wsl.localhost\Ubuntu\home` (replace `Ubuntu` with your distro, if necessary).
17+
For windows, we require WSL2 to run the devcontainer. (So its actually Linux with extra steps.) Full instructions can be found [in the official docs](https://code.visualstudio.com/blogs/2020/07/01/containers-wsl#_getting-started). Here are the important steps:
18+
1. Install [Docker](https://docs.docker.com/desktop/setup/install/windows-install/), and WSL2, and Ubuntu 22.04 LTS (, and make sure Docker Daemon is running)
19+
2. Docker will recognize that you have WSL installed and prompt you via Windows Notifications to enable WSL integration -> confirm this with `Enable WSL integration`. If not, open `Docker Desktop`, navigate to the settings, and manually enable WSL integration. (There are TWO setting options for this. Make sure to enable BOTH!)
20+
3. Install [VSCode](https://code.visualstudio.com/), with the [WSL extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-wsl), [devcontainer extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers), and [remote dev pack](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker).
21+
4. Clone the source code for the exercises in the WSL2 file system to `/home` (`~`), or wherever you like. (Performance when working on the WSL file system is much better compared to Windows file system). You can access the WSL filesystem either by starting a WSL/Ubuntu console, or via the Windows File Explorer at `\\wsl.localhost\Ubuntu\home` (replace `Ubuntu` with your distro, if necessary).
1622
7. Rename `/.devcontainer/devcontainer.windows.json` to `/.devcontainer/devcontainer.json`.
17-
8. Open this project in vscode. The easiest way to do so is to start an WSL/Ubuntu shell, navigate via `cd` to the source code, then type `code .` to open VSCode. Vscode should automatically detect the devcontainer and prompt you to `Reopen in container`. If not, [here](https://code.visualstudio.com/docs/devcontainers/containers#_quick-start-open-an-existing-folder-in-a-container). Note: Opening the container for the first time might take a while (up to 10mins), as the container is pulled from the web and build.
23+
8. Open this project in VSCode. The easiest way to do so is by starting a WSL/Ubuntu shell, navigating via `cd` to the source code, then type `code .` to open VSCode. VSCode should automatically detect the devcontainer and prompt you to `Reopen in container`. If not, see [here](https://code.visualstudio.com/docs/devcontainers/containers#_quick-start-open-an-existing-folder-in-a-container) to open manually. Note: Opening the container for the first time might take a while (up to 15 min), as the container is pulled from the web and build.
1824

1925

20-
**Mac**
26+
**MacOS**
2127

22-
Should work like Ubuntu. Untested.
28+
Should work like Linux. Untested.
2329

2430
____________
2531

0 commit comments

Comments
 (0)