-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
urand graph generation test fails on Ubuntu 22 #35
Comments
This is an unfortunate situation that has been getting worse. Although C++ standards carefully specify how the random number generators should behave, they do not do the same for Fortunately, for those concerned about running the exact same benchmark graphs, SuiteSparse captured the graphs a couple years ago (https://sparse.tamu.edu/GAP). I'm going to leave this issue open, since the only solutions I can think of are unsatisfactory. I would be grateful if anyone has a better idea. So far, the options I can think of all have downsides:
|
With CI failing, I checked to see the current state of which distribution each compiler is using. In my lab, I had Linux boxes with gcc 9,10,11,13 and clang 12 and 14. Gcc 9 & 10 behaved like the original reference output. Gcc 11 onwards as well as the clang versions all behaved the same. With any luck, gcc & clang will continue to have the same implementation behavior. Thus, going with a slightly modified version of option 1 (via commit 30197cf). |
Spoke too soon. Clang (14) on my Mac produces yet another answer. Option 3 will probably be the best. |
I went with option 3 to further standardize this reference code. |
I upgraded my system from Ubuntu 20 to 22 and now all tests pass except for
test-generate-u10
.This test runs
./bfs -u10 -n0
and compares it to a reference output.The number of edges is 16104 on Ubuntu 20 and 16104 on Ubuntu 22.
Digging deeper, I think that the problem is that the uniform_int_distribution of libstdc++ was changed.
(Ubuntu 22 default gcc version is 11.2.0 whereas Ubuntu 20 uses gcc 9.4.0.)
To demonstrate the problem I slightly modified the code:
The diff between Ubuntu 20 and 22 outputs is:
You can see that some edges changed, probably due to the uniform random number engine. Specifically, Edge 7619 turned into a self loop, so it got squished, reducing the number of edges by 1.
I'm not sure how to fix this issue. Perhaps adding some tolerance to the edge count comparison in the tests?
The text was updated successfully, but these errors were encountered: