Skip to content

Segmented inclusive_scan and exclusive_scan implementation - #2287

Merged
hkaiser merged 31 commits into
TheHPXProject:masterfrom
Sanac:seg_scan
Sep 25, 2016
Merged

hkaiser merged 31 commits into
TheHPXProject:masterfrom
Sanac:seg_scan

Conversation

@Sanac

@Sanac Sanac commented Aug 11, 2016

Copy link
Copy Markdown
Contributor
  • Added segmented inclusive_scan. (see #1338)
  • Added some simple tests

@biddisco

Copy link
Copy Markdown
Contributor

We had a long discussion about this today and my concern is that the first scan phase is done by each partition, but then the whold scan result is returned to the root partition where the merge/updte steps are performed and the final result vector is held on the root partition.

The reason for this was to do with iterators.

It seem that if the algorithm is called with a partitioned_vector as input, and a partitioned_vector as output (or in place), then those iterators are already present on the relevant partitions and the solution presented here is only useful if the output/dest iterator is actually a normal vector - and not a partitioned one.

@hkaiser - can you add a few lines to explain how to ensure that the merge/update phases will happen on the locality/partition that owns it, rather than back on the root.

@hkaiser

hkaiser commented Aug 11, 2016

Copy link
Copy Markdown
Contributor

can you add a few lines to explain how to ensure that the merge/update phases will happen on the locality/partition that owns it, rather than back on the root.

There is an example demonstrating how to work with the local parts of a partitioned vector only: https://github.com/STEllAR-GROUP/hpx/blob/master/examples/quickstart/partitioned_vector_spmd_foreach.cpp

@Sanac

Sanac commented Aug 19, 2016

Copy link
Copy Markdown
Contributor Author
  • Added optimization to use locality of data if available
  • In-place usage of the scan possible
  • Changed tests so that changes are tested
  • Also optimized tests so that less time is wasted doing setup and verification

@Sanac

Sanac commented Aug 22, 2016

Copy link
Copy Markdown
Contributor Author
  • Refactoring of code in preparation for exclusive scan
  • Code can be reviewed

@Sanac Sanac closed this Aug 22, 2016
@Sanac Sanac reopened this Aug 22, 2016
@Sanac Sanac changed the title Segmented inclusive_scan implementation Segmented inclusive_scan and exclusive implementation Aug 23, 2016
@Sanac Sanac changed the title Segmented inclusive_scan and exclusive implementation Segmented inclusive_scan and exclusive_scan implementation Aug 23, 2016
@Sanac

Sanac commented Aug 23, 2016

Copy link
Copy Markdown
Contributor Author
  • Added some comments in code
  • Added exclusive scan with tests to PR


if(beg_in != end_in) {
std::uint64_t in_id = traits_in::get_id(sit_in).get_msb();
std::uint64_t out_id = traits_in::get_id(sit_in).get_msb();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shouldn't this compare the whole id and not only the msb?

@Sanac

Sanac commented Sep 5, 2016

Copy link
Copy Markdown
Contributor Author
  • Fixed comparison of msb to locality id
  • Invocation of std::distance only if ids are the same
  • Passed down init by const&
  • Capturing of op done by value

@Sanac

Sanac commented Sep 12, 2016

Copy link
Copy Markdown
Contributor Author
  • Pass localities via parameter in the tests

@hkaiser hkaiser left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, thanks a lot!

@hkaiser
hkaiser merged commit aef13f1 into TheHPXProject:master Sep 25, 2016
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.

3 participants