Skip to content

Parallelized AdjArrayBQM constructor from dense array#725

Closed
amahmudwave wants to merge 1 commit into
dwavesystems:mainfrom
amahmudwave:master
Closed

Parallelized AdjArrayBQM constructor from dense array#725
amahmudwave wants to merge 1 commit into
dwavesystems:mainfrom
amahmudwave:master

Conversation

@amahmudwave

Copy link
Copy Markdown

Parallelized AdjArrayBQM constructor from dense array. Threads in parallel first calculate the size
of the resulting array and indices where they should start writing to. Then in the second phase they
write into the BQM. The bottleneck in this method is calling the resize function on the vector of the
BQM as resize() also initializes the data, this cannot be circumvented without changing data structure
or using custom vectors/allocators. It is mentioned as a TODO if improvements to standard
vector::resize function is made.

sum_counters += prev_counter;
}

// TODO : This is the bottleneck for moderately dense input arrays.

@amahmudwave amahmudwave Sep 30, 2020

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@arcondello @shpface , I could not find a straightforward way of removing this bottleneck. Tried some approaches which work for vectors of primitive elements but not pairs. Let me know if you have any idea. Note I cannot reserve and pushback in parallel in the code below. This is a problem for very large dense matrices. Otherwise fine. With this bottleneck we get 10X speedup on 10 cores for dense matrices. Without would give us (20-40X) speedup though.

@amahmudwave

Copy link
Copy Markdown
Author

@shpface @arcondello This is ready for review.

@codecov-commenter

codecov-commenter commented Sep 30, 2020

Copy link
Copy Markdown

Codecov Report

Merging #725 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #725   +/-   ##
=======================================
  Coverage   91.93%   91.93%           
=======================================
  Files          63       63           
  Lines        4552     4552           
=======================================
  Hits         4185     4185           
  Misses        367      367           

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 0bbd8ef...92726cd. Read the comment docs.

@amahmudwave amahmudwave marked this pull request as draft October 1, 2020 16:38
@amahmudwave amahmudwave force-pushed the master branch 2 times, most recently from 784e82c to b38bb26 Compare October 1, 2020 17:15
@amahmudwave amahmudwave marked this pull request as ready for review October 1, 2020 17:17
@amahmudwave amahmudwave force-pushed the master branch 2 times, most recently from f1f95ba to d6252cc Compare October 1, 2020 17:49
}

// The aligned_malloc and aligned_free functions were written with the help of this link:
// https://stackoverflow.com/questions/38088732/explanation-to-aligned-malloc-implementation

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@arcondello arcondello changed the base branch from master to main November 27, 2020 20:30
@arcondello

Copy link
Copy Markdown
Member

No longer relevant, see #788

@arcondello arcondello closed this Jun 22, 2021
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