KataGo
KataGo copied to clipboard
i686 compile error type casting no matching function for call to min()
/builddir/KataGo-1.11.0/cpp/search/search.cpp: In member function 'void Search::runWholeSearch(std::atomic<bool>&, std::function<void()>*, bool, const TimeControls&, double)': /builddir/KataGo-1.11.0/cpp/search/search.cpp:493:114: error: no matching function for call to 'min(double&, double_t&)' 493 | double upperBoundVisits = computeUpperBoundVisitsLeftDueToTime(rootVisits, timeUsed, std::min(tcLimit,maxTime));
Oh, nice catch thanks! https://github.com/lightvector/KataGo/blob/master/cpp/search/search.cpp#L461
That this variable is declared as "double_t" instead of "double" is definitely a typo, it should just be "double", I don't think it was ever intentional to use https://en.cppreference.com/w/c/numeric/math/float_t.
Grepping the repo, I can find 2 other instances of "double_t" that can all just be "double". Pushed a change to master just now at https://github.com/lightvector/KataGo/commit/d426f5408803344fdb67535ea065314a20594942 to make them just "double". Does that fix the issue?
Have not tested that yet. When might the next release be set? I've been porting packages to Void Linux https://github.com/void-linux/void-packages/pull/38190 and could make a patch for this or if you have a patch file ready I could test that.
It could be a tricky process in general, given the several different backends available.
Finally had time to test. Running it now through void's CI after pushing patches to my template. Thank you for looking into this quickly.
I can't find the actual error for some reason, but it's still failing on two of the architectures void supports. https://github.com/void-linux/void-packages/actions/runs/2724316092
Update: after scrolling carefully, found this fun thing: FATAL ERROR: Failed test assert: sizeof(size_t) == 8
FATAL ERROR: Failed test assert: sizeof(size_t) == 8
I will note that for void anyway, we found this only fails for x86 (i686) architecture. The builds work for all the others.
FATAL ERROR: Failed test assert: sizeof(size_t) == 8
I will note that for void anyway, we found this only fails for x86 (i686) architecture. The builds work for all the others.
Do I need to make this a separate issue and mark this one closed? And it would be my guess to add a check such that sizeof(size_t) == 4 on 32bit archs?
Thanks for the bump - heh, size_t being 4 bytes is interesting. I think there's some chance everything works if you simply remove or suppress that assert. Does that seems like it's the case? I never actually myself tested KataGo on a 4-byte system, though, since I don't personally even have such a system.
It looks like that fixed it so far for i686. The package built. Still testing to see whether everything still builds for the other architectures.
It built for i686 on my machine, but on the void linux CI it failed on this line in tests fancymath.cpp:
APPROX_EQ(betapdf(1-1e-4,.5e5,.5e1), 8773.80701229644182604, 1e-14);
Thanks for working through this. I know that different system libraries may return slightly different answers for transcendental functions, but of course numerical analysis is hard so I just set thresholds working on the machines I had access to. So the tolerance might indeed be too small.
Does it work if you raise 1e-14 on this and other lines where it fails to a somewhat larger value? Like 1e-12 or 1e-10? As part of that error it should have reported also to stdout or to stderr what the full numerical values actually were so you can see how many decimals they match.
Looking at the code now, the T distribution tests at the end also aren't particularly cross-machine friendly since in theory a value could end up close to a rounding boundary such that even a small difference could cause a printed digit to change. I'm happy to fix that too if needed.