-
Notifications
You must be signed in to change notification settings - Fork 309
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR adds some [devcontainers](https://containers.dev/) to help simplify building the cuGraph C++ and Python libraries. It also adds an optional job to the `pr.yaml` to [build the cuGraph libs in each devcontainer](https://github.com/trxcllnt/cugraph/blob/fea/devcontainers/.github/workflows/pr.yaml#L113-L119), so the build caches are populated for devs by CI. A devcontainer can be launched by clicking the "Reopen in Container" button that VSCode shows when opening the repo (or by using the "Rebuild and Reopen in Container" command from the command palette): ![image](https://user-images.githubusercontent.com/178183/221771999-97ab29d5-e718-4e5f-b32f-2cdd51bba25c.png) Clicking this button will cause VSCode to prompt the user to select one of these devcontainer variants: ![image](https://github.com/rapidsai/rmm/assets/178183/68d4b264-4fc2-4008-92b6-cb4bdd19b29f) On startup, the devcontainer creates or updates the conda/pip environment using `cugraph/dependencies.yaml`. The envs/package caches are cached on the host via volume mounts, which are described in more detail in [`.devcontainer/README.md`](https://github.com/trxcllnt/cugraph/blob/fea/devcontainers/.devcontainer/README.md). The container includes convenience functions to clean, configure, and build the various cuGraph components: ```shell $ clean-cugraph-cpp # only cleans the C++ build dir $ clean-cugraph-python # only cleans the Python build dir $ clean-cugraph # cleans both C++ and Python build dirs $ configure-cugraph-cpp # only configures cugraph C++ lib $ build-cugraph-cpp # only builds cugraph C++ lib $ build-cugraph-python # only builds cugraph Python lib $ build-cugraph # builds both C++ and Python libs ``` * The C++ build script is a small wrapper around `cmake -S ~/cugraph/cpp -B ~/cugraph/cpp/build` and `cmake --build ~/cugraph/cpp/build` * The Python build script is a small wrapper around `pip install --editable ~/cugraph/cpp` Unlike `build.sh`, these convenience scripts *don't* install the libraries after building them. Instead, they automatically inject the correct arguments to build the C++ libraries from source and use their build dirs as package roots: ```shell $ cmake -S ~/cugraph/cpp -B ~/cugraph/cpp/build $ CMAKE_ARGS="-Dcugraph_ROOT=~/cugraph/cpp/build" \ # <-- this argument is automatic pip install -e ~/cugraph/cpp ``` Authors: - Paul Taylor (https://github.com/trxcllnt) Approvers: - Chuck Hastings (https://github.com/ChuckHastings) - Jake Awe (https://github.com/AyodeAwe) URL: #3838
- Loading branch information
Showing
13 changed files
with
527 additions
and
41 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,33 @@ | ||
# syntax=docker/dockerfile:1.5 | ||
|
||
ARG BASE | ||
ARG PYTHON_PACKAGE_MANAGER=conda | ||
|
||
FROM ${BASE} as pip-base | ||
|
||
ENV DEFAULT_VIRTUAL_ENV=rapids | ||
|
||
FROM ${BASE} as conda-base | ||
|
||
ENV DEFAULT_CONDA_ENV=rapids | ||
|
||
FROM ${PYTHON_PACKAGE_MANAGER}-base | ||
|
||
ARG CUDA | ||
ENV CUDAARCHS="RAPIDS" | ||
ENV CUDA_VERSION="${CUDA_VERSION:-${CUDA}}" | ||
|
||
ARG PYTHON_PACKAGE_MANAGER | ||
ENV PYTHON_PACKAGE_MANAGER="${PYTHON_PACKAGE_MANAGER}" | ||
|
||
ENV PYTHONSAFEPATH="1" | ||
ENV PYTHONUNBUFFERED="1" | ||
ENV PYTHONDONTWRITEBYTECODE="1" | ||
|
||
ENV SCCACHE_REGION="us-east-2" | ||
ENV SCCACHE_BUCKET="rapids-sccache-devs" | ||
ENV VAULT_HOST="https://vault.ops.k8s.rapids.ai" | ||
ENV HISTFILE="/home/coder/.cache/._bash_history" | ||
|
||
# cugraph_pyg's setup.py needs this defined when building in a conda env | ||
ENV CUDA_HOME="${CUDA_HOME:-/home/coder/.conda/envs/$DEFAULT_CONDA_ENV}" |
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,34 @@ | ||
# cuGraph 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 cuGraph C++ and Python libraries. | ||
|
||
## Table of Contents | ||
|
||
* [Prerequisites](#prerequisites) | ||
* [Host bind mounts](#host-bind-mounts) | ||
* [Launch a Dev Container](#launch-a-dev-container) | ||
## 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/cugraph` | ||
* `${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 | ||
|
||
To launch a devcontainer from VSCode, open the cuGraph 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. |
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,37 @@ | ||
{ | ||
"build": { | ||
"context": "${localWorkspaceFolder}/.devcontainer", | ||
"dockerfile": "${localWorkspaceFolder}/.devcontainer/Dockerfile", | ||
"args": { | ||
"CUDA": "11.8", | ||
"PYTHON_PACKAGE_MANAGER": "conda", | ||
"BASE": "rapidsai/devcontainers:23.10-cpp-llvm16-cuda11.8-mambaforge-ubuntu22.04" | ||
} | ||
}, | ||
"hostRequirements": {"gpu": "optional"}, | ||
"features": { | ||
"ghcr.io/rapidsai/devcontainers/features/rapids-build-utils:23.10": {} | ||
}, | ||
"overrideFeatureInstallOrder": [ | ||
"ghcr.io/rapidsai/devcontainers/features/rapids-build-utils" | ||
], | ||
"initializeCommand": ["/bin/bash", "-c", "mkdir -m 0755 -p ${localWorkspaceFolder}/../.{aws,cache,config,conda/pkgs,conda/${localWorkspaceFolderBasename}-cuda11.8-envs}"], | ||
"postAttachCommand": ["/bin/bash", "-c", "if [ ${CODESPACES:-false} = 'true' ]; then . devcontainer-utils-post-attach-command; . rapids-post-attach-command; fi"], | ||
"workspaceFolder": "/home/coder", | ||
"workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/cugraph,type=bind,consistency=consistent", | ||
"mounts": [ | ||
"source=${localWorkspaceFolder}/../.aws,target=/home/coder/.aws,type=bind,consistency=consistent", | ||
"source=${localWorkspaceFolder}/../.cache,target=/home/coder/.cache,type=bind,consistency=consistent", | ||
"source=${localWorkspaceFolder}/../.config,target=/home/coder/.config,type=bind,consistency=consistent", | ||
"source=${localWorkspaceFolder}/../.conda/pkgs,target=/home/coder/.conda/pkgs,type=bind,consistency=consistent", | ||
"source=${localWorkspaceFolder}/../.conda/${localWorkspaceFolderBasename}-cuda11.8-envs,target=/home/coder/.conda/envs,type=bind,consistency=consistent" | ||
], | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"ms-python.flake8", | ||
"nvidia.nsight-vscode-edition" | ||
] | ||
} | ||
} | ||
} |
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,37 @@ | ||
{ | ||
"build": { | ||
"context": "${localWorkspaceFolder}/.devcontainer", | ||
"dockerfile": "${localWorkspaceFolder}/.devcontainer/Dockerfile", | ||
"args": { | ||
"CUDA": "11.8", | ||
"PYTHON_PACKAGE_MANAGER": "pip", | ||
"BASE": "rapidsai/devcontainers:23.10-cpp-llvm16-cuda11.8-ubuntu22.04" | ||
} | ||
}, | ||
"hostRequirements": {"gpu": "optional"}, | ||
"features": { | ||
"ghcr.io/rapidsai/devcontainers/features/ucx:23.10": {"version": "1.14.1"}, | ||
"ghcr.io/rapidsai/devcontainers/features/rapids-build-utils:23.10": {} | ||
}, | ||
"overrideFeatureInstallOrder": [ | ||
"ghcr.io/rapidsai/devcontainers/features/rapids-build-utils" | ||
], | ||
"initializeCommand": ["/bin/bash", "-c", "mkdir -m 0755 -p ${localWorkspaceFolder}/../.{aws,cache,config/pip,local/share/${localWorkspaceFolderBasename}-cuda11.8-venvs}"], | ||
"postAttachCommand": ["/bin/bash", "-c", "if [ ${CODESPACES:-false} = 'true' ]; then . devcontainer-utils-post-attach-command; . rapids-post-attach-command; fi"], | ||
"workspaceFolder": "/home/coder", | ||
"workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/cugraph,type=bind,consistency=consistent", | ||
"mounts": [ | ||
"source=${localWorkspaceFolder}/../.aws,target=/home/coder/.aws,type=bind,consistency=consistent", | ||
"source=${localWorkspaceFolder}/../.cache,target=/home/coder/.cache,type=bind,consistency=consistent", | ||
"source=${localWorkspaceFolder}/../.config,target=/home/coder/.config,type=bind,consistency=consistent", | ||
"source=${localWorkspaceFolder}/../.local/share/${localWorkspaceFolderBasename}-cuda11.8-venvs,target=/home/coder/.local/share/venvs,type=bind,consistency=consistent" | ||
], | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"ms-python.flake8", | ||
"nvidia.nsight-vscode-edition" | ||
] | ||
} | ||
} | ||
} |
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,37 @@ | ||
{ | ||
"build": { | ||
"context": "${localWorkspaceFolder}/.devcontainer", | ||
"dockerfile": "${localWorkspaceFolder}/.devcontainer/Dockerfile", | ||
"args": { | ||
"CUDA": "12.0", | ||
"PYTHON_PACKAGE_MANAGER": "conda", | ||
"BASE": "rapidsai/devcontainers:23.10-cpp-mambaforge-ubuntu22.04" | ||
} | ||
}, | ||
"hostRequirements": {"gpu": "optional"}, | ||
"features": { | ||
"ghcr.io/rapidsai/devcontainers/features/rapids-build-utils:23.10": {} | ||
}, | ||
"overrideFeatureInstallOrder": [ | ||
"ghcr.io/rapidsai/devcontainers/features/rapids-build-utils" | ||
], | ||
"initializeCommand": ["/bin/bash", "-c", "mkdir -m 0755 -p ${localWorkspaceFolder}/../.{aws,cache,config,conda/pkgs,conda/${localWorkspaceFolderBasename}-cuda12.0-envs}"], | ||
"postAttachCommand": ["/bin/bash", "-c", "if [ ${CODESPACES:-false} = 'true' ]; then . devcontainer-utils-post-attach-command; . rapids-post-attach-command; fi"], | ||
"workspaceFolder": "/home/coder", | ||
"workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/cugraph,type=bind,consistency=consistent", | ||
"mounts": [ | ||
"source=${localWorkspaceFolder}/../.aws,target=/home/coder/.aws,type=bind,consistency=consistent", | ||
"source=${localWorkspaceFolder}/../.cache,target=/home/coder/.cache,type=bind,consistency=consistent", | ||
"source=${localWorkspaceFolder}/../.config,target=/home/coder/.config,type=bind,consistency=consistent", | ||
"source=${localWorkspaceFolder}/../.conda/pkgs,target=/home/coder/.conda/pkgs,type=bind,consistency=consistent", | ||
"source=${localWorkspaceFolder}/../.conda/${localWorkspaceFolderBasename}-cuda12.0-envs,target=/home/coder/.conda/envs,type=bind,consistency=consistent" | ||
], | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"ms-python.flake8", | ||
"nvidia.nsight-vscode-edition" | ||
] | ||
} | ||
} | ||
} |
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,37 @@ | ||
{ | ||
"build": { | ||
"context": "${localWorkspaceFolder}/.devcontainer", | ||
"dockerfile": "${localWorkspaceFolder}/.devcontainer/Dockerfile", | ||
"args": { | ||
"CUDA": "12.0", | ||
"PYTHON_PACKAGE_MANAGER": "pip", | ||
"BASE": "rapidsai/devcontainers:23.10-cpp-llvm16-cuda12.0-ubuntu22.04" | ||
} | ||
}, | ||
"hostRequirements": {"gpu": "optional"}, | ||
"features": { | ||
"ghcr.io/rapidsai/devcontainers/features/ucx:23.10": {"version": "1.14.1"}, | ||
"ghcr.io/rapidsai/devcontainers/features/rapids-build-utils:23.10": {} | ||
}, | ||
"overrideFeatureInstallOrder": [ | ||
"ghcr.io/rapidsai/devcontainers/features/rapids-build-utils" | ||
], | ||
"initializeCommand": ["/bin/bash", "-c", "mkdir -m 0755 -p ${localWorkspaceFolder}/../.{aws,cache,config/pip,local/share/${localWorkspaceFolderBasename}-cuda12.0-venvs}"], | ||
"postAttachCommand": ["/bin/bash", "-c", "if [ ${CODESPACES:-false} = 'true' ]; then . devcontainer-utils-post-attach-command; . rapids-post-attach-command; fi"], | ||
"workspaceFolder": "/home/coder", | ||
"workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/cugraph,type=bind,consistency=consistent", | ||
"mounts": [ | ||
"source=${localWorkspaceFolder}/../.aws,target=/home/coder/.aws,type=bind,consistency=consistent", | ||
"source=${localWorkspaceFolder}/../.cache,target=/home/coder/.cache,type=bind,consistency=consistent", | ||
"source=${localWorkspaceFolder}/../.config,target=/home/coder/.config,type=bind,consistency=consistent", | ||
"source=${localWorkspaceFolder}/../.local/share/${localWorkspaceFolderBasename}-cuda12.0-venvs,target=/home/coder/.local/share/venvs,type=bind,consistency=consistent" | ||
], | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"ms-python.flake8", | ||
"nvidia.nsight-vscode-edition" | ||
] | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -25,6 +25,7 @@ jobs: | |
- wheel-tests-cugraph | ||
- wheel-build-nx-cugraph | ||
- wheel-tests-nx-cugraph | ||
- devcontainer | ||
secrets: inherit | ||
uses: rapidsai/shared-action-workflows/.github/workflows/[email protected] | ||
checks: | ||
|
@@ -125,3 +126,12 @@ jobs: | |
with: | ||
build_type: pull-request | ||
script: ci/test_wheel_nx-cugraph.sh | ||
devcontainer: | ||
secrets: inherit | ||
uses: rapidsai/shared-action-workflows/.github/workflows/[email protected] | ||
with: | ||
extra-repo-deploy-key: CUGRAPH_OPS_SSH_PRIVATE_DEPLOY_KEY | ||
build_command: | | ||
sccache -z; | ||
build-all --verbose; | ||
sccache -s; |
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
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
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
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
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,65 @@ | ||
# https://clangd.llvm.org/config | ||
|
||
# Apply a config conditionally to all C files | ||
If: | ||
PathMatch: .*\.(c|h)$ | ||
|
||
--- | ||
|
||
# Apply a config conditionally to all C++ files | ||
If: | ||
PathMatch: .*\.(c|h)pp | ||
|
||
--- | ||
|
||
# Apply a config conditionally to all CUDA files | ||
If: | ||
PathMatch: .*\.cuh? | ||
CompileFlags: | ||
Add: | ||
- "-x" | ||
- "cuda" | ||
# No error on unknown CUDA versions | ||
- "-Wno-unknown-cuda-version" | ||
# Allow variadic CUDA functions | ||
- "-Xclang=-fcuda-allow-variadic-functions" | ||
Diagnostics: | ||
Suppress: | ||
- "variadic_device_fn" | ||
- "attributes_not_allowed" | ||
|
||
--- | ||
|
||
# Tweak the clangd parse settings for all files | ||
CompileFlags: | ||
Add: | ||
# report all errors | ||
- "-ferror-limit=0" | ||
- "-fmacro-backtrace-limit=0" | ||
- "-ftemplate-backtrace-limit=0" | ||
# Skip the CUDA version check | ||
- "--no-cuda-version-check" | ||
Remove: | ||
# remove gcc's -fcoroutines | ||
- -fcoroutines | ||
# remove nvc++ flags unknown to clang | ||
- "-gpu=*" | ||
- "-stdpar*" | ||
# remove nvcc flags unknown to clang | ||
- "-arch*" | ||
- "-gencode*" | ||
- "--generate-code*" | ||
- "-ccbin*" | ||
- "-t=*" | ||
- "--threads*" | ||
- "-Xptxas*" | ||
- "-Xcudafe*" | ||
- "-Xfatbin*" | ||
- "-Xcompiler*" | ||
- "--diag-suppress*" | ||
- "--diag_suppress*" | ||
- "--compiler-options*" | ||
- "--expt-extended-lambda" | ||
- "--expt-relaxed-constexpr" | ||
- "-forward-unknown-to-host-compiler" | ||
- "-Werror=cross-execution-space-call" |
Oops, something went wrong.