Skip to content

[REVIEW]Make dgl, pytorch optional imports for cugraph_dgl package#2936

Merged
rapids-bot[bot] merged 13 commits intorapidsai:branch-22.12from
VibhuJawa:make-dgl-pytorch-optional-import
Nov 16, 2022
Merged

[REVIEW]Make dgl, pytorch optional imports for cugraph_dgl package#2936
rapids-bot[bot] merged 13 commits intorapidsai:branch-22.12from
VibhuJawa:make-dgl-pytorch-optional-import

Conversation

@VibhuJawa
Copy link
Member

@VibhuJawa VibhuJawa commented Nov 15, 2022

This PR :

  1. makes dgl and pytorch optional and makes them a run-time dependency to allow them to built cleanly in the DLFW container environment.
    Verified locally as following (Can import cugraph_dgl in an environment without torch or dgl) :
>>> import cugraph_dgl
>>> import torch
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'torch'
>>> import dgl
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  1. Add versioneer to align the source built packages tag with cugraph.
(cugraph_dev) vjawa@dgx11:~/dgl/cugraph/python/cugraph-dgl$ pip install -e .
.....
Installing collected packages: cugraph-dgl
  Running setup.py develop for cugraph-dgl
Successfully installed cugraph-dgl-22.12.0a0+118.gd5390c16a
  1. Ensure that cugraph-dgl builds on py-3.8

Closes issue: #2939

  1. Fix a pytest ordering issue based on upstream testing.

CC: @rlratzel

@VibhuJawa VibhuJawa changed the title Make dgl pytorch optional import [WIP]Make dgl pytorch optional import Nov 15, 2022
@codecov-commenter
Copy link

codecov-commenter commented Nov 16, 2022

Codecov Report

Base: 60.80% // Head: 65.03% // Increases project coverage by +4.22% 🎉

Coverage data is based on head (6508135) compared to base (85c447b).
Patch has no changes to coverable lines.

Additional details and impacted files
@@               Coverage Diff                @@
##           branch-22.12    #2936      +/-   ##
================================================
+ Coverage         60.80%   65.03%   +4.22%     
================================================
  Files               122        5     -117     
  Lines              6891      163    -6728     
================================================
- Hits               4190      106    -4084     
+ Misses             2701       57    -2644     
Impacted Files Coverage Δ
python/cugraph/cugraph/link_prediction/sorensen.py
python/cugraph/cugraph/community/ecg.py
python/cugraph/cugraph/structure/graph_classes.py
python/cugraph/cugraph/dask/common/part_utils.py
python/cugraph/cugraph/structure/hypergraph.py
...graph/cugraph/centrality/betweenness_centrality.py
python/cugraph/cugraph/traversal/bfs.py
python/cugraph/cugraph/sampling/__init__.py
...n/cugraph/cugraph/dask/community/triangle_count.py
python/cugraph/cugraph/dask/cores/__init__.py
... and 107 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -0,0 +1,693 @@
# This file helps to compute a version number in source trees obtained from
Copy link
Member Author

Choose a reason for hiding this comment

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

Automatically generated file by versioneer.py following other sub-packages.

versionfile_source = cugraph_dgl/_version.py
versionfile_build = cugraph_dgl/_version.py
tag_prefix = v
parentdir_prefix = cugraph_dgl-
Copy link
Member Author

Choose a reason for hiding this comment

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

To create versions consitent with cugraph

@@ -0,0 +1,2205 @@

# Version: 0.28
Copy link
Member Author

Choose a reason for hiding this comment

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

Automatically generated file by versionieer

@VibhuJawa VibhuJawa added the non-breaking Non-breaking change label Nov 16, 2022
@VibhuJawa VibhuJawa changed the title [WIP]Make dgl pytorch optional import [REVIEW]Make dgl pytorch optional imports for cugraph_dgl package Nov 16, 2022
@VibhuJawa VibhuJawa added the improvement Improvement / enhancement to an existing function label Nov 16, 2022
@VibhuJawa VibhuJawa marked this pull request as ready for review November 16, 2022 02:39
@VibhuJawa VibhuJawa requested a review from a team as a code owner November 16, 2022 02:39
@VibhuJawa VibhuJawa changed the title [REVIEW]Make dgl pytorch optional imports for cugraph_dgl package [REVIEW]Make dgl, pytorch optional imports for cugraph_dgl package Nov 16, 2022
Comment on lines +143 to +153
# Assert same values sorted by src
exp_src_perm = exp_src.argsort()
exp_src = exp_src[exp_src_perm]
exp_dst = exp_dst[exp_src_perm]

cu_src_perm = cu_src.argsort()
cu_src = cu_src[cu_src_perm]
cu_dst = cu_dst[cu_src_perm]

np.testing.assert_equal(exp_dst, cu_dst)
np.testing.assert_equal(exp_src, cu_src)
Copy link
Member Author

Choose a reason for hiding this comment

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

Sort based on dst and then verify same results.

@VibhuJawa VibhuJawa added this to the 22.12 milestone Nov 16, 2022
@VibhuJawa
Copy link
Member Author

@rlratzel , All reviews addressed , please feel free to review again.

@rlratzel
Copy link
Contributor

@gpucibot merge

@rapids-bot rapids-bot bot merged commit 435e1c3 into rapidsai:branch-22.12 Nov 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Improvement / enhancement to an existing function non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants