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

[GraphBolt] Improve sample_neighbors() on CPU with prob/mask by 6.47%, fixing #7462 #7794

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

az15240
Copy link
Collaborator

@az15240 az15240 commented Sep 10, 2024

Description

A one line change in NonUniformPickOp, to make prob/mask samplings go faster.

Runtime data is supported by this sheet, by running benchmark_graphbolt_sampling.py locally. Note that this function only works for prob/mask, so I left out data for cases that probs=None.

Checklist

Please feel free to remove inapplicable items for your PR.

  • The PR title starts with [$CATEGORY] (such as [NN], [Model], [Doc], [Feature]])
  • I've leverage the tools to beautify the python and c++ code.
  • The PR is complete and small, read the Google eng practice (CL equals to PR) to understand more about small PR. In DGL, we consider PRs with less than 200 lines of core code change are small (example, test and documentation could be exempted).
  • All changes have test coverage
  • [ x] Code is well-documented
  • To the best of my knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change
  • Related issue is referred in this PR
  • If the PR is for a new model/paper, I've updated the example index here.

Changes

@dgl-bot
Copy link
Collaborator

dgl-bot commented Sep 10, 2024

To trigger regression tests:

  • @dgl-bot run [instance-type] [which tests] [compare-with-branch];
    For example: @dgl-bot run g4dn.4xlarge all dmlc/master or @dgl-bot run c5.9xlarge kernel,api dmlc/master

@dgl-bot
Copy link
Collaborator

dgl-bot commented Sep 10, 2024

Commit ID: 1fc5f8a

Build ID: 1

Status: ✅ CI test succeeded.

Report path: link

Full logs path: link

@dgl-bot
Copy link
Collaborator

dgl-bot commented Sep 12, 2024

Commit ID: f6819dd1089299f7fbff4c05590eff2d1e191bfe

Build ID: 2

Status: ✅ CI test succeeded.

Report path: link

Full logs path: link

@az15240 az15240 changed the title [GraphBolt] Improve sample_neighbors() on CPU with prob/mask by 4.12%, fixing #7462 [GraphBolt] Improve sample_neighbors() on CPU with prob/mask by 6.47%, fixing #7462 Sep 12, 2024
@az15240
Copy link
Collaborator Author

az15240 commented Sep 12, 2024

Update: simply removing the .squeeze(1) call will also work, improving performance by 6.47%.

@mfbalin
Copy link
Collaborator

mfbalin commented Sep 12, 2024

@az15240 6.5% speedup with such a simple change is quite good but I wouldn't say this change fixes the issue altogether. Do you think there are other opportunities to further speed it up?

@az15240
Copy link
Collaborator Author

az15240 commented Sep 12, 2024

@az15240 6.5% speedup with such a simple change is quite good but I wouldn't say this change fixes the issue altogether. Do you think there are other opportunities to further speed it up?

@mfbalin I think the main reason for this 14x slower is because for certain combination of parameters, the sampling time is too fast. It is not necessarily because our sampling is bad.

In regression, when replace=False or when fanouts=[-1], the cases that probs=None rans really fast. This pattern is not found when replace=True.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants