nx-cugraph#
nx-cugraph
is a NetworkX backend that provides GPU acceleration to many popular NetworkX algorithms.
By simply installing and enabling nx-cugraph, users can see significant speedup on workflows where performance is hindered by the default NetworkX implementation.
Users can have GPU-based, large-scale performance without changing their familiar and easy-to-use NetworkX code.
Timed result from running the following code snippet (called demo.ipy
, showing NetworkX with vs. without nx-cugraph
)
import pandas as pd
import networkx as nx
url = "https://data.rapids.ai/cugraph/datasets/cit-Patents.csv"
df = pd.read_csv(url, sep=" ", names=["src", "dst"], dtype="int32")
G = nx.from_pandas_edgelist(df, source="src", target="dst")
%time result = nx.betweenness_centrality(G, k=10)
user@machine:/# ipython demo.ipy
CPU times: user 7min 36s, sys: 5.22 s, total: 7min 41s
Wall time: 7min 41s
user@machine:/# NX_CUGRAPH_AUTOCONFIG=True ipython demo.ipy
CPU times: user 4.14 s, sys: 1.13 s, total: 5.27 s
Wall time: 5.32 s
Zero Code Change Acceleration Just set the environment variable |
Run the same code on CPU or GPU Nothing changes, not even your import statements, when going from CPU to GPU. |
nx-cugraph
is now Generally Available (GA) as part of the RAPIDS
package. See RAPIDS
Quick Start to get up-and-running with nx-cugraph
.