Skip to content

RGG generator passes invalid propabilites to binomial distribution #85

@niklas-uhl

Description

@niklas-uhl

For some parameter combinations for RGG2D graphs, we are passing invalid probabilities (> 1) to std::binomial_distribution. When building in debug mode, glibc throws an assertion for that.

This can be reproduced with parameters rgg2d;N=10;M=10 with 1 MPI rank.

Generating graph ... /opt/homebrew/Cellar/gcc/15.2.0/include/c++/15/bits/random.h:3974: std::binomial_distribution<_IntType>::param_type::param_type(_IntType, double) [with _IntType = long long unsigned int]: Assertion '(_M_t >= _IntType(0)) && (_M_p >= 0.0) && (_M_p <= 1.0)' failed.

I tracked that down to

SInt h = sampling::Spooky::hash(seed);
SInt cell_vertices = rng_.GenerateBinomial(h, n, cell_area / total_area);
LPFloat cell_start_x = std::get<1>(chunk) + (i / cells_per_dim_) * cell_size_;
LPFloat cell_start_y = std::get<2>(chunk) + (i % cells_per_dim_) * cell_size_;

From my understanding that happens when the chunk and cell area are equal. Then, round errors may lead to probabilities greater than 1.

We should also check if any other part of the code is affected by that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions