Repository navigation
kaffpa: 3.9x less total time (2.8x geometric mean) at unchanged partition quality - #171
Conversation
Hypothesis: top-level scoped timers around graph IO, coarsening, initial partitioning, refinement and output (plus detail timers for matching, contraction, k-way FM, quotient-graph refinement and label propagation refinement outside initial partitioning) cost well below 1% of the running time, since they are entered a few hundred times per run.
Hypothesis: the std::getline/std::stringstream reader dominates the non-partitioning time (19% of the per-job time for fast, 14% for fsocial). Reading the file in one block and scanning it by hand, writing the partition from one buffer, computing the final cut once and replacing the per-node std::vector<bool> in max_communication_volume by a stamp array cut the io+post time by at least 3x and the overall geomean by 4 to 7%.
Hypothesis: vertex_moved_hashtable and the node index of maxNodeHeap are std::unordered_maps that are only probed, never iterated, so an open-addressing map gives identical results. Their node allocations account for much of the 15-20% malloc/free share in callgrind profiles of 2-way FM and k-way FM; replacing them reduces the partitioning time (initial partitioning and refinement) by 5 to 15%.
Hypothesis: malloc/free account for 15-20% of the instructions in FM-heavy jobs (unordered_map nodes of PartialBoundary and the boundary-pair map, PartitionConfig copies, small per-call objects). Replacing the global operator new/delete by per-size-class free lists in one reserved address range (no per-block header, blocks over 512 bytes go to malloc) cuts the partitioning time by 3 to 8%. KaHIP never orders or hashes by pointer, so results are unchanged.
…map, flow/multitry timers
…of rescanning their edges per move
… O(n) vector per call
…rect rating lookups
…or cluster ids (random visiting order)
…ugh one pointer per node with the same capacity casts
… rhs stamp array instead of a hash map
…stead of a second block-pair lookup
…f the LHS-stripe cut when that equals the current cut (result discarded by the caller)
…st use for k <= 1024, filled on first access through the map), edge cut through the lazy entry
…queue init, replaying the tie draws (038 retest on top of 041)
…f a node once instead of scanning the target's edges per saturated edge
…ad of once per incident edge
…tead of a hash map
…wap-remove), rule (b)
…s unused, no tie-draw replay
…torage shared across searches
…nged, stop when an iteration changes nothing
…round end), tail undone without boundary work
…with degree cache), tail undone without boundary work
…ay-based cluster id remap
… FIFOs for the active nodes and the global relabeling BFS
…er slots (089, discarded)" This reverts commit bb579f2.
…th its real edge count
…its real edge count; edge-target buffer not value-initialized
…lt with its real edge count; edge-target buffer not value-initialized" This reverts commit c2dccc1.
… new_edge writes the edge's weight and rating
…ectly, partition indices of the finer graph left untouched
…aph, SCC with vector stacks, counting buckets for component lists and the component graph
…built once per level and shared by all clusterings
…g order too (scattered loop removed)
… GPA edge sort and the LP degree order
… of the coarsest graph; degree-order cache
- label_propagation program: active-node sweeps and the early stop (051) only inside coarsening (match()); direct calls keep the original full sweeps, so the program's output is identical to the original again. - the rewritten heap is now fastMaxNodeHeap, used only by the verified k-way FM, 2-way FM and bipartition; the original maxNodeHeap is restored verbatim for the node separator local searches, min-degree ordering and construct_mapping (the rewrite crashed node_separator and node_ordering on changeKey of nodes not in the heap, which the original tolerates).
… sweep; A/B vs e114 total 1.003, the plain flag cost 1.028)
Ablation on edge_partitioning (fast and eco, k 2 and 8, 6 graphs, seeds 1-6, vs original): HEAD Q 1.0342, reverting 2de62c9 1.0042, reverting 1be4f2b / b544769 / 60f6dc3 1.032 / 1.035 / 1.023. The filter changes the order of equally rated edges, and the split graphs have many of them. Without the new gpa_usable_edges_only flag (set by app/kaffpa.cpp) the full list is permuted and sorted as in the original and filtered afterwards, which keeps the original order. kaffpa identical to e114 on 2907 jobs.
… the small-block allocator kaffpa prints no extra lines again (the timers were measurement instrumentation only). aae_sort.h is now tools/std_sort_replica.h, aae_alloc.h is tools/small_block_alloc.h (included only on non-Windows builds, since it uses mmap); no functional change.
| #include "random_functions.h" | ||
| #include "timer.h" | ||
| #ifndef _WIN32 | ||
| #include "tools/small_block_alloc.h" |
There was a problem hiding this comment.
Small-object allocator (4373685), kaffpa only, not on Windows. malloc/free were 15 to 20% of the instructions in FM-heavy jobs (hash map nodes, small per-call objects). Size classes of 16 to 512 bytes with free lists in one reserved range, so no per-block header and no search. KaHIP never orders or hashes by pointer, so results are unchanged. Partitioning time -3 to 8%, benchmark G 0.868 to 0.839. Class (a).
| if(ret_code) { | ||
| return 0; | ||
| } | ||
| partition_config.gpa_usable_edges_only = true; |
There was a problem hiding this comment.
Audit fix (58415f8): only kaffpa filters the GPA edge list before the sort (class (b), passed the kaffpa quality gate). edge_partitioning lost 1.2% in vertex cut with the early filter because its split graphs are full of equally rated edges; without this flag the original full sort runs and the filter comes afterwards.
| std::cout << "cut \t\t" << qm.edge_cut(G) << std::endl; | ||
| std::cout << "finalobjective " << qm.edge_cut(G) << std::endl; | ||
| std::cout << "bnd \t\t" << qm.boundary_nodes(G) << std::endl; | ||
| EdgeWeight final_cut = 0, max_comm_vol = 0; |
There was a problem hiding this comment.
c447c9a: final cut, boundary nodes and maximum communication volume in one pass over the edges instead of four (the cut was computed twice). Same printed values. A/B 0.968 on small fast jobs, G 0.3842 to 0.3797.
|
|
||
| if(2 <= partition_config.k && partition_config.k <= 3) { | ||
| partition_config.number_of_clusterings = 18; | ||
| partition_config.number_of_clusterings = 9; |
There was a problem hiding this comment.
R5 (d4b7462), the one change that does less work by design: strongsocial uses 9 instead of 18 / 17 ensemble clusterings for k < 8. Q 1.00045 to 1.00050 overall, strongsocial 1.0009 to 1.0013; G 0.3712 to 0.3657, T 0.2818 to 0.2738. Revert this and the next hunk to keep master's strongsocial.
| partition_config.number_of_clusterings = 7; | ||
| } else { | ||
| partition_config.number_of_clusterings = 3; | ||
| partition_config.number_of_clusterings = 2; |
There was a problem hiding this comment.
R5 (b51bfb4): 2 instead of 3 clusterings for k >= 32. Q 1.00078 overall (strongsocial 1.0035) on 3 seeds, 1.00030 (strongsocial 1.0007) on 6 seeds; G 0.3657 to 0.3601, T 0.2738 to 0.2588. Halving for all k was tried and rejected (Q 1.00100, strongsocial 1.0051).
| } | ||
| } | ||
|
|
||
| // The degree order of the identity permutation depends only on the degree sequence. Initial |
There was a problem hiding this comment.
eff47d8 / 43ad743: the degree order of the identity permutation depends only on the degree sequence, and initial partitioning repeats the same coarsening, so the last result is reused when the sequence matches. The sort itself runs on (degree, node) entries with the same comparisons. A/B 0.989 and 0.993.
| PRINT(std::cout << "no of initial partitioning repetitions = " << reps_to_do << std::endl;); | ||
| PRINT(std::cout << "no of nodes for partition = " << G.number_of_nodes() << std::endl;); | ||
| if(!((config.graph_allready_partitioned && config.no_new_initial_partitioning) || config.omit_given_partitioning)) { | ||
| // the repetitions coarsen the same (unchanged) graph G again: reuse its LP visiting-order copy |
There was a problem hiding this comment.
eff47d8: the repetitions of initial partitioning coarsen the same coarsest graph again; with the reuse graph set, label propagation builds the degree order and the visiting-order copy once for all repetitions. luxembourg strongsocial 8: 0.962.
| bnd.fastComputeQuotientGraph(coarser, no_of_coarse_vertices); | ||
| //bnd.getUnderlyingQuotientGraph(coarser); | ||
| // | ||
| // the coarse graph is the quotient graph of the clustering, built from coarse_mapping directly |
There was a problem hiding this comment.
2db8197: the coarse graph is built from the coarse mapping directly, instead of first writing the mapping into G's partition indices and building the quotient graph from them. A/B 0.997. Class (a).
| partition_weight_lhs = 0; | ||
| partition_weight_rhs = 0; | ||
| NodeID dummy_node = G.number_of_nodes() + 1; | ||
| // upper bounds for the edges of each block: the degree sums of its nodes (instead of m each) |
There was a problem hiding this comment.
ada0809: extract_two_blocks allocated m edges for each of the two subgraphs; the degree sums of the blocks are tight upper bounds. A/B 1.000 alone, part of the passenger group with G 0.3927 to 0.3842.
| fG.new_edge(sourceID, sink, G.getNodeWeight(rhs_nodes[i])); | ||
| } | ||
|
|
||
| fG.finish_construction(); |
There was a problem hiding this comment.
flow_graph is CSR now and lays out its edges in finish_construction(); the separator flow solver builds a flow_graph too and needs the call. Covered by the node_separator path of the CLI audit (no crashes, Q 1.0128 vs a master-vs-master noise of 0.9485).
lib/tools/cpu_hints.h wraps __builtin_prefetch (GCC, Clang), _mm_prefetch (MSVC x86/x64) or nothing, and floor(log2) of a 64-bit value (__builtin_clzll, _BitScanReverse64 or a loop). The sort replica uses ptrdiff_t for lengths and depth (long is 32 bits on Windows), and the graph reader uses 64-bit file positions on Windows. Same code on Linux.
Summary
This PR makes
kaffpafaster on every preconfiguration, graph class and k. On a fixed benchmark of 537 jobs (20 graphs, all six preconfigurations, k = 2, 8, 32, 64, 256), measured against current master (34e1d0a) back to back on the same machine:The work was done in an algorithm engineering loop with a fixed benchmark and a fixed quality gate: every change was profiled, built, timed on the full benchmark and either kept or reverted. Changes come in two output classes:
The PR touches only
lib/andapp/(45 files, +2816 / -549). No CMake or compiler flag changes; still single-threaded. ParHIP has its own copy of the library (parallel/modified_kahip) and is not affected. All other command line programs were audited separately (28 paths, see below). Three defects found by that audit are fixed in this PR.The history (85 commits) is kept as it was developed, including a few change/revert pairs of experiments that did not pay off (net zero, listed at the end). Commit messages that start with a number (
112:,123:) carry the experiment number of the development log.Results vs master
Direct run: master and this branch alternately, 537 jobs x 3 repetitions each, median per job. Time is the wall clock time of the whole process (reading the graph, partitioning, writing the partition). Shifted geometric mean with shift 0.01 s.
Peak memory of the largest job is 0.59 GB instead of 0.49 GB (reusable per-node buffers and stamp arrays that are kept between calls).
Quality gate
Q is the geometric mean over the 537 jobs of (mean cut of the PR + 1) / (mean cut of master + 1), each mean over seeds 1 to 3. Lower is better; 1.001 means the cut is 0.1% larger on average. Every partition was checked by an independent checker that recomputes the cut and the block weights from the graph and the partition file.
Rules for a class (b) change:
Noise of the metric: master on seeds 4 to 6 vs master on seeds 1 to 3 gives 0.99990; over the ten 3-vs-3 splits of master's seeds 1 to 6 it ranges from 0.9980 to 1.0017 (sd 0.0011).
Result for this branch:
On 6 seeds the largest groups are road 1.0030, eco 1.0029 and strongsocial 1.0007. Most of the remaining 0.08% (3 seeds) comes from the two parameter changes for strongsocial (R5, own section below); without them Q was 1.00045.
CLI audit
Every algorithm path reachable from a command line program was compared with master: 28 paths over all 11 programs of the default non-MPI build (15 kaffpa option paths such as
--enforce_balance,--balance_edges,--imbalance 0/10/50, odd k,--enable_mapping,--time_limit,--mmap_io, connected blocks; global_multisection (2), node_separator, node_ordering, label_propagation (2), edge_partitioning (2), partition_to_vertex_separator, evaluator, edge_evaluator, graphchecker, interface_test). Graphs: 6 small graphs plus 5 weighted variants, several k, all preconfigurations, seeds 1 to 3, and seeds 4 to 9 for paths that looked suspect. A path counted as a loss only if its Q was outside the master-vs-master noise of that path and the loss repeated on new seeds.The audit found three defects, all fixed in this PR (commits b76e198, c1dff95, 58415f8):
label_propagationprogram: the active-node sweeps of the coarsening (0f77fd9) also ran when the program calls label propagation directly, so its result got worse (Q 1.129). Now they run only inside coarsening; the program is bit-identical to master again (117 of 117 runs).node_separatorandnode_orderingcrashed (153 of 396 and 49 of 108 runs): the rewritten priority queue did not toleratechangeKeyon a node that is not in the queue, which those programs do. The rewrite is now a separate classfastMaxNodeHeap, used only by k-way FM, 2-way FM and bipartition;maxNodeHeap.his master's file again. 0 crashes.edge_partitioning: vertex cut 1.2% worse (Q 1.0119 on seeds 1 to 3, 1.0123 on seeds 4 to 9). An ablation pointed to the GPA edge filter (2de62c9): the split graph has many equally rated edges, and filtering before the sort changes their order. The early filter is now enabled only bykaffpa(newPartitionConfig::gpa_usable_edges_only); everyone else sorts the full list as master does and filters afterwards. Now Q 0.9946 (seeds 1 to 3), 1.0062 (seeds 4 to 6), within noise.After the fixes all 28 paths pass. Notable: node_separator Q 1.0128 with a master-vs-master noise of 0.9485 (z 0.85); global_multisection 1.0027 (master itself is not deterministic there: 101 of 216 reruns with the same seed differ); node_ordering failures are 900 s timeouts only (master 24, PR 18). kaffpaE builds and runs (smoke test with 2 MPI processes) but was not part of the quality gate; it shares the partitioning code tested here.
How to reproduce
Benchmark: graphs 4elt, fe_body, fe_tooth, fe_rotor, 144, auto, delaunay_n18, rgg_n_2_18 (mesh), luxembourg, bel, nld, belgium, netherlands (road), PGPgiantcompo, email-EuAll, soc-Slashdot0902, loc-gowalla, coAuthorsDBLP, web-Google, cnr-2000 (social/web); preconfigurations fast, eco, strong, fastsocial, ecosocial, strongsocial; k 2, 8, 32, 64, 256; seed 1; default imbalance 3%. The 63 combinations that took over 120 s with master were left out, which gives 537 jobs. One job per physical core (16-core Xeon w5-3435X, pinned with taskset), 3 repetitions, median per job. GCC 13.3, Ubuntu 24.04. For class (a) you can check identity with
sha256sum partagainst a master build with the same arguments. The scripts are not part of this PR; I am happy to share them.Default out-of-tree build of this branch (all targets, including kaffpaE and ParHIP when MPI is found): same targets as master, no new compiler warnings (the only warning is master's unused
repair_bipartition_connectivityin bipartition.cpp).Changes by component
Notation: G / T is the shifted geometric mean / total time ratio vs master of the full 537-job run after the step (each full run measured against stored master times; the final direct run above is the reference). Component ratios are from per-component timers that were used during development and are removed again in 66bf9a8 (
d_flow= flow refinement,d_multitry= multitry k-way FM,d_qgraph= quotient graph refinement,coarsen,initial). A/B numbers are single-core timing runs of the changed binary against the previous one on a few jobs (ratio of total time). Several small exact changes were measured together in one full run; the G/T step is then given once for the group.1. IO and final output (all class (a))
std::getline+std::stringstreamper line, about 15 to 19% of a fast/fastsocial job. The file is now read in one block and parsed by hand; the partition is written from one buffer; the final cut is computed once;max_communication_volumeuses a stamp array instead of a per-nodestd::vector<bool>. Time outside partitioning (IO + final metrics) over all jobs: 102 s to 33.5 s. Together with 3866ed4 and b09ca9d: G 0.868.2. Memory and basic data structures (all class (a))
kaffpaprogram only (lib/tools/small_block_alloc.h, included fromapp/kaffpa.cpp, not on Windows). Globaloperator new/deletewith per-size-class free lists in one reserved address range, no per-block header; blocks over 512 bytes go tomalloc. Why it helps: malloc/free were 15 to 20% of the instructions in FM-heavy jobs (hash map nodes, small per-call objects, PartitionConfig copies). KaHIP never orders or hashes by pointer value, so results are identical. Partitioning time -3 to 8%, G 0.868 to 0.839.node_hash_map(open addressing) for the node maps that are only probed, never iterated:vertex_moved_hashtableand the heap's node index. Same lookups, no per-entry allocation. Partitioning time geomean 0.944.stamped_node_map: a per-node array with a generation stamp, taken from a small pool, so creating and clearing a map is O(1) and lookups are direct array accesses; falls back tonode_hash_mapwhen the pool is exhausted. Used for the moved-node table and the heap index; 9b17cc6 stores stamp and value in one slot (one cache line per lookup). With bfc4e3f: d_multitry 0.811, d_qgraph 0.893, G 0.5060 to 0.4819, T 0.4447 to 0.4124. 9b17cc6 with a4f1ffb: G 0.3965 to 0.3927.unordered_map<NodeID,bool>) become stamped maps. Grouped with 133f8b1 and c1b2a17: G 0.4637 to 0.4571.fastMaxNodeHeap) without the element array: entries hold (key, node), a stamped map gives the position, sifts move a hole instead of swapping. The comparisons are the same (ties included), so every entry ends at the same position as before. Removes a virtual destructor and 24-byte objects per entry. With 04989de: d_multitry 0.956, strong 0.971, G 0.4025 to 0.3965, T 0.3075 to 0.3020.new_edgewrites weight and rating). A/B 0.974 on small jobs.nextBooltakes the top bit of one mt19937 draw, which is exactly the valueuniform_int_distribution(0,1)produced on libstdc++, without the distribution object. ecosocial coarsening 0.976, fastsocial 0.980.permutate_vector_gooddraws its swap positions 16 iterations ahead and prefetches them: same random sequence and same swaps, the cache misses overlap. Part of the GPA group below.lib/tools/std_sort_replica.h: a copy of libstdc++'s introsort (same pivot choice, same heap fallback, same final insertion sort) whose Hoare partition collects swap candidates blockwise without branches (BlockQuicksort style) and then swaps the same pairs in the same order. Needed because both callers (GPA edge sort, LP degree order) sort randomly permuted arrays with many ties, so a different sort algorithm would change the output. Unit test againststd::sorton 400 arrays (1 to 1e9 distinct values, presorted inputs): identical, 0.66 of the time. A/B 0.992. Note: bit-identity relies on libstdc++'sstd::sort; with another standard library the arrangement of ties may differ (as it already would with master).3. 2-way FM (initial partitioning and pairwise refinement)
two_way_fm::move_nodeis a template on the queue type, so the heaps are called without virtual dispatch. A/B 0.998.extract_two_blockssizes its edge arrays by the degree sums of the two blocks instead of m. A/B 1.000; part of the passenger group (fastsocial 0.951, initial 0.970), G 0.3897 to 0.3842.4. k-way FM (multitry and quotient graph refinement)
postMovedBoundaryNodeUpdatesreads and writes the edge cut through the cached block-pair entry instead of a second hash lookup. d_qgraph 0.964, d_multitry 0.948, G 0.6924 to 0.6838.complete_boundarykeeps a flat k x k index of the block-pair entries (k <= 1024), filled on first access through the original map, so iteration order and insertion timing are unchanged. d_qgraph 0.985.PartialBoundary(anunordered_mapper block pair) becomes a dense node array plus a position index with swap-remove; iteration walks the array. Why faster: insert/delete/iterate without node allocations and pointer chasing (postMoved was 29% of loc-gowalla eco 32). Output changes because the iteration order of the boundary differs. d_qgraph 0.883, G 0.6643 to 0.6327, T 0.6613 to 0.6047, Q 0.99986.move_nodeskips the gain computation for neighbors that are already moved and not queued (the result was thrown away), and the start loop computes a start node's gain only if it is not moved. The saved computations drew random numbers for ties, so the RNG stream changes. d_multitry 0.897, G 0.6327 to 0.6279, T 0.6047 to 0.5844, Q 0.99981.move_node; a query costs O(adjacent blocks) instead of O(degree). Only nodes of degree >= 32 use it (below that the plain scan is faster), and the storage is shared across the searches of a round (16b7ce3 alone resized it per search). d_multitry 0.972 (soc-Slashdot 0.248, loc-gowalla 0.524), G 0.6279 to 0.6245, Q 0.99978.move_nodeskipspostMovedBoundaryNodeUpdates; at round end the rolled-back tail is undone by resetting partition and weights, and the kept prefix is replayed in order through the boundary updates (same operations as before for kept moves). d_multitry 0.639, d_qgraph 0.836, G 0.5929 to 0.5739, T 0.5722 to 0.5140, Q 1.00049 (eco 1.0039, strongsocial 1.0043, road 1.0049).move_nodeprefetches the node entries of the first 32 neighbors and the edges of the next neighbor before the gain loop (move_node was 21% of netherlands strong 64, mostly latency of the neighbor adjacency). Part of the 7b25bfb group.move_nodeis a template on the queue type: no virtual dispatch for the heap, queue and moved tests once per neighbor. A/B 0.998.5. Flow refinement
Flow refinement solves a max-flow problem on a stripe around the boundary of each block pair. Without most balanced cuts (eco, ecosocial) it needs the minimal source side, which is the same for every maximum flow; with most balanced cuts (strong, strongsocial) it uses the residual graph, whose set of minimum cuts is the same for every maximum flow but whose tie breaking in the cut enumeration depends on the flow.
boundary_bfsis reused across calls instead of an O(n) vector per call. d_flow eco 0.846, ecosocial 0.818. With 14bc61e G 0.7489 to 0.7322.vector<bool>, edges of a node through one pointer. d_flow 979 s to 901 s, G 0.7079 to 0.6986.convert_dsscans each stripe node once for flow edges and outer boundary flags. d_flow 0.962.rate_inner_outercomputes weighted node degrees once into an array instead of once per incident edge (also quadratic at hubs; cnr-2000 strongsocial 2: 0.770). d7df6bb (a) dense reusable old-to-new array inconvert_ds. Together: total -2.0%, d_flow 0.930, G 0.6694 to 0.6643, T 0.6748 to 0.6613.lib/algorithms/bk_maxflow.h) instead of push-relabel. On these stripe networks (many short augmenting paths between a large source set and a large sink set) BK's two search trees, which are kept and repaired between augmentations, do much less work than push-relabel's relabeling. At termination the source tree is exactly the set reachable from the source in the residual graph, so the configurations without most balanced cuts use it directly and stay bit-identical; with most balanced cuts the residual graph of another maximum flow is used. The reversed network and the preflow-only options are dropped again. 0e1397a One edge pair with capacity w in both directions per stripe edge instead of two edges with zero-capacity partners (half the edges; the residual relation "flow below capacity" is the same). 89b1bcb (a) skip the unused source-set BFS with most balanced cuts. Together: d_flow 0.581, strong 0.840, strongsocial 0.827, G 0.4571 to 0.4219, T 0.3771 to 0.3222, Q 0.99932. Push-relabel is still used by the node separator flow solver.6. Label propagation coarsening (social configurations) and clustering
ensemble_two_clusteringsassigns first-occurrence ids with buckets and a stamp array instead of a hash map. strongsocial coarsening 0.837 (bel strongsocial 2: 0.801).unordered_map. coarsen 0.908 (strongsocial 0.849), G 0.5152 to 0.5060, T 0.4562 to 0.4447.node_orderingcaches the degree order keyed by the whole degree sequence. A/B 0.993 (luxembourg strongsocial 8: 0.962).7. GPA matching (fast, eco, strong; also in the initial partitioning of every configuration)
kaffpaonly (58415f8), see the audit. With 488f4a6 and 37c8096: strong coarsening 0.586, strong 0.940, eco 0.950, fast 0.888; G 0.4219 to 0.4055, T 0.3222 to 0.3133, Q 1.00045 (eco 1.0061, strong 1.0019).8. Contraction and quotient graphs (all class (a))
9. Most balanced minimum cut (strong, strongsocial; all class (a))
graph_accesscopy), SCC uses vector stacks, component lists and the component graph use counting buckets. A/B 0.996 on strongsocial/strong (belgium strongsocial 256: 0.986).10. Initial partitioning
fastMaxNodeHeapin bipartition. See the sections above.11. CLI audit fixes (kaffpa output unchanged)
label_propagationprogram back to full sweeps; the rewritten heap moved tofastMaxNodeHeap.h,maxNodeHeap.hrestored to master's version (fixes the node_separator / node_ordering crashes).PartitionConfig::gpa_usable_edges_onlyis set, whichapp/kaffpa.cppdoes.After each of the three commits,
kaffpawrote the same partitions as before the audit on 2907 of 2907 runs (benchmark x seeds 1 to 3 plus a 6 x 6 x 4 x 3 x 3 grid of small graphs, configurations, k, seeds and imbalances).12. Cleanup
Parameter change for strongsocial (R5): fewer ensemble clusterings
This is the only change that does less work by design rather than doing the same work faster, so it is listed separately. Please judge it on its own; it can be dropped by reverting d4b7462 and b51bfb4 (two lines in
app/configuration.h,standardsnw).strongsocial coarsens with an ensemble of
number_of_clusteringslabel propagation clusterings per level, combined by overlap. On master the number depends on k: 18 for k = 2 to 3, 17 for k = 4 to 7, 15 for k = 8 to 15, 7 for k = 16 to 31 and 3 for k >= 32.Notes for reviewers
stamped_node_mapstores, the 2-way FM degree cache, the k-way gain cache, the BFS depth array). This is safe for the single-threaded programs and for repeated library calls in one thread. The library was already not reentrant on master (global random generator, other statics), but concurrent calls from several threads are now even less possible than before, and the buffers stay allocated until the process ends (sized by the largest graph seen).small_block_alloc.his included only byapp/kaffpa.cpp(not on Windows), solibkahip, kaffpaE and the other programs keep the system allocator. It reserves 128 GiB of address space withMAP_NORESERVE(only touched pages use memory), falls back tomallocif the reservation fails (for example underulimit -v), never returns small blocks to the system, and is not thread-safe (kaffpa is single-threaded).std_sort_replica(libstdc++'s introsort) andnextBool(the valueuniform_int_distribution(0,1)gives on libstdc++). With libstdc++ the class (a) changes are bit-identical to master. With libc++ or MSVC, master's own results already depend on the library; this branch then gives the libstdc++ arrangement everywhere.graph_accessnow stores its edge arrays with a default-initializing allocator (type change of two private members); the public interface is unchanged.flow_graphis CSR now and needsfinish_construction()before use; the node separator flow solver got 8000 that call (vertex_separator_flow_solver.cpp).Reverted experiments in the history (net zero)
f6d8e1c / 1a5b445 (LP in-loop prefetch for high-degree nodes), 361d294 / 87d40d2 (more move_node prefetches), 59b2279 / 7a9721f (stripe bitmap), 82c92f3 / 02aba47 (LP active flags as a bitset), bb579f2 / f7d698c (two-stage LP prefetch), c2dccc1 / 81c50f3 (matching contraction edge count), df29da0 / 9789438 (SCC stacks on std::vector; 47905f0 later uses vector stacks in its own SCC code). They were slower or neutral and were reverted; I kept them so the history matches the measurements. I can squash them if you prefer.