-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
# cuSpatial Development Containers | ||
|
||
This directory contains [devcontainer configurations](https://containers.dev/implementors/json_reference/) for using VSCode to [develop in a container](https://code.visualstudio.com/docs/devcontainers/containers) via the `Remote Containers` [extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) or [GitHub Codespaces](https://github.com/codespaces). | ||
|
||
This container is a turnkey development environment for building and testing the cuSpatial C++ and Python libraries. | ||
|
||
## Table of Contents | ||
|
||
* [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 | ||
|
||
* [VSCode](https://code.visualstudio.com/download) | ||
* [VSCode Remote Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) | ||
|
||
## Host bind mounts | ||
|
||
By default, the following directories are bind-mounted into the devcontainer: | ||
|
||
* `${repo}:/home/coder/cuspatial` | ||
* `${repo}/../.aws:/home/coder/.aws` | ||
* `${repo}/../.local:/home/coder/.local` | ||
* `${repo}/../.cache:/home/coder/.cache` | ||
* `${repo}/../.conda:/home/coder/.conda` | ||
* `${repo}/../.config:/home/coder/.config` | ||
|
||
This ensures caches, configurations, dependencies, and your commits are persisted on the host across container runs. | ||
|
||
## 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 the container's file system. | ||
|
||
Use this mode to launch multiple isolated development containers that can be checked out to separate branches of `cuspatial`. | ||
|
||
**Be sure to push any commits you want to persist. Once this container is removed, any unpushed changes will be lost!** | ||
|
||
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 | ||
``` |