Skip to content

Commit

Permalink
Merge branch 'branch-24.06' into patch-2
Browse files Browse the repository at this point in the history
  • Loading branch information
acostadon authored Apr 15, 2024
2 parents e108489 + 2578421 commit 8183ff7
Show file tree
Hide file tree
Showing 17 changed files with 181 additions and 119 deletions.
23 changes: 16 additions & 7 deletions ci/build_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,33 @@ rapids-logger "Downloading artifacts from previous jobs"
CPP_CHANNEL=$(rapids-download-conda-from-s3 cpp)
PYTHON_CHANNEL=$(rapids-download-conda-from-s3 python)

if [[ "${RAPIDS_CUDA_VERSION}" == "11.8.0" ]]; then
CONDA_CUDA_VERSION="11.8"
DGL_CHANNEL="dglteam/label/cu118"
else
CONDA_CUDA_VERSION="12.1"
DGL_CHANNEL="dglteam/label/cu121"
fi

rapids-mamba-retry install \
--channel "${CPP_CHANNEL}" \
--channel "${PYTHON_CHANNEL}" \
--channel conda-forge \
--channel pyg \
--channel nvidia \
--channel "${DGL_CHANNEL}" \
libcugraph \
pylibcugraph \
cugraph \
cugraph-pyg \
cugraph-dgl \
cugraph-service-server \
cugraph-service-client \
libcugraph_etl \
pylibcugraphops \
pylibwholegraph

# This command installs `cugraph-dgl` without its dependencies
# since this package can currently only run in `11.6` CTK environments
# due to the dependency version specifications in its conda recipe.
rapids-logger "Install cugraph-dgl"
rapids-mamba-retry install "${PYTHON_CHANNEL}/linux-64/cugraph-dgl-*.tar.bz2"
pylibwholegraph \
pytorch \
"cuda-version=${CONDA_CUDA_VERSION}"

export RAPIDS_VERSION="$(rapids-version)"
export RAPIDS_VERSION_MAJOR_MINOR="$(rapids-version-major-minor)"
Expand Down
6 changes: 6 additions & 0 deletions ci/run_cugraph_pyg_pytests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@ set -euo pipefail
cd "$(dirname "$(realpath "${BASH_SOURCE[0]}")")"/../python/cugraph-pyg/cugraph_pyg

pytest --cache-clear --ignore=tests/mg "$@" .

# Test examples
for e in "$(pwd)"/examples/*.py; do
rapids-logger "running example $e"
python $e
done
32 changes: 20 additions & 12 deletions ci/test_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,7 @@ if [[ "${RAPIDS_CUDA_VERSION}" == "11.8.0" ]]; then
rapids-mamba-retry install \
--channel "${CPP_CHANNEL}" \
--channel "${PYTHON_CHANNEL}" \
--channel pytorch \
--channel pytorch-nightly \
--channel conda-forge \
--channel dglteam/label/cu118 \
--channel nvidia \
libcugraph \
Expand All @@ -165,7 +164,7 @@ if [[ "${RAPIDS_CUDA_VERSION}" == "11.8.0" ]]; then
cugraph-dgl \
'dgl>=1.1.0.cu*,<=2.0.0.cu*' \
'pytorch>=2.0' \
'pytorch-cuda>=11.8'
'cuda-version=11.8'

rapids-print-env

Expand All @@ -191,33 +190,43 @@ fi

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

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

# TODO re-enable logic once CUDA 12 is testable
#if [[ "${RAPIDS_CUDA_VERSION}" == "11.8.0" ]]; then
CONDA_CUDA_VERSION="11.8"
PYG_URL="https://data.pyg.org/whl/torch-2.1.0+cu118.html"
#else
# CONDA_CUDA_VERSION="12.1"
# PYG_URL="https://data.pyg.org/whl/torch-2.1.0+cu121.html"
#fi

# Will automatically install built dependencies of cuGraph-PyG
rapids-mamba-retry install \
--channel "${CPP_CHANNEL}" \
--channel "${PYTHON_CHANNEL}" \
--channel pytorch \
--channel nvidia \
--channel pyg \
--channel rapidsai-nightly \
--channel nvidia \
"cugraph-pyg" \
"pytorch>=2.0,<2.1" \
"pytorch-cuda=11.8"
"pytorch=2.1.0" \
"pytorch-cuda=${CONDA_CUDA_VERSION}"

# Install pyg dependencies (which requires pip)

pip install ogb
pip install \
pyg_lib \
torch_scatter \
torch_sparse \
torch_cluster \
torch_spline_conv \
-f https://data.pyg.org/whl/torch-2.0.0+cu118.html
-f ${PYG_URL}

rapids-print-env

Expand All @@ -235,12 +244,11 @@ if [[ "${RAPIDS_CUDA_VERSION}" == "11.8.0" ]]; then
conda deactivate
conda activate test
set -u

else
rapids-logger "skipping cugraph_pyg pytest on ARM64"
fi
else
rapids-logger "skipping cugraph_pyg pytest on CUDA != 11.8"
rapids-logger "skipping cugraph_pyg pytest on CUDA!=11.8"
fi

# test cugraph-equivariant
Expand All @@ -253,7 +261,7 @@ if [[ "${RAPIDS_CUDA_VERSION}" == "11.8.0" ]]; then
rapids-mamba-retry install \
--channel "${CPP_CHANNEL}" \
--channel "${PYTHON_CHANNEL}" \
--channel pytorch \
--channel conda-forge \
--channel nvidia \
cugraph-equivariant
pip install e3nn==0.5.1
Expand Down
46 changes: 27 additions & 19 deletions ci/test_wheel_cugraph-pyg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,33 @@ python -m pip install $(ls ./dist/${python_package_name}*.whl)[test]
export RAPIDS_DATASET_ROOT_DIR="$(realpath datasets)"

if [[ "${CUDA_VERSION}" == "11.8.0" ]]; then
rapids-logger "Installing PyTorch and PyG dependencies"
PYTORCH_URL="https://download.pytorch.org/whl/cu118"
rapids-retry python -m pip install torch==2.1.0 --index-url ${PYTORCH_URL}
rapids-retry python -m pip install torch-geometric==2.4.0
rapids-retry python -m pip install \
pyg_lib \
torch_scatter \
torch_sparse \
torch_cluster \
torch_spline_conv \
-f https://data.pyg.org/whl/torch-2.1.0+cu118.html

rapids-logger "pytest cugraph-pyg (single GPU)"
pushd python/cugraph-pyg/cugraph_pyg
python -m pytest \
--cache-clear \
--ignore=tests/mg \
tests
popd
PYG_URL="https://data.pyg.org/whl/torch-2.1.0+cu118.html"
else
rapids-logger "skipping cugraph-pyg wheel test on CUDA!=11.8"
PYTORCH_URL="https://download.pytorch.org/whl/cu121"
PYG_URL="https://data.pyg.org/whl/torch-2.1.0+cu121.html"
fi
rapids-logger "Installing PyTorch and PyG dependencies"
rapids-retry python -m pip install torch==2.1.0 --index-url ${PYTORCH_URL}
rapids-retry python -m pip install torch-geometric==2.4.0
rapids-retry python -m pip install \
ogb \
pyg_lib \
torch_scatter \
torch_sparse \
torch_cluster \
torch_spline_conv \
-f ${PYG_URL}

rapids-logger "pytest cugraph-pyg (single GPU)"
pushd python/cugraph-pyg/cugraph_pyg
python -m pytest \
--cache-clear \
--ignore=tests/mg \
tests
# Test examples
for e in "$(pwd)"/examples/*.py; do
rapids-logger "running example $e"
python $e
done
popd
1 change: 0 additions & 1 deletion conda/environments/all_cuda-118_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ channels:
- rapidsai
- rapidsai-nightly
- dask/label/dev
- pytorch
- pyg
- dglteam/label/cu118
- conda-forge
Expand Down
1 change: 0 additions & 1 deletion conda/environments/all_cuda-122_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ channels:
- rapidsai
- rapidsai-nightly
- dask/label/dev
- pytorch
- pyg
- dglteam/label/cu118
- conda-forge
Expand Down
1 change: 0 additions & 1 deletion dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,6 @@ channels:
- rapidsai
- rapidsai-nightly
- dask/label/dev
- pytorch
- pyg
- dglteam/label/cu118
- conda-forge
Expand Down
17 changes: 14 additions & 3 deletions docs/cugraph/source/installation/source_build.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ __Compilers:__

__CUDA:__
* CUDA 11.2+
* NVIDIA driver 450.80.02+
* Pascal architecture or better
* NVIDIA driver 470.42.01 or newer
* NVIDIA GPU, Volta architecture or later, with [compute capability](https://developer.nvidia.com/cuda-gpus) 7.0+

Further details and download links for these prerequisites are available on the
[RAPIDS System Requirements page](https://docs.rapids.ai/install#system-req).
Expand Down Expand Up @@ -42,6 +42,10 @@ files](https://github.com/rapidsai/cugraph/blob/main/conda/environments).
# for CUDA 11.x
conda env create --name cugraph_dev --file $CUGRAPH_HOME/conda/environments/all_cuda-118_arch-x86_64.yaml

# for CUDA 12.x
conda env create --name cugraph_dev --file $CUGRAPH_HOME/conda/environments/all_cuda-12.2_arch-x86_64.yaml


# activate the environment
conda activate cugraph_dev

Expand All @@ -55,6 +59,13 @@ The environment can be updated as cugraph adds/removes/updates its dependencies.
# for CUDA 11.x
conda env update --name cugraph_dev --file $CUGRAPH_HOME/conda/environments/all_cuda-118_arch-x86_64.yaml
conda activate cugraph_dev

# for CUDA 12.x
conda env update --name cugraph_dev --file $CUGRAPH_HOME/conda/environments/all_cuda-122_arch-x86_64.yaml
conda activate cugraph_dev



```

### Build and Install
Expand Down Expand Up @@ -167,7 +178,7 @@ Run either the C++ or the Python tests with datasets
make test
```

Note: This conda installation only applies to Linux and Python versions 3.8/3.10.
Note: This conda installation only applies to Linux and Python versions 3.8/3.11.

### (OPTIONAL) Set environment variable on activation

Expand Down
2 changes: 1 addition & 1 deletion notebooks/algorithms/centrality/Betweenness.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"source": [
"Betweenness centrality of a node 𝑣 is the sum of the fraction of all-pairs shortest paths that pass through 𝑣\n",
"\n",
"<img src=\"https://latex.codecogs.com/png.latex?c_B(v)&space;=\\sum_{s,t&space;\\in&space;V}&space;\\frac{\\sigma(s,&space;t|v)}{\\sigma(s,&space;t)}\" title=\"c_B(v) =\\sum_{s,t \\in V} \\frac{\\sigma(s, t|v)}{\\sigma(s, t)}\" />\n"
"$c_B(v) =\\sum_{s,t \\in V} \\frac{\\sigma(s, t|v)}{\\sigma(s, t)}$"
]
},
{
Expand Down
9 changes: 4 additions & 5 deletions notebooks/algorithms/centrality/Eigenvector.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,12 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The eigenvector centrality for node i is the\n",
"i-th element of the vector x defined by the eigenvector equation.\n",
"For a graph with V vertices where $A = (A_v,t)$ is the adjacency matrix, the Eigenvector centrality score of vertex $v$ is defined as\n",
"\n",
"<img src=\"https://wikimedia.org/api/rest_v1/media/math/render/svg/51c506ef0f23db1086b00ff6e5da847ff53cf5e9\" />\n",
"\n",
"$x_v = \\frac{1}{\\lambda}{\\sum_{t \\in M(v)}}x_t = \\frac{1}{\\lambda}{\\sum_{t \\in V}{a_v,x_t}}$\n",
"\n",
"Where M(v) is the adjacency list for the set of vertices(v) and λ is a constant.\n",
"Where $M(v)$ is the neighbor set for $v$ and λ is a constant.\n",
"\n",
"[Learn more about EigenVector Centrality](https://www.sci.unich.it/~francesc/teaching/network/eigenvector.html)\n"
]
Expand Down Expand Up @@ -314,7 +313,7 @@
"metadata": {},
"source": [
"___\n",
"Copyright (c) 2022-2023, NVIDIA CORPORATION.\n",
"Copyright (c) 2022-2024, NVIDIA CORPORATION.\n",
"\n",
"Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n",
"\n",
Expand Down
18 changes: 9 additions & 9 deletions notebooks/algorithms/centrality/Katz.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@
"\n",
" G: cugraph.Graph object\n",
" alpha: float, Attenuation factor. default is 0.1\n",
" max_iter: int, The maximum number of iterations before an answer is returned. \n",
" This can be used to limit the execution time and do an early exit \n",
" before the solver reaches the convergence tolerance. If this value \n",
" max_iter: int, The maximum number of iterations before an answer is returned.\n",
" This can be used to limit the execution time and do an early exit\n",
" before the solver reaches the convergence tolerance. If this value\n",
" is lower or equal to 0 cuGraph will use the default value, which is 100\n",
" tol: float, Set the tolerance the approximation, this parameter should be a small \n",
" magnitude value. The lower the tolerance the better the approximation. If \n",
" this value is 0.0f, cuGraph will use the default value which is 0.00001. \n",
" Setting too small a tolerance can lead to non-convergence due to numerical \n",
" tol: float, Set the tolerance the approximation, this parameter should be a small\n",
" magnitude value. The lower the tolerance the better the approximation. If\n",
" this value is 0.0f, cuGraph will use the default value which is 0.00001.\n",
" Setting too small a tolerance can lead to non-convergence due to numerical\n",
" roundoff. Usually values between 0.01 and 0.00001 are acceptable.\n",
" nstart: cuDataFrame, GPU Dataframe containing the initial guess for katz centrality. \n",
" Default is None\n",
Expand All @@ -58,8 +58,8 @@
"\n",
"\n",
"The value of _alpha_ should be<br>\n",
"<img src=\"https://latex.codecogs.com/gif.latex?\\alpha&space;<&space;\\frac{1}{\\lambda&space;_{max}&space;}\" title=\"\\alpha < \\frac{1}{\\lambda _{max} }\" />\n",
"currently the user is responsible for setting alpha appropiatly. \n",
"$\\alpha < \\frac{1}{\\lambda _{max} }$\n",
"currently the user is responsible for setting alpha appropriately.\n",
"\n",
"### _NOTICE_\n",
"There is a difference between how cuGraph and how NetworkX computes the Katz centrality score. That difference leads to the scores not matching. cuGraph does not currently support the 'beta' and 'weight' parameters as seen in the corresponding networkX call. The cuGraph implementation is based on a relaxed version of Katz defined by Foster with a reduced computational complexity of O(n+m)\n",
Expand Down
25 changes: 22 additions & 3 deletions notebooks/algorithms/link_analysis/Pagerank.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,22 @@
" * For more advanced renumbering support, see the examples in `structure/renumber.ipynb` and `structure/renumber-2.ipynb`\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The formula for Pagerank is:\n",
"\n",
"$PR(A) = \\frac{1 - d}{N} + d \\times \\left( \\sum_{i=1}^{N} \\frac{PR(T_i)}{C(T_i)} \\right)$\n",
"\n",
"In the formula:\n",
"* $PR(A)$ is the pagerank of A\n",
"* $d$ is damping factor which represents the probability of following an outgoing edge. A common default is 0.85\n",
"* $N$ is the total number of webpages\n",
"* $T_i$ are pages containing links to page A\n",
"* $C(T_i)$ is the number of links from node $T_i$"
]
},
{
"attachments": {},
"cell_type": "markdown",
Expand Down Expand Up @@ -306,7 +322,7 @@
"source": [
"----\n",
"\n",
"a PageRank score of _0.10047_ is very low, which can be an indication that there is no more central vertex than any other. Rather than just looking at the top score, let's look at the top three vertices and see if there are any insights that can be inferred. \n",
"a PageRank score of _0.100917324_ is very low, which can be an indication that there is no more central vertex than any other. Rather than just looking at the top score, let's look at the top three vertices and see if there are any insights that can be inferred. \n",
"\n",
"Since this is a very small graph, let's just sort and get the first three records"
]
Expand Down Expand Up @@ -353,6 +369,9 @@
"metadata": {},
"outputs": [],
"source": [
"# this started the vertices with 1 instead of 0 to coincide with the diagram\n",
"d['vertex'] = d['vertex']+1\n",
"\n",
"d.sort_values('out_degree', ascending=False).head(3)"
]
},
Expand Down Expand Up @@ -428,7 +447,7 @@
"metadata": {},
"source": [
"___\n",
"Copyright (c) 2019-2023, NVIDIA CORPORATION.\n",
"Copyright (c) 2019-2024, NVIDIA CORPORATION.\n",
"\n",
"Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n",
"\n",
Expand All @@ -453,7 +472,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.11.8"
},
"vscode": {
"interpreter": {
Expand Down
Loading

0 comments on commit 8183ff7

Please sign in to comment.