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

Benchmark scripts and pyg::sampler::Mapper #45

Merged
merged 9 commits into from
May 11, 2022
Merged

Benchmark scripts and pyg::sampler::Mapper #45

merged 9 commits into from
May 11, 2022

Conversation

rusty1s
Copy link
Member

@rusty1s rusty1s commented May 6, 2022

I thought pyg::sampler::Mapper is a clever way to re-use mapping functionality across several samplers. In addition, I noticed that the usage of std::unordered_map slows down subgraph creation by a significant factor, so I use a simple heuristic to determine if its usage is actually advantageous.

@codecov-commenter
Copy link

codecov-commenter commented May 6, 2022

Codecov Report

Merging #45 (98b9522) into master (54e2907) will decrease coverage by 2.21%.
The diff coverage is 80.76%.

@@            Coverage Diff             @@
##           master      #45      +/-   ##
==========================================
- Coverage   99.48%   97.27%   -2.22%     
==========================================
  Files           9       10       +1     
  Lines         195      220      +25     
==========================================
+ Hits          194      214      +20     
- Misses          1        6       +5     
Impacted Files Coverage Δ
pyg_lib/csrc/sampler/cpu/mapper.h 80.00% <80.00%> (ø)
pyg_lib/csrc/sampler/cpu/subgraph_kernel.cpp 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 54e2907...98b9522. Read the comment docs.

@rusty1s rusty1s requested review from yaoyaowd and ZenoTan May 6, 2022 09:51
@rusty1s rusty1s changed the title Benchmark scripts and pyg::Mapper Benchmark scripts and pyg::sampler::Mapper May 6, 2022
@ZenoTan
Copy link
Member

ZenoTan commented May 6, 2022

Could you put some benchmark numbers here? Thanks.

@rusty1s
Copy link
Member Author

rusty1s commented May 6, 2022

nodes_frac: 1/100
pyg::subgraph:  0.004508747020736337
PyG edge_index: 0.053372457972727716

nodes_frac: 1/10
pyg::subgraph:  0.042601466993801296
PyG edge_index: 0.05778796493541449

nodes_frac: 1/2
pyg::subgraph:  0.06260621605906636
PyG edge_index: 0.0992975200060755

@rusty1s rusty1s merged commit afcc419 into master May 11, 2022
@rusty1s rusty1s deleted the benchmark branch May 11, 2022 11:22
auto deg_data = deg.data_ptr<scalar_t>();
auto grain_size = at::internal::GRAIN_SIZE;
at::parallel_for(0, nodes.size(0), grain_size, [&](int64_t _s, int64_t _e) {
for (scalar_t i = _s; i < _e; ++i) {
for (size_t i = _s; i < _e; ++i) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I like these nit.

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

Successfully merging this pull request may close these issues.

4 participants