Skip to content

Commit bf64914

Browse files
authored
add full CI for wholegraph (#58)
This PR introduces full end-to-end CI for wholegraph. ## Notes for Reviewers Most of these changes were pulled from a mix of the following: * #53 * rapidsai/wholegraph#230 * https://github.com/rapidsai/wholegraph Authors: - James Lamb (https://github.com/jameslamb) Approvers: - Alex Barghi (https://github.com/alexbarghi-nv) - Jake Awe (https://github.com/AyodeAwe) URL: #58
1 parent 93e61a7 commit bf64914

26 files changed

+468
-289
lines changed

.github/workflows/pr.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ jobs:
1414
needs:
1515
- changed-files
1616
- checks
17+
- conda-cpp-build
18+
- conda-cpp-tests
19+
- conda-python-build
20+
- conda-python-tests
21+
- wheel-build-pylibwholegraph
22+
- wheel-tests-pylibwholegraph
1723
secrets: inherit
1824
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
1925
if: always()
@@ -54,3 +60,47 @@ jobs:
5460
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
5561
with:
5662
enable_check_generated_files: false
63+
conda-cpp-build:
64+
needs: checks
65+
secrets: inherit
66+
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
67+
with:
68+
build_type: pull-request
69+
node_type: cpu32
70+
conda-cpp-tests:
71+
needs: [conda-cpp-build, changed-files]
72+
secrets: inherit
73+
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
74+
if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_cpp
75+
with:
76+
build_type: pull-request
77+
conda-python-build:
78+
needs: conda-cpp-build
79+
secrets: inherit
80+
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
81+
with:
82+
build_type: pull-request
83+
conda-python-tests:
84+
needs: [conda-python-build, changed-files]
85+
secrets: inherit
86+
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
87+
if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python
88+
with:
89+
build_type: pull-request
90+
wheel-build-pylibwholegraph:
91+
needs: checks
92+
secrets: inherit
93+
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
94+
with:
95+
build_type: pull-request
96+
script: ci/build_wheel_pylibwholegraph.sh
97+
node_type: cpu32
98+
wheel-tests-pylibwholegraph:
99+
needs: [wheel-build-pylibwholegraph, changed-files]
100+
secrets: inherit
101+
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
102+
if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python
103+
with:
104+
build_type: pull-request
105+
script: ci/test_wheel_pylibwholegraph.sh
106+
matrix_filter: map(select(.ARCH == "amd64"))

build.sh

Lines changed: 83 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ VALIDARGS="
2626
uninstall
2727
cugraph-pyg
2828
cugraph-dgl
29+
pylibwholegraph
30+
libwholegraph
31+
tests
2932
docs
3033
all
3134
-v
@@ -44,6 +47,9 @@ HELP="$0 [<target> ...] [<flag> ...]
4447
uninstall - uninstall libcugraph and cugraph from a prior build/install (see also -n)
4548
cugraph-pyg - build the cugraph-pyg Python package
4649
cugraph-dgl - build the cugraph-dgl extensions for DGL
50+
pylibwholegraph - build the pylibwholegraph Python package
51+
libwholegraph - build the libwholegraph library
52+
tests - build the C++ tests
4753
docs - build the docs
4854
all - build everything
4955
and <flag> is:
@@ -55,23 +61,27 @@ HELP="$0 [<target> ...] [<flag> ...]
5561
--clean - clean an individual target (note: to do a complete rebuild, use the clean target described above)
5662
-h - print this text
5763
58-
default action (no args) is to build and install 'cugraph-pyg' then 'cugraph-dgl' then 'wholegraph' targets
64+
default action (no args) is to build and install 'libwholegraph' then 'pylibwholegraph' then 'cugraph-pyg' then 'cugraph-dgl'
5965
6066
"
6167

6268
CUGRAPH_PYG_BUILD_DIR=${REPODIR}/python/cugraph-pyg/build
6369
CUGRAPH_DGL_BUILD_DIR=${REPODIR}/python/cugraph-dgl/build
70+
PYLIBWHOLEGRAPH_BUILD_DIR=${REPODIR}/python/pylibwholegraph/build
71+
LIBWHOLEGRAPH_BUILD_DIR=${REPODIR}/cpp/build
6472

6573
BUILD_DIRS="${CUGRAPH_PYG_BUILD_DIR}
6674
${CUGRAPH_DGL_BUILD_DIR}
75+
${PYLIBWHOLEGRAPH_BUILD_DIR}
76+
${LIBWHOLEGRAPH_BUILD_DIR}
6777
"
6878

6979
# Set defaults for vars modified by flags to this script
7080
VERBOSE_FLAG=""
7181
BUILD_TYPE=Release
7282
INSTALL_TARGET="--target install"
7383
BUILD_ALL_GPU_ARCH=0
74-
PYTHON_ARGS_FOR_INSTALL="-m pip install --no-build-isolation --no-deps"
84+
PYTHON_ARGS_FOR_INSTALL="-m pip install --no-build-isolation --no-deps --config-settings rapidsai.disable-cuda=true"
7585

7686
# Set defaults for vars that may not have been defined externally
7787
# FIXME: if PREFIX is not set, check CONDA_PREFIX, but there is no fallback
@@ -132,13 +142,30 @@ if hasArg --pydevelop; then
132142
PYTHON_ARGS_FOR_INSTALL="${PYTHON_ARGS_FOR_INSTALL} -e"
133143
fi
134144

145+
if hasArg tests; then
146+
BUILD_TESTS=ON
147+
else
148+
BUILD_TESTS=OFF
149+
fi
150+
135151
# If clean or uninstall targets given, run them prior to any other steps
136152
if hasArg uninstall; then
137-
# uninstall cugraph and pylibcugraph installed from a prior install
153+
if [[ "$INSTALL_PREFIX" != "" ]]; then
154+
rm -rf ${INSTALL_PREFIX}/include/wholememory
155+
rm -f ${INSTALL_PREFIX}/lib/libwholegraph.so
156+
rm -rf ${INSTALL_PREFIX}/lib/cmake/wholegraph
157+
fi
158+
# This may be redundant given the above, but can also be used in case
159+
# there are other installed files outside of the locations above.
160+
if [ -e ${LIBWHOLEGRAPH_BUILD_DIR}/install_manifest.txt ]; then
161+
xargs rm -f < ${LIBWHOLEGRAPH_BUILD_DIR}/install_manifest.txt > /dev/null 2>&1
162+
fi
163+
164+
# uninstall cugraph-dgl/cugraph-pyg/wholegraph installed from a prior install
138165
# FIXME: if multiple versions of these packages are installed, this only
139166
# removes the latest one and leaves the others installed. build.sh uninstall
140167
# can be run multiple times to remove all of them, but that is not obvious.
141-
pip uninstall -y cugraph-dgl cugraph-pyg
168+
pip uninstall -y cugraph-dgl cugraph-pyg pylibwholegraph libwholegraph
142169
fi
143170

144171
if hasArg clean; then
@@ -164,6 +191,58 @@ if hasArg clean; then
164191
fi
165192

166193
################################################################################
194+
# Build and install the libwholegraph library
195+
if hasArg libwholegraph || buildDefault || hasArg all ; then
196+
197+
# set values based on flags
198+
if (( ${BUILD_ALL_GPU_ARCH} == 0 )); then
199+
WHOLEGRAPH_CMAKE_CUDA_ARCHITECTURES="${WHOLEGRAPH_CMAKE_CUDA_ARCHITECTURES:=NATIVE}"
200+
echo "Building for the architecture of the GPU in the system..."
201+
else
202+
WHOLEGRAPH_CMAKE_CUDA_ARCHITECTURES="70-real;75-real;80-real;86-real;90"
203+
echo "Building for *ALL* supported GPU architectures..."
204+
fi
205+
206+
cmake -S ${REPODIR}/cpp -B ${LIBWHOLEGRAPH_BUILD_DIR} \
207+
-DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \
208+
-DCMAKE_CUDA_ARCHITECTURES=${WHOLEGRAPH_CMAKE_CUDA_ARCHITECTURES} \
209+
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
210+
-DCMAKE_PREFIX_PATH=${INSTALL_PREFIX} \
211+
-DCMAKE_MESSAGE_LOG_LEVEL=VERBOSE \
212+
-DBUILD_TESTS=${BUILD_TESTS} \
213+
-DBUILD_WITH_NVSHMEM=${BUILD_WITH_NVSHMEM}
214+
215+
cd ${LIBWHOLEGRAPH_BUILD_DIR}
216+
217+
if ! hasArg --compile-cmd; then
218+
## Build and (optionally) install library + tests
219+
cmake --build . -j${PARALLEL_LEVEL} ${INSTALL_TARGET} ${VERBOSE_FLAG}
220+
fi
221+
fi
222+
223+
# Build and install the pylibwholegraph Python package
224+
if hasArg pylibwholegraph || buildDefault || hasArg all; then
225+
if hasArg --clean; then
226+
cleanPythonDir ${REPODIR}/python/pylibwholegraph
227+
fi
228+
229+
# setup.py and cmake reference an env var LIBWHOLEGRAPH_DIR to find the
230+
# libwholegraph package (cmake).
231+
# If not set by the user, set it to LIBWHOLEGRAPH_BUILD_DIR
232+
LIBWHOLEGRAPH_DIR=${LIBWHOLEGRAPH_DIR:=${LIBWHOLEGRAPH_BUILD_DIR}}
233+
if ! hasArg --compile-cmd; then
234+
cd ${REPODIR}/python/pylibwholegraph
235+
env LIBWHOLEGRAPH_DIR=${LIBWHOLEGRAPH_DIR} \
236+
SKBUILD_CMAKE_ARGS="-DCMAKE_BUILD_TYPE=${BUILD_TYPE}" python ${PYTHON_ARGS_FOR_INSTALL} \
237+
.
238+
else
239+
# just invoke cmake without going through scikit-build-core
240+
env LIBWHOLEGRAPH_DIR=${LIBWHOLEGRAPH_DIR} \
241+
cmake -S ${REPODIR}/python/pylibwholegraph -B ${REPODIR}/python/pylibwholegraph/build \
242+
-DCMAKE_BUILD_TYPE=${BUILD_TYPE}
243+
fi
244+
fi
245+
167246
# Build and install the cugraph-pyg Python package
168247
if hasArg cugraph-pyg || buildDefault || hasArg all; then
169248
if hasArg --clean; then

ci/build_cpp.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
# Copyright (c) 2022-2024, NVIDIA CORPORATION.
3+
4+
set -euo pipefail
5+
6+
rapids-configure-conda-channels
7+
8+
source rapids-configure-sccache
9+
10+
source rapids-date-string
11+
12+
export CMAKE_GENERATOR=Ninja
13+
14+
rapids-print-env
15+
16+
version=$(rapids-generate-version)
17+
18+
rapids-logger "Begin cpp build"
19+
20+
RAPIDS_PACKAGE_VERSION=${version} rapids-conda-retry mambabuild conda/recipes/libwholegraph
21+
22+
rapids-upload-conda-to-s3 cpp

ci/build_python.sh

Lines changed: 9 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -15,41 +15,14 @@ rapids-print-env
1515

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

18-
version=$(rapids-generate-version)
19-
git_commit=$(git rev-parse HEAD)
20-
export RAPIDS_PACKAGE_VERSION=${version}
21-
echo "${version}" > VERSION
22-
23-
rapids-logger "Begin py build"
24-
25-
package_dir="python"
26-
for package_name in cugraph-pyg cugraph-dgl; do
27-
underscore_package_name=$(echo "${package_name}" | tr "-" "_")
28-
sed -i "/^__git_commit__/ s/= .*/= \"${git_commit}\"/g" "${package_dir}/${package_name}/${underscore_package_name}/_version.py"
29-
done
30-
31-
RAPIDS_CUDA_MAJOR="${RAPIDS_CUDA_VERSION%%.*}"
32-
33-
if [[ ${RAPIDS_CUDA_MAJOR} == "11" ]]; then
34-
# Only CUDA 11 is supported right now due to PyTorch requirement.
35-
rapids-conda-retry mambabuild \
36-
--no-test \
37-
--channel "${CPP_CHANNEL}" \
38-
--channel "${RAPIDS_CONDA_BLD_OUTPUT_DIR}" \
39-
--channel pyg \
40-
--channel pytorch \
41-
--channel pytorch-nightly \
42-
conda/recipes/cugraph-pyg
43-
44-
# Only CUDA 11 is supported right now due to PyTorch requirement.
45-
rapids-conda-retry mambabuild \
46-
--no-test \
47-
--channel "${CPP_CHANNEL}" \
48-
--channel "${RAPIDS_CONDA_BLD_OUTPUT_DIR}" \
49-
--channel dglteam \
50-
--channel pytorch \
51-
--channel pytorch-nightly \
52-
conda/recipes/cugraph-dgl
53-
fi
18+
rapids-generate-version > ./VERSION
19+
20+
# TODO: Remove `--no-test` flags once importing on a CPU
21+
# node works correctly
22+
rapids-logger "Begin pylibwholegraph build"
23+
RAPIDS_PACKAGE_VERSION=$(head -1 ./VERSION) rapids-conda-retry mambabuild \
24+
--no-test \
25+
--channel "${CPP_CHANNEL}" \
26+
conda/recipes/pylibwholegraph
5427

5528
rapids-upload-conda-to-s3 python

ci/build_wheel.sh

Lines changed: 33 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -7,62 +7,52 @@ package_name=$1
77
package_dir=$2
88
underscore_package_name=$(echo "${package_name}" | tr "-" "_")
99

10+
# The set of shared libraries that should be packaged differs by project.
11+
#
12+
# Capturing that here in argument-parsing to allow this build_wheel.sh
13+
# script to be re-used by all wheel builds in the project.
14+
case "${package_dir}" in
15+
python/pylibwholegraph)
16+
EXCLUDE_ARGS=(
17+
--exclude libcuda.so.1
18+
--exclude libnvidia-ml.so.1
19+
)
20+
;;
21+
*)
22+
EXCLUDE_ARGS=()
23+
;;
24+
esac
25+
1026
source rapids-configure-sccache
1127
source rapids-date-string
1228

13-
version=$(rapids-generate-version)
14-
git_commit=$(git rev-parse HEAD)
29+
rapids-generate-version > ./VERSION
1530

1631
RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen ${RAPIDS_CUDA_VERSION})"
1732

18-
# This is the version of the suffix with a preceding hyphen. It's used
19-
# everywhere except in the final wheel name.
20-
PACKAGE_CUDA_SUFFIX="-${RAPIDS_PY_CUDA_SUFFIX}"
21-
22-
# Patch project metadata files to include the CUDA version suffix and version override.
23-
version_package_name="$underscore_package_name"
24-
25-
pyproject_file="${package_dir}/pyproject.toml"
26-
version_file="${package_dir}/${version_package_name}/_version.py"
27-
28-
sed -i "s/name = \"${package_name}\"/name = \"${package_name}${PACKAGE_CUDA_SUFFIX}\"/g" ${pyproject_file}
29-
echo "${version}" > VERSION
30-
sed -i "/^__git_commit__ / s/= .*/= \"${git_commit}\"/g" ${version_file}
31-
32-
# For nightlies we want to ensure that we're pulling in alphas as well. The
33-
# easiest way to do so is to augment the spec with a constraint containing a
34-
# min alpha version that doesn't affect the version bounds but does allow usage
35-
# of alpha versions for that dependency without --pre
36-
alpha_spec=''
37-
if ! rapids-is-release-build; then
38-
alpha_spec=',>=0.0.0a0'
39-
fi
40-
41-
for dep in rmm cudf cugraph raft-dask pylibcugraph pylibcugraphops pylibwholegraph pylibraft ucx-py; do
42-
sed -r -i "s/${dep}==(.*)\"/${dep}${PACKAGE_CUDA_SUFFIX}==\1${alpha_spec}\"/g" ${pyproject_file}
43-
done
44-
45-
# dask-cuda & rapids-dask-dependency doesn't get a suffix, but it does get an alpha spec.
46-
for dep in dask-cuda rapids-dask-dependency; do
47-
sed -r -i "s/${dep}==(.*)\"/${dep}==\1${alpha_spec}\"/g" ${pyproject_file}
48-
done
49-
50-
51-
if [[ $PACKAGE_CUDA_SUFFIX == "-cu12" ]]; then
52-
sed -i "s/cupy-cuda11x/cupy-cuda12x/g" ${pyproject_file}
53-
fi
54-
5533
cd "${package_dir}"
5634

57-
python -m pip wheel . -w dist -vvv --no-deps --disable-pip-version-check
35+
rapids-logger "Building '${package_name}' wheel"
36+
python -m pip wheel \
37+
-w dist \
38+
-v \
39+
--no-deps \
40+
--disable-pip-version-check \
41+
.
42+
43+
sccache --show-adv-stats
5844

5945
# pure-python packages should be marked as pure, and not have auditwheel run on them.
6046
if [[ ${package_name} == "cugraph-dgl" ]] || \
6147
[[ ${package_name} == "cugraph-pyg" ]]; then
62-
RAPIDS_PY_WHEEL_NAME="${package_name}_${RAPIDS_PY_CUDA_SUFFIX}" RAPIDS_PY_WHEEL_PURE="1" rapids-upload-wheels-to-s3 dist
48+
RAPIDS_PY_WHEEL_NAME="${package_name}_${RAPIDS_PY_CUDA_SUFFIX}" RAPIDS_PY_WHEEL_PURE="1" rapids-upload-wheels-to-s3 python dist
6349
else
64-
# presumably WholeGraph when we add it
50+
6551
mkdir -p final_dist
66-
python -m auditwheel repair -w final_dist dist/*
52+
python -m auditwheel repair \
53+
"${EXCLUDE_ARGS[@]}" \
54+
-w final_dist \
55+
dist/*
56+
6757
RAPIDS_PY_WHEEL_NAME="${package_name}_${RAPIDS_PY_CUDA_SUFFIX}" rapids-upload-wheels-to-s3 final_dist
6858
fi

ci/build_wheel_pylibwholegraph.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
#!/bin/bash
3+
# Copyright (c) 2024, NVIDIA CORPORATION.
4+
5+
set -euo pipefail
6+
7+
export SKBUILD_CMAKE_ARGS="-DDETECT_CONDA_ENV=OFF;-DBUILD_SHARED_LIBS=OFF;-DCMAKE_MESSAGE_LOG_LEVEL=VERBOSE;-DCUDA_STATIC_RUNTIME=ON;-DWHOLEGRAPH_BUILD_WHEELS=ON"
8+
9+
./ci/build_wheel.sh pylibwholegraph python/pylibwholegraph

ci/run_ctests.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
# Copyright (c) 2024, NVIDIA CORPORATION.
3+
4+
set -euo pipefail
5+
6+
# Support customizing the ctests' install location
7+
cd "${INSTALL_PREFIX:-${CONDA_PREFIX:-/usr}}/bin/gtests/libwholegraph/"
8+
9+
find . -type f -executable -print0 | xargs -0 -r -t -n1 -P1 sh -c 'exec "$0"';

0 commit comments

Comments
 (0)