Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates README file to include nx-cugraph user documentation, adds nx-cugraph to main README #3984

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion README.md
rlratzel marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,13 @@
</div>

-----
## News

## Table of content
[nx-cugraph](./python/nx-cugraph/README.md) is a NetworkX backend that's available to provide GPU acceleration to NetworkX.
rlratzel marked this conversation as resolved.
Show resolved Hide resolved

-----

## Table of contents
- Installation
- [Getting cuGraph Packages](./docs/cugraph/source/installation/getting_cugraph.md)
- [Building from Source](./docs/cugraph/source/installation/source_build.md)
Expand All @@ -52,6 +57,7 @@
- [External Data Types](./readme_pages/data_types.md)
- [pylibcugraph](./readme_pages/pylibcugraph.md)
- [libcugraph (C/C++/CUDA)](./readme_pages/libcugraph.md)
- [nx-cugraph](./python/nx-cugraph/README.md)
- [cugraph-service](./readme_pages/cugraph_service.md)
- [cugraph-dgl](./readme_pages/cugraph_dgl.md)
- [cugraph-ops](./readme_pages/cugraph_ops.md)
Expand Down
Binary file modified img/Stack2.png
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should update this in release 24.02 to show cuGraph-DGL, cuGraph-PyG, cuGraph-ops, WholeGraph, etc. I'll link an issue here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#3986

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The software stack image is also really out of date (@acostadon ). That is part of the 24.02 make everything perfect push

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
79 changes: 63 additions & 16 deletions python/nx-cugraph/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,78 @@

## Description
[RAPIDS](https://rapids.ai) nx-cugraph is a [backend to NetworkX](https://networkx.org/documentation/stable/reference/classes/index.html#backends)
with minimal dependencies (`networkx`, `cupy`, and `pylibcugraph`) to run graph algorithms on the GPU.
to run supported algorithms with GPU acceleration.

### Contribute
## System Requirements

Follow instructions for [contributing to cugraph](https://github.com/rapidsai/cugraph/blob/branch-23.12
and [building from source](https://docs.rapids.ai/api/cugraph/stable/installation/source_build/), then build nx-cugraph in develop (i.e., editable) mode:
```
$ ./build.sh nx-cugraph --pydevelop
```
Using nx-cugraph with this notebook requires the following:
rlratzel marked this conversation as resolved.
Show resolved Hide resolved

* NVIDIA GPU, Pascal architecture or later
* CUDA 11.2, 11.4, 11.5, 11.8, or 12.0
* Python versions 3.9, 3.10, or 3.11
* NetworkX >= version 3.2

More details about system requirements can be found in the [RAPIDS System Requirements documentation](https://docs.rapids.ai/install#system-req)..

## Installation

### Run tests
nx-cugraph can be installed using either conda or pip.

Run nx-cugraph tests from `cugraph/python/nx-cugraph` directory:
### conda
```
$ pytest
conda install -c rapidsai-nightly -c conda-forge -c nvidia nx-cugraph
```
Run nx-cugraph benchmarks:
### pip
```
$ pytest --bench
python -m pip install nx-cugraph-cu11 --extra-index-url https://pypi.nvidia.com
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need a --pre or >=23.10.0a0 specifier since the latest changes? @vyasr may know. Maybe based on the note below about these being non-nightlies it's not an issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I was relying on the note below that since (I don't believe) we have a way to provide nightly 23.12 wheels. Although if there is a way I'm not aware of, I'd love to be able to describe how users can get nightly 23.12 wheels. @vyasr any thoughts?

```
Run networkx tests (requires networkx version 3.2):
Notes:

* Nightly wheel builds will not be available until the 23.12 release, therefore the index URL for the stable release version is being used in the pip install command above.
* Additional information relevant to installing any RAPIDS package can be found [here](https://rapids.ai/#quick-start).

## Enabling nx-cugraph

### `NETWORKX_AUTOMATIC_BACKENDS` environment variable.
The `NETWORKX_AUTOMATIC_BACKENDS` environment variable can be used to have NetworkX automatically dispatch to specified backends an API is called that the backend supports.
Set `NETWORKX_AUTOMATIC_BACKENDS=cugraph` to use nx-cugraph to GPU accelerate supported APIs with no code changes.
Example:
```
$ ./run_nx_tests.sh
bash> NETWORKX_AUTOMATIC_BACKENDS=cugraph python my_networkx_script.py
```
Additional arguments may be passed to pytest such as:

### `backend=` keyword argument
To explicitly specify a particular backend for an API, use the `backend=`
keyword argument. This argument takes precedence over the
`NETWORKX_AUTOMATIC_BACKENDS` environment variable. This requires anyone
running code that uses the `backend=` keyword argument to have the specified
backend installed.

Example:
```
nx.betweenness_centrality(cit_patents_graph, k=k, backend="cugraph")
```

### Type-based dispatching

NetworkX also supports automatically dispatching to backends associated with
specific graph types. Like the `backend=` keyword argument example above, this
requires the user to write code for a specific backend, and therefore requires
the backend to be installed, but has the advantage of ensuring a particular
behavior without the potential for runtime conversions.

To use type-based dispatching with nx-cugraph, the user must import the backend
directly in their code to access the utilities provided to create a Graph
instance specifically for the nx-cugraph backend.

Example:
```
$ ./run_nx_tests.sh -x --sw -k betweenness
import networkx as nx
import nx_cugraph as nxcg

G = nx.Graph()
...
nxcg_G = nxcg.from_networkx(G) # conversion happens once here
nx.betweenness_centrality(nxcg_G, k=1000) # nxcg Graph type causes cugraph backend
# to be used, no conversion necessary
```
Loading