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

[Performance] Fused sampling with compaction #5924

Merged
merged 10 commits into from
Jul 20, 2023

Conversation

agrabows
Copy link
Contributor

Description

Changes described and discussed in github RFC #5328.
This change introduces new algorithm for NeighborSampler class. This algorithm samples mini-batches from hetero/homo-geneous graphs in one c++ function that compacts functionalities of _CAPI_DGLToBlock and _CAPI_DGLSampleNeighbors reducing time of this process. Moreover sampled DGLBlocks are already in CSC/CSR format and as such they require no COOToCSR transformation for forward pass. Additional COO matrix is attached as well to avoid CSRTranspose function call when it would be necessary for backward pass.
Coauthor: @hesham-mostafa

Checklist

  • The PR title starts with [$CATEGORY] (such as [NN], [Model], [Doc], [Feature]])
  • I've leverage the tools to beautify the python and c++ code.
  • All changes have test coverage
  • 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

Changes

  • Modified NeighborSampler to use new algorithm as default when CPU is calculating
  • Heterograph sampling, relevant tests changed in test_sampling
  • Exclude Edges features, relevant tests changed in test_sampling

Benchmark configuration

  • ogbn-products and ogbn-papers100M datasets
  • DGL built with DUSE_LIBXSMM=ON DUSE_CUDA=OFF DBUILD_SPARSE=OFF
  • Benchmark script consists of sampling and forward_backward with 2-3 layers of SAGEConv
  • Script measured different batch_sizes (1024, 2048, 4096, 8192, 10240)
  • Script measured different fanouts (2-3 hops of (10, 15, 30) variations)
  • Speedup calculated as current_master_version_total_time/fused_sampling_version_total_time
  • Additional inference results for ogbn-products from AWS r6i.16xlarge (Intel(R) Xeon(R) Platinum 8375C CPU) machine
  • Measured on AWS r6i.32xlarge (Intel(R) Xeon(R) Platinum 8375C CPU) machine

Benchmark results

image
image
image
Most significant speedup observed for ogbn-papers100M (up to 3.9x) with low batch-size and small fanout
Only 3 cases were worse:
ogbn-papers100M batch-size 4096 fanout 15, 30, 15 - 0.95x
ogbn-papers100M batch-size 8192 fanout 10, 30 - 0.97x
ogbn-papers100M batch-size 8192 fanout 15, 15, 15 - 0.99x

@dgl-bot
Copy link
Collaborator

dgl-bot commented Jun 28, 2023

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 Jun 28, 2023

Commit ID: 8e42b719d7421f424b200c0e7e271ae4927a87c3

Build ID: 1

Status: ❌ CI test failed in Stage [Lint Check].

Report path: link

Full logs path: link

@dgl-bot
Copy link
Collaborator

dgl-bot commented Jun 28, 2023

Commit ID: 28936c1dc01ef5b1388a6041fa2e7f512d23ab19

Build ID: 2

Status: ❌ CI test failed in Stage [Lint Check].

Report path: link

Full logs path: link

@agrabows agrabows changed the title [Performance] Fused sampling with compaction [Draft][Performance] Fused sampling with compaction Jun 28, 2023
@dgl-bot
Copy link
Collaborator

dgl-bot commented Jun 28, 2023

Commit ID: 90c454d81e1bec9ac9f2a8620be5a741262885de

Build ID: 3

Status: ❌ CI test failed in Stage [Lint Check].

Report path: link

Full logs path: link

@dgl-bot
Copy link
Collaborator

dgl-bot commented Jun 28, 2023

Commit ID: 96010821bde9bae38c9546691e9ff14791983886

Build ID: 4

Status: ❌ CI test failed in Stage [Lint Check].

Report path: link

Full logs path: link

@agrabows agrabows changed the title [Draft][Performance] Fused sampling with compaction [Performance] Fused sampling with compaction Jun 28, 2023
@dgl-bot
Copy link
Collaborator

dgl-bot commented Jun 28, 2023

Commit ID: 90123250891d069e0dec1fa3fc9d0eaf79950cec

Build ID: 5

Status: ❌ CI test failed in Stage [CPU Build (Win64)].

Report path: link

Full logs path: link

@dgl-bot
Copy link
Collaborator

dgl-bot commented Jun 29, 2023

Commit ID: 98adf57f51f7cbe15231f5841fa478130766b1e8

Build ID: 6

Status: ❌ CI test failed in Stage [Tensorflow CPU Unit test].

Report path: link

Full logs path: link

@dgl-bot
Copy link
Collaborator

dgl-bot commented Jun 30, 2023

Commit ID: 6fc294ac0b541c4bad95c519b845db97cb65f7cc

Build ID: 7

Status: ❌ CI test failed in Stage [Tensorflow CPU Unit test].

Report path: link

Full logs path: link

@dgl-bot
Copy link
Collaborator

dgl-bot commented Jun 30, 2023

Commit ID: 3c5343cb87339237fff2782b48be2fa0955c0481

Build ID: 8

Status: ❌ CI test failed in Stage [Distributed Torch CPU Unit test].

Report path: link

Full logs path: link

@dgl-bot
Copy link
Collaborator

dgl-bot commented Jul 3, 2023

Commit ID: 5559243bcbf7b032079be83eb5d9518982df56dd

Build ID: 9

Status: ❌ CI test failed in Stage [Lint Check].

Report path: link

Full logs path: link

@dgl-bot
Copy link
Collaborator

dgl-bot commented Jul 3, 2023

Commit ID: d3ef8b3cb4bf45552e4f40f8090430c7a9b8bc63

Build ID: 10

Status: ✅ CI test succeeded.

Report path: link

Full logs path: link

@agrabows
Copy link
Contributor Author

agrabows commented Jul 4, 2023

@frozenbugs @jermainewang
Hi, I fixed all CI problems and I think this change is ready for review now

@jermainewang jermainewang removed their request for review July 17, 2023 01:27
@dgl-bot
Copy link
Collaborator

dgl-bot commented Jul 18, 2023

Commit ID: 3f61d85a5db3b298fbe3e844f27f8986221562fb

Build ID: 11

Status: ✅ CI test succeeded.

Report path: link

Full logs path: link

@dgl-bot
Copy link
Collaborator

dgl-bot commented Jul 19, 2023

Commit ID: 2f35f23

Build ID: 12

Status: ❌ CI test failed in Stage [CPU Build].

Report path: link

Full logs path: link

@dgl-bot
Copy link
Collaborator

dgl-bot commented Jul 19, 2023

Commit ID: ce0d545

Build ID: 13

Status: ⚪️ CI test cancelled due to overrun.

Report path: link

Full logs path: link

@dgl-bot
Copy link
Collaborator

dgl-bot commented Jul 19, 2023

Commit ID: 8ae7ab6

Build ID: 14

Status: ✅ CI test succeeded.

Report path: link

Full logs path: link

@frozenbugs frozenbugs merged commit 4135b1b into dmlc:master Jul 20, 2023
Rhett-Ying pushed a commit that referenced this pull request Aug 10, 2023
Co-authored-by: Hesham Mostafa <hesham.mostafa@intel.com>
DominikaJedynak pushed a commit to DominikaJedynak/dgl that referenced this pull request Mar 12, 2024
Co-authored-by: Hesham Mostafa <hesham.mostafa@intel.com>
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.

4 participants