Skip to content

Basic Toolchain for Partitioning#3603

Merged
TheMarex merged 30 commits intomasterfrom
tools/partitionining/graph_view
Mar 1, 2017
Merged

Basic Toolchain for Partitioning#3603
TheMarex merged 30 commits intomasterfrom
tools/partitionining/graph_view

Conversation

@MoKob
Copy link
Copy Markdown

@MoKob MoKob commented Jan 23, 2017

Builds basic infrastructure outline in #3586, defining interfaces and connections between the different parts. Foundation for #3205.

Tasks

  • Immutable (Sub-) Graph View
  • Spatial Order
  • Dinic's Max-Flow / Min-Cut
  • Inertial Flow
  • Optimized Inertial Flow, rotating slope, in parallel
  • Recursive Bisection
  • Apply to Compressed Node Based Graph from osrm-extract
  • Run Tarjan for big / small component detection
  • Parallelize recursive bisection, outlined in Calculating Flows Recursively #3586
  • Do bisection in parallel on all big components
  • Fake first level for big components, aggregate all small components
  • Annotation mechanism for combining bisection ids -> levels
  • Unit tests for all the things ^
    • partition graph
    • graph view
    • cut algorithm
    • scc integration
    • recursive bisection
  • fix windows builds
  • Check why sanitizers trigger for TBB (probably false positive)

Once done

  • review
  • adjust for comments

++node_id;

return {static_cast<std::size_t>(std::distance(edges.begin(), edges_of_node)), coordinate};
};
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hm can we clean this one up - the stateful lambda with init captures and transform is a bit ugly

public:
InertialFlow(const GraphView &view);

std::vector<bool> ComputePartition(const double balance, const double source_sink_rate);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What do you mean with balance and source sink rate here?

If balance is 0.25 we take 0.25 * nodes as source and 0.25 * nodes as sinks, right?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also seeing you implemented the skeleton as stateful class holding a graph view ref. I suppose you want to abstract the try-n-cuts-take-best inside ComputePartition (?)

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.

The interface here is just a placeholder for me to imagine what would happen:

  • balance would be a guideline for the cuts to be chosen. Any flow that is computed gives a large number of possible cuts (e.g. a-b-c-d-e-f-g-h can be split on any intermediate node with an identical cut size). The balance would guide the flow algorithm which of the possible minimal flows to report / what kind of effort to spend on balancing the cuts in size
  • the source/sink-rate would be for the initialisation of the flow algorithm. The inertial flow picks X percent of the nodes as source/sink, right? So that would be the X.
  • For the statefulness: we can easily make this not stateful and make the flow algorithm do the best out of n part here. That was just to get something working quickly to iterate on.

LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

License can go

MoKob pushed a commit that referenced this pull request Jan 25, 2017
* Implements Random Access Iterator Facade for EdgeIDIterator

* Makes StaticGraph Node and Edge requirements explicit

* Cleans up Bisection Graph, Node and Edge

* Cleans up GraphView
@MoKob MoKob force-pushed the tools/partitionining/graph_view branch from 842bd66 to 50b03a9 Compare January 25, 2017 10:09
MoKob pushed a commit that referenced this pull request Jan 25, 2017
* Implements Random Access Iterator Facade for EdgeIDIterator

* Makes StaticGraph Node and Edge requirements explicit

* Cleans up Bisection Graph, Node and Edge

* Cleans up GraphView
void advance(difference_type offset) { position += offset; }
bool equal(const EdgeIDIterator &other) const { return position == other.position; }
const reference dereference() const { return position; }
reference dereference() const { return position; }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hm why the change here?

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.

@MoKob MoKob force-pushed the tools/partitionining/graph_view branch 2 times, most recently from 1561fb1 to 6518d17 Compare January 26, 2017 12:40
MoKob pushed a commit that referenced this pull request Jan 26, 2017
* Implements Random Access Iterator Facade for EdgeIDIterator

* Makes StaticGraph Node and Edge requirements explicit

* Cleans up Bisection Graph, Node and Edge

* Cleans up GraphView
daniel-j-h added a commit that referenced this pull request Jan 27, 2017
* Implements Random Access Iterator Facade for EdgeIDIterator

* Makes StaticGraph Node and Edge requirements explicit

* Cleans up Bisection Graph, Node and Edge

* Cleans up GraphView
@MoKob MoKob force-pushed the tools/partitionining/graph_view branch from 02502d3 to 6b64487 Compare January 27, 2017 10:26
MoKob pushed a commit that referenced this pull request Jan 27, 2017
* Implements Random Access Iterator Facade for EdgeIDIterator

* Makes StaticGraph Node and Edge requirements explicit

* Cleans up Bisection Graph, Node and Edge

* Cleans up GraphView
boost::program_options::value<bool>(&extractor_config.dump_compressed_node_based_graph)
->implicit_value(true)
->default_value(false),
"Generate a partitionable graph file (.cnbg) for use with osrm-partition")(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hm on the demo server with Boost 1.55 I have to say --dump-partition-graph true even though implicit_value above should only require dump-partition-graph. No idea if this is an Boost issue...

http://www.boost.org/doc/libs/1_55_0/doc/html/boost/program_options/typed_value.html#idp101668472-bb

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we just do -DENABLE_MASON=ON on the demoserver and pretend this is ancient history?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It works specifying it explicitly.

@MoKob MoKob force-pushed the tools/partitionining/graph_view branch from 1876ba5 to fd939a6 Compare February 1, 2017 09:50
@daniel-j-h daniel-j-h changed the title Basic Toolchain for OSRM partition Basic Toolchain for Partitioning Feb 1, 2017
@MoKob MoKob force-pushed the tools/partitionining/graph_view branch from 90a4cbf to 9d62e4f Compare February 2, 2017 13:17
MoKob pushed a commit that referenced this pull request Feb 2, 2017
* Implements Random Access Iterator Facade for EdgeIDIterator

* Makes StaticGraph Node and Edge requirements explicit

* Cleans up Bisection Graph, Node and Edge

* Cleans up GraphView
@MoKob MoKob force-pushed the tools/partitionining/graph_view branch from 9d62e4f to 079611f Compare February 2, 2017 13:19
Moritz Kobitzsch and others added 20 commits March 1, 2017 00:14
Here's all I could get out of a instrumented `osrm-partition`; debug build,
with all the bells and whistles I could think of to make it more verbose:

```
==17928==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 1560 byte(s) in 3 object(s) allocated from:
    #0 0x7f4244185b30 in operator new[](unsigned long) ../../../../libsanitizer/asan/asan_new_delete.cc:62
    #1 0x7f4242a788b3  (/usr/lib/libtbb.so.2+0x208b3)

SUMMARY: AddressSanitizer: 1560 byte(s) leaked in 3 allocation(s).<Paste>
``

Symbolizing the address results in

```
echo "/usr/lib/libtbb.so 0x7f4242a788b3" | llvm-symbolizer
_fini
```

Looks like a crt finalizer => static global dtor "leaking" from tbb.

Which turned out to be a missing `tbb::task_scheduler_init` on our end:

> Using task_scheduler_init is optional in Intel® Threading Building
> Blocks (Intel® TBB) 2.2. By default, Intel TBB 2.2 automatically creates
> a task scheduler the first time that a thread uses task scheduling
> services and destroys it when the last such thread exits.

https://www.threadingbuildingblocks.org/docs/help/hh_goto.htm?index.htm#reference/task_scheduler/task_scheduler_init_cls.html

Without an explicit instanz the first call to a tbb algorithm seem to initialize
a global scheduler singleton which then "leaks" until the program exits.

Phew.
fix windows compilation
no multi line warnings
sanitze on mason with newer TBB
@TheMarex
Copy link
Copy Markdown
Member

TheMarex commented Mar 1, 2017

Grabbing this PR for rebasing and fixing PR comments.

@TheMarex TheMarex force-pushed the tools/partitionining/graph_view branch from 8c7e79c to 6759982 Compare March 1, 2017 00:49
@TheMarex TheMarex force-pushed the tools/partitionining/graph_view branch from 6759982 to 6f34d70 Compare March 1, 2017 01:04
@TheMarex TheMarex merged commit 886421b into master Mar 1, 2017
@TheMarex TheMarex deleted the tools/partitionining/graph_view branch March 1, 2017 16:09
TheMarex pushed a commit that referenced this pull request Mar 1, 2017
* Implements Random Access Iterator Facade for EdgeIDIterator

* Makes StaticGraph Node and Edge requirements explicit

* Cleans up Bisection Graph, Node and Edge

* Cleans up GraphView
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.

5 participants