Skip to content

Commit

Permalink
[FIX] Similarity approach: Prohibit assigning to a partition that is …
Browse files Browse the repository at this point in the history
…full.
  • Loading branch information
smehringer committed Jan 9, 2024
1 parent b48519b commit 95a1b9f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/layout/execute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ void partition_user_bins(chopper::configuration const & config,
uint8_t sketch_bits{10};
std::vector<seqan::hibf::sketch::hyperloglog> partition_sketches(config.number_of_partitions,
seqan::hibf::sketch::hyperloglog(sketch_bits));
size_t const cardinality_per_part =
seqan::hibf::divide_and_ceil(sum_of_cardinalities, config.number_of_partitions);
size_t const u_bins_per_part = seqan::hibf::divide_and_ceil(cardinalities.size(), config.number_of_partitions);
size_t const block_size =
std::min(u_bins_per_part,
Expand Down Expand Up @@ -253,7 +255,7 @@ void partition_user_bins(chopper::configuration const & config,
seqan::hibf::sketch::hyperloglog tmp = current_sketch;
tmp.merge(partition_sketches[p]);

if (tmp.estimate() < smallest_change)
if (tmp.estimate() < smallest_change && partition_sketches.estimate() < cardinality_per_part)
{
smallest_change = tmp.estimate();
best_p = p;
Expand Down

0 comments on commit 95a1b9f

Please sign in to comment.