Skip to content

Commit

Permalink
add notebook tests, build.sh args (#62)
Browse files Browse the repository at this point in the history
Closes #53

This pulls over the remaining changes from that PR... thought that was easier than fixing the merge conflicts between that and recent PRs.

* adds notebook testing
* adds all the remaining `build.sh` changes from #53 (mostly for interactive development)
* adds `cugraph-pyg` and `cugraph-dgl` tests in `conda-python-tests` (missed in #59)

## Notes for Reviewers

I left other comments explaining these changes inline.

Authors:
  - James Lamb (https://github.com/jameslamb)
  - Tingyu Wang (https://github.com/tingyu66)

Approvers:
  - Tingyu Wang (https://github.com/tingyu66)
  - Ray Douglass (https://github.com/raydouglass)

URL: #62
  • Loading branch information
jameslamb authored Nov 8, 2024
1 parent f7ab898 commit d260ccb
Show file tree
Hide file tree
Showing 17 changed files with 323 additions and 28 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
- conda-cpp-tests
- conda-python-build
- conda-python-tests
- conda-notebook-tests
- wheel-build-pylibwholegraph
- wheel-tests-pylibwholegraph
- wheel-build-cugraph-dgl
Expand Down Expand Up @@ -51,6 +52,7 @@ jobs:
- '!CONTRIBUTING.md'
- '!README.md'
- '!docs/**'
- '!readme_pages/**'
test_python:
- '**'
- '!.devcontainers/**'
Expand All @@ -59,6 +61,7 @@ jobs:
- '!docs/**'
- '!img/**'
- '!notebooks/**'
- '!readme_pages/**'
checks:
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
Expand All @@ -83,6 +86,17 @@ jobs:
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
with:
build_type: pull-request
conda-notebook-tests:
needs: [conda-python-build, changed-files]
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_notebooks
with:
build_type: pull-request
node_type: "gpu-v100-latest-1"
arch: "amd64"
container_image: "rapidsai/ci-conda:cuda11.8.0-ubuntu22.04-py3.12"
run_script: "ci/test_notebooks.sh"
conda-python-tests:
needs: [conda-python-build, changed-files]
secrets: inherit
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ jobs:
branch: ${{ inputs.branch }}
date: ${{ inputs.date }}
sha: ${{ inputs.sha }}
conda-notebook-tests:
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_notebooks
with:
build_type: pull-request
node_type: "gpu-v100-latest-1"
arch: "amd64"
container_image: "rapidsai/ci-conda:cuda11.8.0-ubuntu22.04-py3.12"
run_script: "ci/test_notebooks.sh"
conda-python-tests:
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ __pycache__
DartConfiguration.tcl
.DS_Store
rmm_log.txt
.ruff_cache
.ruff_cache/

# Unit test / coverage reports
htmlcov/
Expand Down
18 changes: 17 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ VALIDARGS="
pylibwholegraph
libwholegraph
tests
benchmarks
all
-v
-g
-n
--pydevelop
--allgpuarch
--compile-cmd
--clean
-h
--help
Expand All @@ -49,13 +51,16 @@ HELP="$0 [<target> ...] [<flag> ...]
pylibwholegraph - build the pylibwholegraph Python package
libwholegraph - build the libwholegraph library
tests - build the C++ tests
benchmarks - build benchmarks
all - build everything
and <flag> is:
-v - verbose build mode
-g - build for debug
-n - do not install after a successful build (does not affect Python packages)
--pydevelop - install the Python packages in editable mode
--allgpuarch - build for all supported GPU architectures
--enable-nvshmem - build with nvshmem support (beta).
--compile-cmd - only output compile commands (invoke CMake without build)
--clean - clean an individual target (note: to do a complete rebuild, use the clean target described above)
-h - print this text
Expand Down Expand Up @@ -140,11 +145,22 @@ if hasArg --pydevelop; then
PYTHON_ARGS_FOR_INSTALL="${PYTHON_ARGS_FOR_INSTALL} -e"
fi

if hasArg --enable-nvshmem; then
BUILD_WITH_NVSHMEM=ON
else
BUILD_WITH_NVSHMEM=OFF
fi
if hasArg tests; then
BUILD_TESTS=ON
else
BUILD_TESTS=OFF
fi
if hasArg benchmarks; then
BUILD_BENCHMARKS=ON
else
BUILD_BENCHMARKS=OFF
fi


# If clean or uninstall targets given, run them prior to any other steps
if hasArg uninstall; then
Expand Down Expand Up @@ -250,7 +266,7 @@ if hasArg cugraph-pyg || buildDefault || hasArg all; then
fi
fi

# Install the cugraph-dgl extensions for DGL
# Build and install the cugraph-dgl Python package
if hasArg cugraph-dgl || buildDefault ||hasArg all; then
if hasArg --clean; then
cleanPythonDir ${REPODIR}/python/cugraph-dgl
Expand Down
6 changes: 5 additions & 1 deletion ci/build_cpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ export CMAKE_GENERATOR=Ninja

rapids-print-env

version=$(rapids-generate-version)
# TODO: revert this once we start publishing nightly packages
# from the 'cugraph-gnn' repo and stop publishing them from
# the 'cugraph' / 'wholegraph' repos
#version=$(rapids-generate-version)
version="24.12.00a1000"

rapids-logger "Begin cpp build"

Expand Down
6 changes: 5 additions & 1 deletion ci/build_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ rapids-print-env

CPP_CHANNEL=$(rapids-download-conda-from-s3 cpp)

rapids-generate-version > ./VERSION
# TODO: revert this once we start publishing nightly packages
# from the 'cugraph-gnn' repo and stop publishing them from
# the 'cugraph' / 'wholegraph' repos
# rapids-generate-version > ./VERSION
echo "24.12.00a1000" > ./VERSION

sccache --zero-stats

Expand Down
10 changes: 7 additions & 3 deletions ci/test_notebooks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ set -Eeuo pipefail

. /opt/conda/etc/profile.d/conda.sh

RAPIDS_VERSION="$(rapids-version)"

rapids-logger "Generate notebook testing dependencies"
rapids-dependency-file-generator \
--output conda \
Expand All @@ -24,18 +26,20 @@ rapids-logger "Downloading artifacts from previous jobs"
CPP_CHANNEL=$(rapids-download-conda-from-s3 cpp)
PYTHON_CHANNEL=$(rapids-download-conda-from-s3 python)

# TODO: remove the '>=24.12.00a1000' once we start publishing nightly packages
# from the 'cugraph-gnn' repo and stop publishing them from
# the 'cugraph' / 'wholegraph' repos
rapids-mamba-retry install \
--channel "${CPP_CHANNEL}" \
--channel "${PYTHON_CHANNEL}" \
libcugraph pylibcugraph cugraph
--channel dglteam/label/th23_cu118 \
"cugraph-dgl=${RAPIDS_VERSION},>=24.12.00a1000"

NBTEST="$(realpath "$(dirname "$0")/utils/nbtest.sh")"
NOTEBOOK_LIST="$(realpath "$(dirname "$0")/notebook_list.py")"
EXITCODE=0
trap "EXITCODE=1" ERR


pushd notebooks
TOPLEVEL_NB_FOLDERS="$(find . -name "*.ipynb" | cut -d'/' -f2 | sort -u)"
set +e
# Always run nbtest in all TOPLEVEL_NB_FOLDERS, set EXITCODE to failure
Expand Down
116 changes: 114 additions & 2 deletions ci/test_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,120 @@ RAPIDS_TESTS_DIR=${RAPIDS_TESTS_DIR:-"${PWD}/test-results"}
RAPIDS_COVERAGE_DIR=${RAPIDS_COVERAGE_DIR:-"${PWD}/coverage-results"}
mkdir -p "${RAPIDS_TESTS_DIR}" "${RAPIDS_COVERAGE_DIR}"

# RAPIDS_DATASET_ROOT_DIR is used by test scripts
export RAPIDS_DATASET_ROOT_DIR="$(realpath datasets)"
mkdir -p "${RAPIDS_DATASET_ROOT_DIR}"
pushd "${RAPIDS_DATASET_ROOT_DIR}"
./get_test_data.sh --benchmark
popd

EXITCODE=0
trap "EXITCODE=1" ERR
set +e

# Test runs that include tests that use dask require
# --import-mode=append. Those tests start a LocalCUDACluster that inherits
# changes from pytest's modifications to PYTHONPATH (which defaults to
# prepending source tree paths to PYTHONPATH). This causes the
# LocalCUDACluster subprocess to import cugraph from the source tree instead of
# the install location, and in most cases, the source tree does not have
# extensions built in-place and will result in ImportErrors.
#
# FIXME: TEMPORARILY disable MG PropertyGraph tests (experimental) tests and
# bulk sampler IO tests (hangs in CI)

if [[ "${RUNNER_ARCH}" != "ARM64" ]]; then
rapids-mamba-retry env create --yes -f env.yaml -n test_cugraph_dgl

# activate test_cugraph_dgl environment for dgl
set +u
conda activate test_cugraph_dgl
set -u

if [[ "${RAPIDS_CUDA_VERSION%%.*}" == "11" ]]; then
DGL_CHANNEL="dglteam/label/th23_cu118"
else
DGL_CHANNEL="dglteam/label/th23_cu121"
fi


# TODO: remove the '>=24.12.00a1000' once we start publishing nightly packages
# from the 'cugraph-gnn' repo and stop publishing them from
# the 'cugraph' / 'wholegraph' repos
rapids-mamba-retry install \
--channel "${CPP_CHANNEL}" \
--channel "${PYTHON_CHANNEL}" \
--channel pytorch \
--channel conda-forge \
--channel "${DGL_CHANNEL}" \
--channel nvidia \
"pylibwholegraph=${RAPIDS_VERSION},>=24.12.00a1000" \
"cugraph-dgl=${RAPIDS_VERSION},>=24.12.00a1000" \
'pytorch::pytorch>=2.3,<2.4' \
"ogb"

rapids-print-env

rapids-logger "Check GPU usage"
nvidia-smi

rapids-logger "pytest cugraph_dgl (single GPU)"
./ci/run_cugraph_dgl_pytests.sh \
--junitxml="${RAPIDS_TESTS_DIR}/junit-cugraph-dgl.xml" \
--cov-config=../../.coveragerc \
--cov=cugraph_dgl \
--cov-report=xml:"${RAPIDS_COVERAGE_DIR}/cugraph-dgl-coverage.xml" \
--cov-report=term

# Reactivate the test environment back
set +u
conda deactivate
set -u
else
rapids-logger "skipping cugraph_dgl pytest on ARM64"
fi

if [[ "${RUNNER_ARCH}" != "ARM64" ]]; then
rapids-mamba-retry env create --yes -f env.yaml -n test_cugraph_pyg

# Temporarily allow unbound variables for conda activation.
set +u
conda activate test_cugraph_pyg
set -u

# TODO: remove the '>=24.12.00a1000' once we start publishing nightly packages
# from the 'cugraph-gnn' repo and stop publishing them from
# the 'cugraph' / 'wholegraph' repos
rapids-mamba-retry install \
--channel "${CPP_CHANNEL}" \
--channel "${PYTHON_CHANNEL}" \
--channel pytorch \
"pylibwholegraph=${RAPIDS_VERSION},>=24.12.00a1000" \
"cugraph-pyg=${RAPIDS_VERSION},>=24.12.00a1000" \
'pytorch::pytorch>=2.3,<2.4' \
'ogb'

rapids-print-env

rapids-logger "Check GPU usage"
nvidia-smi

rapids-logger "pytest cugraph_pyg (single GPU)"
./ci/run_cugraph_pyg_pytests.sh \
--junitxml="${RAPIDS_TESTS_DIR}/junit-cugraph-pyg.xml" \
--cov-config=../../.coveragerc \
--cov=cugraph_pyg \
--cov-report=xml:"${RAPIDS_COVERAGE_DIR}/cugraph-pyg-coverage.xml" \
--cov-report=term

# Reactivate the test environment back
set +u
conda deactivate
set -u
else
rapids-logger "skipping cugraph_pyg pytest on ARM64"
fi

if [[ "${RUNNER_ARCH}" != "ARM64" ]]; then
rapids-mamba-retry env create --yes -f env.yaml -n test_pylibwholegraph

Expand All @@ -39,13 +149,15 @@ if [[ "${RUNNER_ARCH}" != "ARM64" ]]; then
conda activate test_pylibwholegraph
set -u

# Will automatically install built dependencies of pylibwholegraph
# TODO: remove the '>=24.12.00a1000' once we start publishing nightly packages
# from the 'cugraph-gnn' repo and stop publishing them from
# the 'cugraph' / 'wholegraph' repos
rapids-mamba-retry install \
--channel "${CPP_CHANNEL}" \
--channel "${PYTHON_CHANNEL}" \
--channel pytorch \
'mkl<2024.1.0' \
"pylibwholegraph=${RAPIDS_VERSION}" \
"pylibwholegraph=${RAPIDS_VERSION},>=24.12.00a1000" \
'pytorch::pytorch>=2.3,<2.4' \
'pytest-forked' \
'ogb'
Expand Down
2 changes: 1 addition & 1 deletion ci/utils/nbtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ for nb in $*; do
echo --------------------------------------------------------------------------------
echo STARTING: ${NBNAME}
echo --------------------------------------------------------------------------------
jupyter nbconvert --to script ${NBFILENAME} --output ${NBTMPDIR}/${NBNAME}-test
jupyter nbconvert --to python ${NBFILENAME} --output ${NBTMPDIR}/${NBNAME}-test
echo "${MAGIC_OVERRIDE_CODE}" > ${NBTMPDIR}/tmpfile
cat ${NBTESTSCRIPT} >> ${NBTMPDIR}/tmpfile
mv ${NBTMPDIR}/tmpfile ${NBTESTSCRIPT}
Expand Down
3 changes: 2 additions & 1 deletion conda/environments/all_cuda-118_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ dependencies:
- doxygen
- graphviz
- ipython
- nbconvert
- nbsphinx
- nccl>=2.19
- ninja
- notebook>=0.5.0
- numba>=0.57
- numpy>=1.23,<3.0a0
- numpydoc
- ogb
- pandas
- pre-commit
- pydantic
Expand All @@ -54,6 +56,5 @@ dependencies:
- sphinx<6
- sphinxcontrib-websupport
- torchdata
- wget
- wheel
name: all_cuda-118_arch-x86_64
3 changes: 2 additions & 1 deletion conda/environments/all_cuda-121_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ dependencies:
- libcurand-dev
- libcusolver-dev
- libcusparse-dev
- nbconvert
- nbsphinx
- nccl>=2.19
- ninja
- notebook>=0.5.0
- numba>=0.57
- numpy>=1.23,<3.0a0
- numpydoc
- ogb
- pandas
- pre-commit
- pydantic
Expand All @@ -59,6 +61,5 @@ dependencies:
- sphinx<6
- sphinxcontrib-websupport
- torchdata
- wget
- wheel
name: all_cuda-121_arch-x86_64
Loading

0 comments on commit d260ccb

Please sign in to comment.