Skip to content
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

Add Dev Containers guide for WSL #1394

Merged
merged 6 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 83 additions & 3 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@

# CCCL Dev Containers

CCCL uses [Development Containers](https://containers.dev/) to provide consistent and convenient development environments for both local development and for CI. This guide covers setup in [Visual Studio Code](#quickstart-vscode-recommended) and [Docker](#quickstart-docker-manual-approach).
CCCL uses [Development Containers](https://containers.dev/) to provide consistent and convenient development environments for both local development and for CI. This guide covers setup in [Visual Studio Code](#quickstart-vscode-recommended) and [Docker](#quickstart-docker-manual-approach). The guide also provides additional instructions in case you want use WSL.

## Quickstart: VSCode (Recommended)
## Table of Contents
1. [Quickstart: VSCode (Recommended)](#vscode)
2. [Quickstart: Docker (Manual Approach)](#docker)
3. [Quickstart: Using WSL](#wsl)

## Quickstart: VSCode (Recommended) <a name="vscode"></a>

### Prerequisites
- [Visual Studio Code](https://code.visualstudio.com/)
Expand Down Expand Up @@ -55,7 +60,7 @@ To manually trigger this authentication, execute the `devcontainer-utils-vault-s

For more information about the sccache configuration and authentication, see the documentation at [`rapidsai/devcontainers`](https://github.com/rapidsai/devcontainers/blob/branch-23.10/USAGE.md#build-caching-with-sccache).

## Quickstart: Docker (Manual Approach)
## Quickstart: Docker (Manual Approach) <a name="docker"></a>

### Prerequisites
- [Docker](https://docs.docker.com/desktop/install/linux-install/)
Expand Down Expand Up @@ -116,3 +121,78 @@ Click the badge above or [click here](https://codespaces.new/NVIDIA/cccl?quickst
For more information, see the `.devcontainer/make_devcontainers.sh --help` message.

**Note**: When adding or updating supported environments, modify `matrix.yaml` and then rerun this script to synchronize the `devcontainer` configurations.

## Quickstart: Using WSL <a name="wsl"></a>

> [!NOTE]
> _Make sure you have the Nvidia driver installed on your Windows host before moving further_. Type in `nvidia-smi` for verification.

### Install WSL on your Windows host

> [!WARNING]
> Dsiclaimer: This guide was developed for WSL 2 on Windows 11.

1. Launch a Windows terminal (_e.g. Powershell_) as an administrator.

2. Install WSL 2 by running:
```bash
wsl --install
```
This should probably install Ubuntu distro as a default.

3. Restart your computer and run `wsl -l -v` on a Windows terminal to verify installation.

<h3 id="prereqs"> Install prerequisites and VS Code extensions</h3>

4. Launch your WSL/Ubuntu terminal by running `wsl` in Powershell.

5. Install the [WSL extension](ms-vscode-remote.remote-wsl) on VS Code.

- `Ctrl + Shift + P` and select `WSL: Connect to WSL` (it will prompt you to install the WSL extension).

- Make sure you are connected to WSL with VS Code by checking the bottom left corner of the VS Code window (should indicate "WSL: Ubuntu" in our case).

6. Install the [Dev Containers extension](ms-vscode-remote.remote-containers) on VS Code.

- In a vanilla system you should be prompted to install `Docker` at this point, accept it. If it hangs you might have to restart VS Code after that.

7. Install the [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html). **Make sure you install the WSL 2 version and not the native Linux one**. This builds on top of Docker so make sure you have Docker properly installed (run `docker --version`).

8. Open `/etc/docker/daemon.json` from within your WSL system (if the file does not exist, create it) and add the following:

```json
{
"runtimes": {
"nvidia": {
"path": "nvidia-container-runtime",
"runtimeArgs": []
}
}
}
```

then run `sudo systemctl restart docker.service`.

---
### Build CCCL in WSL using Dev Containers

9. Still on your WSL terminal run `git clone https://github.com/NVIDIA/cccl.git`


10. Open the CCCL cloned repo in VS Code ( `Ctrl + Shift + P `, select `File: Open Folder...` and select the path where your CCCL clone is located).

11. If prompted, choose `Reopen in Container`.

- If you are not prompted just type `Ctrl + Shift + P` and `Dev Containers: Open Folder in Container ...`.

12. Verify that Dev Container was configured properly by running `nvidia-smi` in your Dev Container terminal. For a proper configuration it is important for the steps in [Install prerequisites and VS Code extensions](#prereqs) to be followed in a precise order.

From that point on, the guide aligns with our [existing Dev Containers native Linux guide](https://github.com/NVIDIA/cccl/blob/main/.devcontainer/README.md) with just one minor potential alteration:

13. If WSL was launched without the X-server enabled, when asked to "authenticate Git with your Github credentials", if you answer **Yes**, the browser might not open automatically, with the following error message.

> Failed opening a web browser at https://github.com/login/device
exec: "xdg-open,x-www-browser,www-browser,wslview": executable file not found in $PATH
Please try entering the URL in your browser manually

In that case type in the address manually in your web browser https://github.com/login/device and fill in the one-time code.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From a random 1st time user/installer, these instructions worked well for me.
Thanks

2 changes: 1 addition & 1 deletion .devcontainer/cuda11.1-gcc6/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"shutdownAction": "stopContainer",
"image": "rapidsai/devcontainers:24.04-cpp-gcc6-cuda11.1-ubuntu18.04",
"hostRequirements": {
"gpu": true
"gpu": "optional"
},
"initializeCommand": [
"/bin/bash",
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/cuda11.1-gcc7/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"shutdownAction": "stopContainer",
"image": "rapidsai/devcontainers:24.04-cpp-gcc7-cuda11.1-ubuntu18.04",
"hostRequirements": {
"gpu": true
"gpu": "optional"
},
"initializeCommand": [
"/bin/bash",
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/cuda11.1-gcc8/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"shutdownAction": "stopContainer",
"image": "rapidsai/devcontainers:24.04-cpp-gcc8-cuda11.1-ubuntu18.04",
"hostRequirements": {
"gpu": true
"gpu": "optional"
},
"initializeCommand": [
"/bin/bash",
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/cuda11.1-gcc9/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"shutdownAction": "stopContainer",
"image": "rapidsai/devcontainers:24.04-cpp-gcc9-cuda11.1-ubuntu18.04",
"hostRequirements": {
"gpu": true
"gpu": "optional"
},
"initializeCommand": [
"/bin/bash",
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/cuda11.1-llvm9/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"shutdownAction": "stopContainer",
"image": "rapidsai/devcontainers:24.04-cpp-llvm9-cuda11.1-ubuntu18.04",
"hostRequirements": {
"gpu": true
"gpu": "optional"
},
"initializeCommand": [
"/bin/bash",
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/cuda11.8-gcc11/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"shutdownAction": "stopContainer",
"image": "rapidsai/devcontainers:24.04-cpp-gcc11-cuda11.8-ubuntu22.04",
"hostRequirements": {
"gpu": true
"gpu": "optional"
},
"initializeCommand": [
"/bin/bash",
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/cuda12.3-gcc10/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"shutdownAction": "stopContainer",
"image": "rapidsai/devcontainers:24.04-cpp-gcc10-cuda12.3-ubuntu20.04",
"hostRequirements": {
"gpu": true
"gpu": "optional"
},
"initializeCommand": [
"/bin/bash",
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/cuda12.3-gcc11/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"shutdownAction": "stopContainer",
"image": "rapidsai/devcontainers:24.04-cpp-gcc11-cuda12.3-ubuntu22.04",
"hostRequirements": {
"gpu": true
"gpu": "optional"
},
"initializeCommand": [
"/bin/bash",
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/cuda12.3-gcc12/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"shutdownAction": "stopContainer",
"image": "rapidsai/devcontainers:24.04-cpp-gcc12-cuda12.3-ubuntu22.04",
"hostRequirements": {
"gpu": true
"gpu": "optional"
},
"initializeCommand": [
"/bin/bash",
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/cuda12.3-gcc7/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"shutdownAction": "stopContainer",
"image": "rapidsai/devcontainers:24.04-cpp-gcc7-cuda12.3-ubuntu20.04",
"hostRequirements": {
"gpu": true
"gpu": "optional"
},
"initializeCommand": [
"/bin/bash",
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/cuda12.3-gcc8/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"shutdownAction": "stopContainer",
"image": "rapidsai/devcontainers:24.04-cpp-gcc8-cuda12.3-ubuntu20.04",
"hostRequirements": {
"gpu": true
"gpu": "optional"
},
"initializeCommand": [
"/bin/bash",
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/cuda12.3-gcc9/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"shutdownAction": "stopContainer",
"image": "rapidsai/devcontainers:24.04-cpp-gcc9-cuda12.3-ubuntu20.04",
"hostRequirements": {
"gpu": true
"gpu": "optional"
},
"initializeCommand": [
"/bin/bash",
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/cuda12.3-llvm10/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"shutdownAction": "stopContainer",
"image": "rapidsai/devcontainers:24.04-cpp-llvm10-cuda12.3-ubuntu20.04",
"hostRequirements": {
"gpu": true
"gpu": "optional"
},
"initializeCommand": [
"/bin/bash",
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/cuda12.3-llvm11/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"shutdownAction": "stopContainer",
"image": "rapidsai/devcontainers:24.04-cpp-llvm11-cuda12.3-ubuntu20.04",
"hostRequirements": {
"gpu": true
"gpu": "optional"
},
"initializeCommand": [
"/bin/bash",
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/cuda12.3-llvm12/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"shutdownAction": "stopContainer",
"image": "rapidsai/devcontainers:24.04-cpp-llvm12-cuda12.3-ubuntu20.04",
"hostRequirements": {
"gpu": true
"gpu": "optional"
},
"initializeCommand": [
"/bin/bash",
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/cuda12.3-llvm13/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"shutdownAction": "stopContainer",
"image": "rapidsai/devcontainers:24.04-cpp-llvm13-cuda12.3-ubuntu20.04",
"hostRequirements": {
"gpu": true
"gpu": "optional"
},
"initializeCommand": [
"/bin/bash",
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/cuda12.3-llvm14/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"shutdownAction": "stopContainer",
"image": "rapidsai/devcontainers:24.04-cpp-llvm14-cuda12.3-ubuntu20.04",
"hostRequirements": {
"gpu": true
"gpu": "optional"
},
"initializeCommand": [
"/bin/bash",
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/cuda12.3-llvm15/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"shutdownAction": "stopContainer",
"image": "rapidsai/devcontainers:24.04-cpp-llvm15-cuda12.3-ubuntu22.04",
"hostRequirements": {
"gpu": true
"gpu": "optional"
},
"initializeCommand": [
"/bin/bash",
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/cuda12.3-llvm16/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"shutdownAction": "stopContainer",
"image": "rapidsai/devcontainers:24.04-cpp-llvm16-cuda12.3-ubuntu22.04",
"hostRequirements": {
"gpu": true
"gpu": "optional"
},
"initializeCommand": [
"/bin/bash",
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/cuda12.3-llvm9/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"shutdownAction": "stopContainer",
"image": "rapidsai/devcontainers:24.04-cpp-llvm9-cuda12.3-ubuntu20.04",
"hostRequirements": {
"gpu": true
"gpu": "optional"
},
"initializeCommand": [
"/bin/bash",
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/cuda12.3-oneapi2023.2.0/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"shutdownAction": "stopContainer",
"image": "rapidsai/devcontainers:24.04-cpp-oneapi2023.2.0-cuda12.3-ubuntu22.04",
"hostRequirements": {
"gpu": true
"gpu": "optional"
},
"initializeCommand": [
"/bin/bash",
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"shutdownAction": "stopContainer",
"image": "rapidsai/devcontainers:24.04-cpp-gcc12-cuda12.3-ubuntu22.04",
"hostRequirements": {
"gpu": true
"gpu": "optional"
},
"initializeCommand": [
"/bin/bash",
Expand Down
Loading