dmlc / dgl

Python package built to ease deep learning on graph, on top of existing DL frameworks.
http://dgl.ai
Apache License 2.0
13.36k stars 3k forks source link

`import dgl` automatically import graphbolt #7746

Closed TristonC closed 2 weeks ago

TristonC commented 2 weeks ago

🐛 Bug

User of dgl may not need graphbolt, so import dgl should not automatically import graphbolt. While in the latest dgl, import dgl will automatically import grapbolt

To Reproduce

Steps to reproduce the behavior:

  1. python -c "import dgl;print(dgl.version)"

And it shows graphbolts warning:

root@59f2c7030f7b:/opt/dgl/dgl-source/examples/graphbolt/pyg# python -c "import dgl;print(dgl.__version__)"
/usr/local/lib/python3.10/dist-packages/dgl/graphbolt/__init__.py:114: GBWarning: 
An experimental feature for CUDA allocations is turned on for better allocation
pattern resulting in better memory usage for minibatch GNN training workloads.
See https://pytorch.org/docs/stable/notes/cuda.html#optimizing-memory-usage-with-pytorch-cuda-alloc-conf,
and set the environment variable `PYTORCH_CUDA_ALLOC_CONF=expandable_segments:False`
if you want to disable it and set it True to acknowledge and disable the warning.

  gb_warning(WARNING_STR_TO_BE_SHOWN)
2.4

Expected behavior

Do not import graphbolt in this case.

Environment

mfbalin commented 2 weeks ago

I guess #7676 was not enough to ensure this wouldn't happen, or a new change caused GraphBolt to be imported on an import of DGL.

mfbalin commented 2 weeks ago

Due to the following line: https://github.com/dmlc/dgl/blob/6bce0cdfc50190911f34fe8d7407d6ee528c6263/python/dgl/dataloading/__init__.py#L14