Skip to content

Commit

Permalink
Update devcontainers to align with other RAPIDS repositories (#1263)
Browse files Browse the repository at this point in the history
Removes the unified and isolated devcontainers in favor of just the single one. The unified devcontainers are [still available](https://github.com/rapidsai/devcontainers/blob/d970ac17a894f5d1047fcfd17cffa6d14fe66ec8/.devcontainer/cuda12.0-conda/devcontainer.json#L23-L31) in the [`rapidsai/devcontainers`](https://github.com/rapidsai/devcontainers) repository.


Adds an optional job to the `pr.yaml` to [build the cuGraph libs in each devcontainer](https://github.com/trxcllnt/cuspatial/blob/fea/devcontainers/.github/workflows/pr.yaml#L106-L111), so the build caches are populated for devs by CI.

Other PRs:

* rapidsai/rmm#1328
* rapidsai/kvikio#273
* rapidsai/cudf#14015
* rapidsai/raft#1791
* rapidsai/cumlprims_mg#149
* rapidsai/cuml#5568
* rapidsai/cugraph-ops#538
* rapidsai/cugraph#3838

Authors:
  - Paul Taylor (https://github.com/trxcllnt)
  - H. Thomson Comer (https://github.com/thomcom)

Approvers:
  - Mark Harris (https://github.com/harrism)
  - Jake Awe (https://github.com/AyodeAwe)

URL: #1263
  • Loading branch information
trxcllnt authored Sep 25, 2023
1 parent b063e08 commit 73412e6
Show file tree
Hide file tree
Showing 23 changed files with 344 additions and 935 deletions.
20 changes: 11 additions & 9 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
# syntax=docker/dockerfile:1.5

ARG CUDA=12.0
ARG LLVM=16
ARG RAPIDS=23.08
ARG DISTRO=ubuntu22.04
ARG REPO=rapidsai/devcontainers

ARG BASE
ARG PYTHON_PACKAGE_MANAGER=conda

FROM ${REPO}:${RAPIDS}-cpp-llvm${LLVM}-cuda${CUDA}-${DISTRO} as pip-base
FROM ${BASE} as pip-base

ENV DEFAULT_VIRTUAL_ENV=rapids

RUN apt update -y \
&& DEBIAN_FRONTEND=noninteractive apt install -y \
sqlite3 libsqlite3-dev libtiff-dev libcurl4-openssl-dev \
&& rm -rf /tmp/* /var/tmp/* /var/cache/apt/* /var/lib/apt/lists/*;

FROM ${REPO}:${RAPIDS}-cpp-mambaforge-${DISTRO} as conda-base
FROM ${BASE} as conda-base

COPY --from=pip-base /etc/skel/.config/clangd/config.yaml /etc/skel/.config/clangd/config.yaml
ENV DEFAULT_CONDA_ENV=rapids

FROM ${PYTHON_PACKAGE_MANAGER}-base

Expand Down
75 changes: 0 additions & 75 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ This container is a turnkey development environment for building and testing the
* [Prerequisites](#prerequisites)
* [Host bind mounts](#host-bind-mounts)
* [Launch a Dev Container](#launch-a-dev-container)
* [via VSCode](#via-vscode)
* [via `launch.sh`](#via-launchsh)
* [Single mode](#single-mode)
* [Unified mode](#unified-mode)
* [Isolated mode](#isolated-mode)

## Prerequisites

Expand All @@ -35,76 +30,6 @@ This ensures caches, configurations, dependencies, and your commits are persiste

## Launch a Dev Container

A devcontainer can be launched directly by VSCode, or via a custom `launch.sh` shell script.

### via VSCode

To launch a devcontainer from VSCode, open the cuSpatial repo and select the "Reopen in Container" button in the bottom right:<br/><img src="https://user-images.githubusercontent.com/178183/221771999-97ab29d5-e718-4e5f-b32f-2cdd51bba25c.png"/>

Alternatively, open the VSCode command palette (typically `cmd/ctrl + shift + P`) and run the "Rebuild and Reopen in Container" command.

### via `launch.sh`

Use the `.devcontainer/launch.sh` script to start a new instance of the development container and launch a fresh VSCode window connected to it.

VSCode extends its [single-window-per-folder](https://github.com/microsoft/vscode/issues/2686) process model to devcontainers. Opening the same devcontainer in separate windows doesn't create two separate containers -- instead you have two VSCode windows each connected to the same running container.

`launch.sh` takes two arguments, a `mode` and a `package manager`.

* The `mode` argument determines how the devcontainer interacts with the files on the host.
* The `package manager` argument can be either `conda`, or `pip`. This determines whether the devcontainer uses `conda` or `pip` to install the dependencies (the default is `conda`). `pip` is experimental/not working for normal dev, and is currently meant to aid in pip packaging work.

#### Single mode

`.devcontainer/launch.sh single` launches the devcontainer with the [default bind mounts](#host-bind-mounts). RMM and cuDF are installed via the package manager.

Example:
```bash
# Launch a devcontainer that only mounts cuspatial and installs dependencies via conda
$ .devcontainer/launch.sh single conda

# or installs dependencies via pip
$ .devcontainer/launch.sh single pip
```

#### Unified mode

`.devcontainer/launch.sh unified` launches the devcontainer with the [default bind mounts](#host-bind-mounts), as well as additional `rmm` and `cudf` bind mounts (assumes RMM and cuDF are siblings to the cuspatial repository):

* `${repo}/../.rmm:/home/coder/rmm`
* `${repo}/../.cudf:/home/coder/cudf`

In this mode, RMM and cuDF will not be installed, but the devcontainer will install the dependencies necessary to build all three.

Example:
```bash
# Launch a devcontainer that mounts rmm, cudf, and cuspatial from the host and installs dependencies via conda
$ .devcontainer/launch.sh unified conda

# or installs dependencies via pip
$ .devcontainer/launch.sh unified pip
```

#### Isolated mode

`.devcontainer/launch.sh isolated` launches the devcontainer without the deps/repo bind mounts, and instead contains a unique copy of the `cuspatial` source in a Docker [volume](https://docs.docker.com/storage/volumes/).

Use this mode to launch multiple isolated development containers that can be checked out to separate branches of `cuspatial`.

The Docker volume persists after the devcontainer is removed, ensuring you don't pending lose work by accidentally removing the devcontainer.

However, you will need to manually remove the volume once you've committed and pushed your changes:

* Use the [`docker volume ls`](https://docs.docker.com/engine/reference/commandline/volume_ls/) command to list all volumes
* Use [`docker volume rm`](https://docs.docker.com/engine/reference/commandline/volume_rm/) or [`docker volume prune`](https://docs.docker.com/engine/reference/commandline/volume_prune/) to clean up unused volumes

Alternatively, use the "Dev Volumes" tab of the VSCode Dev Containers extension to view and remove unused volumes.

Examples:
```bash
# Launch a devcontainer that is isolated from changes on the host and installs dependencies via conda
$ .devcontainer/launch.sh isolated conda

# or installs dependencies via pip
$ .devcontainer/launch.sh isolated pip
```
93 changes: 0 additions & 93 deletions .devcontainer/conda/isolated/.devcontainer/devcontainer.json

This file was deleted.

95 changes: 0 additions & 95 deletions .devcontainer/conda/single/.devcontainer/devcontainer.json

This file was deleted.

Loading

0 comments on commit 73412e6

Please sign in to comment.