Skip to content

Commit

Permalink
Switch from cutechess-cli to fastchess
Browse files Browse the repository at this point in the history
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 montytest.

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 montytest 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: Joost VandeVondele <[email protected]>
  • Loading branch information
Viren6 and vondele committed Aug 17, 2024
1 parent 8dfcbb0 commit 7f129d1
Show file tree
Hide file tree
Showing 9 changed files with 243 additions and 292 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/worker_msys2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ jobs:
test:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
toolchain: [stable, beta, nightly]
defaults:
Expand All @@ -19,6 +20,11 @@ jobs:
with:
fetch-depth: 0

- name: Force Install g++ with MinGW
run: |
choco install mingw --force -y
echo "PATH=/c/ProgramData/chocolatey/bin:/c/tools/mingw64/bin:$PATH" >> $GITHUB_ENV
- name: Add packages folder to PYTHONPATH
run: |
echo "PYTHONPATH=$(pwd)/packages" >> $GITHUB_ENV
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/worker_posix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-13]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
Expand All @@ -23,6 +24,20 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Force Reinstall g++ on Ubuntu
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install --reinstall -y g++
echo "PATH=/usr/bin:$PATH" >> $GITHUB_ENV
- name: Force Reinstall g++ on macOS
if: runner.os == 'macOS'
run: |
brew update
brew reinstall gcc
echo "PATH=$(brew --prefix)/bin:$PATH" >> $GITHUB_ENV
- name: Add packages folder to PYTHONPATH
run: |
echo "PYTHONPATH=$(pwd)/packages" >> $GITHUB_ENV
Expand Down
7 changes: 4 additions & 3 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# List of authors for montytest, as of December 14, 2023
# List of authors for montytest, as of August 17, 2024

Gary Linscott (glinscott)
Viren (Viren)

Andy Pilate (Cubox)
Bojun Guo (noobpwnftw)
Expand All @@ -14,6 +15,7 @@ Fanael Linithien (Fanael)
Fauzi Akram Dabat (FauziAkram)
FieryDragonLord
Gabe (MrBrain295)
Gahtan Nahdi (gahtan-syarif)
Giacomo Lorenzetti (G-Lorenz)
Gian-Carlo Pascutto (gcp)
Henri Wiechers (hwiechers)
Expand Down Expand Up @@ -55,8 +57,7 @@ Vince Negri (cuddlestmonkey)
Werner Fenchel (wfenchel)

Thanks to:
Ilari Pihlajisto - https://github.com/cutechess/cutechess, which drives all the games!
Tord Romstad - for Glaurung
Disservin - https://github.com/Disservin/fastchess, which drives all the games!
Dariusz Orzechowski - opening book idea (perft generation + position score filtering)
Stefan Pohl - Unbalanced Human Openings books
https://flag-sprites.com - for the great flag sprites
2 changes: 1 addition & 1 deletion server/montytest/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
according to the route/URL mapping defined in `__init__.py`.
"""

WORKER_VERSION = 14
WORKER_VERSION = 18


@exception_view_config(HTTPException)
Expand Down
17 changes: 0 additions & 17 deletions server/montytest/rundb.py
Original file line number Diff line number Diff line change
Expand Up @@ -1235,23 +1235,6 @@ def priority(run): # lower is better
if not have_binary:
continue

# To avoid time losses in the case of large concurrency and short TC,
# probably due to cutechess-cli as discussed in issue #822,
# assign linux workers to LTC or multi-threaded jobs
# and windows workers only to LTC jobs
if max_threads > 32:
if "windows" in worker_info["uname"].lower():
tc_too_short = get_tc_ratio(run["args"]["tc"], base="55+0.5") < 1.0
else:
tc_too_short = (
get_tc_ratio(
run["args"]["tc"], run["args"]["threads"], "35+0.3"
)
< 1.0
)
if tc_too_short:
continue

# Limit the number of cores.
# Currently this is only done for spsa.
if "spsa" in run["args"]:
Expand Down
Loading

0 comments on commit 7f129d1

Please sign in to comment.