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 f9623e5
Show file tree
Hide file tree
Showing 9 changed files with 240 additions and 302 deletions.
24 changes: 18 additions & 6 deletions .github/workflows/worker_msys2.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,33 @@
name: CI worker cargo
name: CI worker msys2

on: [push, pull_request, workflow_dispatch]

jobs:
test:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
toolchain: [stable, beta, nightly]
include:
- { sys: mingw64, env: x86_64, comp: gcc }
defaults:
run:
shell: bash
shell: msys2 {0}
working-directory: worker

steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup msys and install required packages
uses: msys2/setup-msys2@v2
with:
update: true
msystem: ${{ matrix.sys }}
install: >-
make
mingw-w64-${{ matrix.env }}-python3
mingw-w64-${{ matrix.env }}-${{ matrix.comp }}
mingw-w64-x86_64-rust
- uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -25,4 +37,4 @@ jobs:
- name: Run worker tests
run: |
python -m unittest discover -vb -s tests
python -m unittest discover -vb -s tests
3 changes: 2 additions & 1 deletion .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 @@ -29,4 +30,4 @@ jobs:
- name: Run worker tests
run: |
python -m unittest discover -vb -s tests
python -m unittest discover -vb -s tests
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 = 20


@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 f9623e5

Please sign in to comment.