cugraph_dgl#
描述#
RAPIDS cugraph_dgl 提供了 DGLGraph 类的一个鸭子类型版本,该版本使用 cugraph 来存储图结构和节点/边特征数据。使用 cugraph 作为后端使得 DGL 用户能够访问一组用于图分析的 GPU 加速算法,例如中心性计算和社区检测。
Conda#
使用以下命令安装和更新 cugraph-dgl 及所需的依赖项
conda install mamba -n base -c conda-forge
mamba install cugraph-dgl -c rapidsai-nightly -c rapidsai -c pytorch -c conda-forge -c nvidia -c dglteam
从源代码构建#
创建 conda 开发环境#
conda env create -n cugraph_dgl_dev --file conda/environments/all_cuda-125_arch-x86_64.yaml
以可编辑模式安装#
pip install -e .
运行测试#
pytest tests/*
用法#
from cugraph_dgl.convert import cugraph_storage_from_heterograph
cugraph_g = cugraph_storage_from_heterograph(dgl_g)
sampler = dgl.dataloading.NeighborSampler(
[15, 10, 5], prefetch_node_feats=['feat'], prefetch_labels=['label'])
train_dataloader = dgl.dataloading.DataLoader(
cugraph_g,
train_idx,
sampler,
device=device,
batch_size=1024,
shuffle=True,
drop_last=False,
num_workers=0)
Copyright (c) 2023-2025, NVIDIA CORPORATION.
根据 Apache 许可证版本 2.0(“许可证”)获得许可;除非遵守许可证,否则您不得使用此文件。您可以在 https://apache.ac.cn/licenses/LICENSE-2.0 获取许可证副本
除非适用法律要求或书面同意,根据许可证分发的软件按“原样”分发,不附带任何明示或暗示的保证或条件。请参阅许可证,了解管理许可证权限和限制的特定语言。