Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion worker/games.py
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,7 @@ def launch_cutechess(
return task_alive


def run_games(worker_info, password, remote, run, task_id, pgn_file):
def run_games(worker_info, password, remote, run, task_id, pgn_file, syzygy_path):
# This is the main cutechess-cli driver.
# It is ok, and even expected, for this function to
# raise exceptions, implicitly or explicitly, if a
Expand Down Expand Up @@ -1351,6 +1351,11 @@ def make_player(arg):
if any(substring in book.upper() for substring in ["FRC", "960"]):
variant = "fischerandom"

# Prepare the tablebase parameter
syzygy_cmd = []
if len(syzygy_path) > 0:
syzygy_cmd = ["-tb", syzygy_path]

# Run cutechess binary.
cutechess = "cutechess-cli" + EXE_SUFFIX
cmd = (
Expand Down Expand Up @@ -1413,6 +1418,7 @@ def make_player(arg):
+ nodestime_cmd
+ threads_cmd
+ book_cmd
+ syzygy_cmd
)

task_alive = launch_cutechess(
Expand Down
2 changes: 1 addition & 1 deletion worker/sri.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"__version": 199, "updater.py": "PHFUVXcoxBFiW2hTqFN5q5WdAw2pK8uzFC7hyMUC3cLY5bGZPhL8TBGThtqDmcXd", "worker.py": "uFRfeWMhIxsSBppqLLWpNKfYd6VAq8MGRZUjtu+XKWE1RhM4cACqLhXA9jP+92Z1", "games.py": "wzzUVbeYyxLGRQTxx0RyCh67lHVadBe6HIQi84GM2W27cF3+aJIXLZkZmysfxTv5"}
{"__version": 199, "updater.py": "PHFUVXcoxBFiW2hTqFN5q5WdAw2pK8uzFC7hyMUC3cLY5bGZPhL8TBGThtqDmcXd", "worker.py": "B5jAfAi+1hTd3CjeRyuGU3b6pQfJrm7j3e+HEdYvuOgq4JjwuNLcuUcTQ14dw3GB", "games.py": "mVYyPEuH7LR+WZURLHWQCTOCo5CpEersDnaTAkCh3btlQi3q0NfLWb0D3jq8fqss"}
26 changes: 23 additions & 3 deletions worker/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,7 @@ def setup_parameters(worker_dir):
("parameters", "min_threads", "1", int, None),
("parameters", "fleet", "False", _bool, None),
("parameters", "compiler", default_compiler, compiler_names, None),
("parameters", "syzygy_path", "", str, None),
("private", "hw_seed", str(random.randint(0, 0xFFFFFFFF)), int, None),
]

Expand Down Expand Up @@ -754,6 +755,15 @@ def _get_help_string(self, action):
help="do not validate username/password with server",
)

parser.add_argument(
"-S",
"--syzygy_path",
dest="syzygy_path",
default=config.get("parameters", "syzygy_path"),
type=str,
help="Syzygy tabelbases path for cutechess-cli adjudication; not given to the engines",
)

def my_error(e):
raise Exception(e)

Expand Down Expand Up @@ -824,6 +834,7 @@ def my_error(e):
config.set("parameters", "min_threads", str(options.min_threads))
config.set("parameters", "fleet", str(options.fleet))
config.set("parameters", "compiler", options.compiler_)
config.set("parameters", "syzygy_path", options.syzygy_path)

with open(config_file, "w") as f:
config.write(f)
Expand Down Expand Up @@ -1284,7 +1295,9 @@ def verify_worker_version(remote, username, password):
return True


def fetch_and_handle_task(worker_info, password, remote, lock_file, current_state):
def fetch_and_handle_task(
worker_info, password, remote, lock_file, current_state, syzygy_path
):
# This function should normally not raise exceptions.
# Unusual conditions are handled by returning False.
# If an immediate exit is necessary then one can set
Expand Down Expand Up @@ -1372,7 +1385,7 @@ def fetch_and_handle_task(worker_info, password, remote, lock_file, current_stat
api = remote + "/api/failed_task"
pgn_file = [None]
try:
run_games(worker_info, password, remote, run, task_id, pgn_file)
run_games(worker_info, password, remote, run, task_id, pgn_file, syzygy_path)
success = True
except FatalException as e:
message = str(e)
Expand Down Expand Up @@ -1564,6 +1577,8 @@ def worker():
"ARCH": "?",
"nps": 0.0,
}
if len(options.syzygy_path) > 0:
worker_info["cutechess_syzygy"] = "yes"

print("UUID:", worker_info["unique_key"])

Expand Down Expand Up @@ -1592,7 +1607,12 @@ def worker():
fish_exit = True
break
success = fetch_and_handle_task(
worker_info, options.password, remote, lock_file, current_state
worker_info,
options.password,
remote,
lock_file,
current_state,
options.syzygy_path,
)
if not current_state["alive"]: # the user may have pressed Ctrl-C...
break
Expand Down