Skip to content
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

increase seed size to 64 bits #4

Closed
wants to merge 3 commits into from

Conversation

gahtan-syarif
Copy link

fast chess supports 64 bit seeds which allows for far more unique opening sequences

Disservin and others added 3 commits July 15, 2024 23:33
fixes official-stockfish#2106

This PR switches from cutechess-cli to fast-chess.

cutechess-cli has been serving us well in the past years, however, some issues
have accumulated, namely the difficulty of compiling cutechess-cli, the
observed timeouts at high concurrency and short TC, and e.g. slowness when
indexing larger books.  fast-chess https://github.com/Disservin/fast-chess has
addressed these issues, and has now probably become mature enough to serve as
the game manager for fishtest.

As an example of its ability to deal with short TC and high concurrency:
https://dfts-0.pigazzini.it/tests/view/669249cdbee8253775cede32
with concurrency 25, and TC 1+0.01s no timeouts are observed.

fast-chess is built from sources, with the zip download as well as the binary
cached as needed.  There is fine-grained control over which version of
fast-chess is used, so we can easily upgrade for new features.

In this PR, fast-chess is built in cutechess compatibility to facilitate
integration, and to benefit from the existing fishtest checks. Once validated,
we should be able to switch easily to its native mode, which can output
trinomial and pentanomial results, and we should be able significantly simplify
the worker's book-keeping.

Co-Authored-By: Disservin <[email protected]>
Co-Authored-By: Gahtan Nahdi <[email protected]>
@@ -1297,7 +1297,7 @@ def run_games(
if "start" in task:
print("Variable task sizes used. Opening offset = {}".format(opening_offset))
start_game_index = opening_offset + input_total_games
run_seed = int(hashlib.sha1(run["_id"].encode("utf-8")).hexdigest(), 16) % (2**30)
run_seed = int(hashlib.sha1(run["_id"].encode("utf-8")).hexdigest(), 16) % (2**64)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we sure the result fits a 64bit int, including the sign ?

Copy link
Author

@gahtan-syarif gahtan-syarif Jul 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the SHA1 itself is a 160 bit value which is then modulod to 2^64

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my point is that the max size of an 64 bit int is 2^63-1 so if we want to fit it, I don't think we can take modulo 2^64

Copy link
Author

@gahtan-syarif gahtan-syarif Jul 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my point is that the max size of an 64 bit int is 2^63-1 so if we want to fit it, I don't think we can take modulo 2^64

The max size of a 64 bit (u)int is 2^64-1, which you can get by modulo 2^64

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The result of a modulo operation is always positive

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, python modulo is indeed.

@vondele vondele force-pushed the fastchessPR branch 3 times, most recently from 43fbd41 to dc51a47 Compare July 21, 2024 19:35
@vondele vondele closed this Aug 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants