GithubHelp home page GithubHelp logo

dje-dev / ceres Goto Github PK

View Code? Open in Web Editor NEW
144.0 16.0 24.0 19.62 MB

Ceres - an MCTS chess engine for research and recreation

License: GNU General Public License v3.0

C# 95.65% C++ 2.20% Cuda 1.56% NASL 0.58%

ceres's Introduction

Ceres - an MCTS chess engine for research and recreation

Ceres ("Chess Engine for Research") is:

  • a state-of-the-art UCI-compliant chess engine employing the AlphaZero-style Monte Carlo Tree Search and deep neural networks
  • a flexible, modular and efficient software library with an exposed API to facilitate research in computer chess
  • a set of integrated tools for chess research (e.g for position analysis, suite testing, tournament manager)
  • ancillary features and applications to facilitate human analysis of chess positions, for example an integrated graphing feature which generates on-the-fly visualizations of Ceres search results within a web browser, or game comparison feature which generates visualizations of differences between 2 or more games from a PGN file.

The Ceres MCTS engine is a novel implementation written in C# for the Microsoft .NET framework. This system comprises about 80,000 lines of source in 500 source code files, developed as a way to try to make something good come of COVID confinement. The underlying neural networks (and backend code to execute them) and backend code are currently mostly borrowed from the LeelaChessZero project via a "plug-in" architecture.

It is important to acknowledge that this project stands "on the shoulders of giants" - the pioneers in the field such as DeepMind with their AlphaZero project and the ongoing Leela Chess Zero project. In some cases significant sections of code are largely based upon (transliterated from) other open source projects such as Fathom (for tablebase access) or Leela Chess Zero (CUDA backend logic).

Although several fine open source implementations of MCTS engines are currently available, this project is hoped to provide several important benefits:

  • enhanced search speed, particularly on computers with multiple fast GPUs
  • a comprehensive API for chess research, rather than a narrow focus on a UCI engine
  • an integrated set of tools (such as suite or tournament management) which simplify and accelerate testing of new research ideas
  • an implementation using a modern programming language with features such as automatic garbage collections and development environments that provide edit/compile/debug inner loops which are almost instantaneous
  • a convenient testbed for implemneting and evaluating potential new algorithmic innovations

State of Development

Ceres was first released at the end of 2020 is still relatively early in its development. Support for the neural network backend is current limited to CUDA-capable GPUs.

During 2020 numerous significant enhancments were made, including:

  • added support for Linux operating system
  • implemented the CUDA backend directly in C# (using transliteration and enhancement to the LC0 backend code, including of the CUDA graphs feature for reduced inference latency)
  • implemented C# tablebase probing logic (via a transliteration of the Fathom project code)
  • added numerous algorithmic enhancements such as sibling blending and uncertainty boosting
  • significantly improved CPU and memory efficiency, especially for very large searches

Ceres playing strength is currently competitive with top chess engines such as Leela Chess Zero and Stockfish, depending of course considerably upon the particular types of hardware (CPU and GPU) available for each engine.

Ceres Software Architecture

The Ceres architecture is object oriented and organized into five layers:

  • Ceres.Base - supporting algorithms and data structures not specific to the game of Chess
  • Ceres.Chess - generic logic relating to the game of chess, such as move generation
  • Ceres.MCTS - highly efficient implementation of Monte Carlo Tree Search
  • Ceres.Features - implementations of various supplemental features such as suite and match play
  • Ceres - top-level Console mode application with command line parsing to launch desired feature (or UCI engine)

The class library is intended to be reusable and offer comprehensive chess functionality to facilitate research, for example including:

  • low-level chess concepts such as boards, moves, games, principal variations
  • interfaces to external data such as PGN or EPD files, or local/remote neural network files
  • a set of neural network position evaluators (including random, ensembled, roundrobin, split, or pooled)
  • interfaces to external engines (via UCI)
  • integrated MCTS search engine allowing customization of parameters or introspection of computed search trees
  • high-level modules for automated suite or tournament testing

The external API is not yet considered stable. Future effort will result in the publication of documentation and more extensive code samples of the API, along with an overview of the underlying data structures and algorithms.

As a teaser, the following examples demonstrate how the API can be leveraged to perform complex tasks using only a very small number of lines of code.

Implementation Features

Numerous small to medium-sized features are believed to combine to help deliver strong performance of both search speed and play quality, including:

  • A novel "dual CPUCT node selection algorithm" is used which alternates between two CPUCT levels (centered around the target CPUCT) on each batch, thereby minimizing collisions (and allowing larger batches) in selected leafs and combining elements of greater breadth and depth simultaneously for improved play quality (suggested earlier by LC0 contributor Naphthalin).

  • MCTS leaf selection is highly parallelized in an almost lock-free way, with only a single descent and each visited node being visited at most once.

  • MCTS leaf selection via PUCT algorithm is accelerated via SIMD hardware intrinsics (AVX), which is made feasible by the above-mentioned parallelized descent algorithm.

  • An overlapping execution approach allows efficient concurrent gathering and evaluation of batches.

  • A relative virtual loss technique is used rather than absolute (to reduce the magnitude of distortions caused by node selection with virtual loss applied).

  • The underlying search tree nodes are represented as fixed-size memory objects which are cache-aligned and reserved up front by dynamically committed only as needed. This structure enhances performance and facilitates efficient serialization of search tree state. The data structures use 32-bit node indices instead of 64-bit pointers to reduce memory consumption and make one-shot binary serialization possible. A set of "annotations" are maintained for a cached subset of active nodes, containing derived information useful in search.

  • Transpositions are detected and short-circuited from needing neural network re-evaluation by copying the neural networks from the nodes already "in situ" in the tree (thereby obviating explicit transposition tables or any limit on their size). A "virtual subtree" techinque is used to avoid instantiating subtrees which are already transpositions until they exceed 3 nodes in size, thereby improving efficiency and reducing memory requirements.

  • Best move selection is often based on Q (subtree average evaluation) instead of N (number of visits). Among other benefits, this opens the door to search methods more tuned to BAI (best arm identification) at the root.

  • A "sibling blending" technique sometimes averages in information to newly visited nodes from their siblings which have not yet been evaluated in the subtree but have already been evaluated in other branches of the tree (i.e. are transpositions) thereby taking further advantage of the substantial information captured in the full memory-resident search tree.

  • An "uncertainty boosting" technique slightly incentivizes exploration at nodes with high uncertainty (historical variability of backed-up node evaluationss), in the spirit of the UCB algorithm's optimism (more variability might signal more potential upside, and/or indicates that the marginal information gain of further visits is higher).

  • Extensive use is made of fairly fine-grained parallelism to speed up many operations, using the .NET Thread Parallel Library (TPL) for covenience and high efficiency.

  • Critical components of the engine have been extensively optimized with the help of tools such as Intel vTune and careful attention to processor details such as memory alignment, false sharing, NUMA effects, locking primitives, prefetching, branch prediction, and maximizing instruction-level parallelism.

  • The neural network evaluator framework is extensible with current implementations provided for random, CUDA using Leela Chess Zeronetworks, and an experimental NVIDIA Tensor RT backend accepting ONNX network files, facilitating experimentation with alternate network architectures or inference precisions (8 bit).

Configuration and Installation

The setup instructions describe the sequence of steps currently needed to install and configure Ceres. Although installation procedures have been simplified since since first release, the process is not yet "single-click" easy and does require several steps and careful attention.

As is typical of chess engines, no GUI is directly provided. Instead users typically use GUI front-ends such as Arena, or the excellent Nibbler (https://github.com/rooklift/nibbler/releases) GUI which is optimized for MCTS-style engine such as Ceres or Leela Chess Zero.

Monitoring Tool

Event logging and statistics collection are very useful (and interesting) tools. Ceres provides an optional realtime monitoring system.

Contributing

It is hoped that Ceres will be a community effort. At this early stage, it probably does not make sense to be soliciting a large number of small improvements. Instead it is suggested that contributions would be most useful in the following areas:

  • testing of installation and operation on heterogeneous software/hardware environments
  • testing against alpha/beta engines such as Stockfish
  • feedback on the (limited) documentation provided so far
  • opening issues to identify any bugs or anomalies noted in testing
  • independent assesment of Ceres actual performance (speed and play quality)
  • comments on the design and API surface
  • suggestions for the most needed missing features

Somewhat bigger picture, thoughts and help with the architecture and implementation of backends would be especially welcomed. In particular, it is hoped to eventually generalize the interface between LC0 backends and arbitrary clients so this large and complex set of backends could be more widely leveraged by other chess engines including Ceres.

Acknowledgements and Thanks

It goes without saying that Ceres builds on the work of many other researchers and software developers, most notably:

  • DeepMind's Alpha Zero project (for the basic architecture and search algorithms)
  • Leela Chess Zero project for the neural networks and backends for inferencing with those networks
  • Judd Niemann for the move generator code (translated and adapted from C++) (https://github.com/jniemann66/juddperft)
  • Microsoft for the elegant C# language, performant .NET runtime, and excellent set of free software development tools such as Visual Studio

License

Ceres is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 or later of the License, or (at your option) any later version.

Ceres is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Leela Chess. If not, see http://www.gnu.org/licenses/.

Additional permission under GNU GPL version 3 section 7

The source files of Ceres have the following additional permission, as allowed under GNU GPL version 3 section 7:

If you modify this Program, or any covered work, by linking or combining it with NVIDIA Corporation's libraries from the NVIDIA CUDA Toolkit and the NVIDIA CUDA Deep Neural Network library (or a modified version of those libraries), containing parts covered by the terms of the respective license agreement, the licensors of this Program grant you additional permission to convey the resulting work.

ceres's People

Contributors

alstrup avatar dje-dev avatar eahova avatar erjanmx avatar jkormu avatar lepned avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ceres's Issues

Setoption works only before first search

Reproduction steps:

  1. Start Ceres 0.89 in UCI mode
  2. setoption name FPU value 1
  3. go nodes 800
  4. dump-params
  5. setoption name FPU value 2
  6. dump-params

Result:
After step 4. FPUValue is correctly set as 1. After step 6. FPUValue is still 1.

Expected result:
FPU should be 2 after step 6

Note that this is not bug in dump-params as it is also clear from search tree that parameter is not changed.

Changing

        case "fpu":
          SetFloat(value, 0, float.MaxValue, ref fpu);
          break;

to

        case "fpu":
          SetFloat(value, 0, float.MaxValue, ref (CeresEngine is not null ? ref CeresEngine.ChildSelectParams.FPUValue :  ref fpu));
          break;

seems to fix the issue.

what's wrong here?

Ceres user settings loaded from file Ceres.json
Network evaluation configured to use:

Entering UCI command processing mode.
go
Unhandled exception. System.Exception: Network 66740 not registered via Register or discoverable via directories specified via NNWeightsFilesLC0.RegisterDirectory method.
at Ceres.Chess.NNFiles.NNWeightsFiles.LookupNetworkFile(String netWeightsID, Boolean throwExceptionIfMissing)
at Ceres.Chess.NNEvaluators.NNEvaluatorFactory.Singleton(NNEvaluatorNetDef netDef, NNEvaluatorDeviceDef deviceDef)
at Ceres.Chess.NNEvaluators.NNEvaluatorFactory.DoBuildEvaluator(NNEvaluatorDef def)
at Ceres.Chess.NNEvaluators.NNEvaluatorFactory.BuildEvaluator(NNEvaluatorDef def)
at Ceres.MCTS.Params.NNEvaluatorSet.MakeEvaluator()
at Ceres.MCTS.Params.NNEvaluatorSet.get_Evaluator1()
at Ceres.MCTS.Search.MCTSSearchFlow..ctor(MCTSManager manager, MCTSIterator context)
at Ceres.MCTS.Iteration.MCTSManager.DoSearch(SearchLimit searchLimit, MCTSProgressCallback progressCallback)
at Ceres.MCTS.Iteration.MCTSManager.Search(MCTSManager manager, Boolean verbose, MCTSProgressCallback progressCallback, Boolean possiblyUsePositionCache)
at Ceres.MCTS.Iteration.MCTSLaunch.Search(NNEvaluatorSet nnEvaluators, ParamsSelect paramsSelect, ParamsSearch paramsSearch, IManagerGameLimit timeManager, ParamsSearchExecutionModifier paramsSearchExecutionPostprocessor, MCTSIterator reuseOtherContextForEvaluatedNodes, PositionWithHistory priorMoves, SearchLimit searchLimit, Boolean verbose, DateTime startTime, List1 gameMoveHistory, MCTSProgressCallback progressCallback, Boolean possiblyUsePositionCache, Boolean isFirstMoveOfGame) at Ceres.Features.GameEngines.GameEngineCeresInProcess.RunSearchPossiblyTreeReuse(MCTSIterator reuseOtherContextForEvaluatedNodes, PositionWithHistory curPositionAndMoves, List1 gameMoveHistory, SearchLimit searchLimit, MCTSProgressCallback callback, Boolean verbose)
at Ceres.Features.GameEngines.GameEngineCeresInProcess.DoSearch(PositionWithHistory curPositionAndMoves, SearchLimit searchLimit, List1 gameMoveHistory, ProgressCallback callback, Boolean verbose) at Ceres.Chess.GameEngines.GameEngine.Search(PositionWithHistory curPositionAndMoves, SearchLimit searchLimit, List1 gameMoveHistory, ProgressCallback callback, Boolean verbose)
at Ceres.Chess.GameEngines.GameEngine.Warmup()
at Ceres.Features.UCI.UCIManager.InitializeEngineIfNeeded()
at Ceres.Features.UCI.UCIManager.PlayUCI()
at Ceres.Commands.DispatchCommands.LaunchUCI(String keyValueArgs, String fen)
at Ceres.Commands.DispatchCommands.ProcessCommand(String cmd)
at Ceres.Program.Main(String[] args)

F:\ceres>

Network specification confusing

Network specifications expect only the base name (ID), for example use
LC0:703810
instead of
LC0:weights_run2_703810.pb

This behavior may be convenient but could also be confusing. Consider supporting both modes, or issue a warning as needed.

(based on feed back from masterkni666)

System.AccessViolationException: Attempted to read or write protected memory

Here is the full output of the message I'm seeing:

Ceres < uci
Ceres > |=====================================================|
Ceres > | Ceres - A Monte Carlo Tree Search Chess Engine |
Ceres > | |
Ceres > | (c) 2020- David Elliott and the Ceres Authors |
Ceres > | With network backend code from Leela Chess Zero. |
Ceres > | |
Ceres > | Version 0.80. Use help to list available commands. |
Ceres > | {git}
Ceres > |=====================================================|
Ceres > Ceres user settings loaded from file Ceres.json
Ceres > Network evaluation configured to use:
Ceres > Entering UCI command processing mode.
Ceres > id name Ceres
Ceres > id author David Elliott and the Ceres Authors
Ceres > uciok
Ceres < isready
Ceres > Fatal error.
Ceres > System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Ceres > Repeat 2 times:

Ceres > --------------------------------

Ceres > at Ceres.Chess.NNEvaluators.LC0DLL.LCO_Interop.Alloc(Int32, System.String, Int32)
Ceres >

Ceres > at Ceres.Chess.NNEvaluators.Internals.LC0LibraryNNEvaluator..ctor(System.String, Int32)
Ceres >

Ceres > at Ceres.Chess.NNEvaluators.NNEvaluatorLC0..ctor(Ceres.Chess.NNFiles.INNWeightsFileInfo, Int32[], Chess.Ceres.NNEvaluators.NNEvaluatorPrecision)
Ceres >

Ceres > at Ceres.Chess.NNEvaluators.NNEvaluatorLC0..ctor(Ceres.Chess.NNFiles.INNWeightsFileInfo, Int32, Chess.Ceres.NNEvaluators.NNEvaluatorPrecision)
Ceres >

Ceres > at Ceres.Chess.NNEvaluators.NNEvaluatorFactory.Singleton(Ceres.Chess.NNEvaluators.Defs.NNEvaluatorNetDef, Ceres.Chess.NNEvaluators.Defs.NNEvaluatorDeviceDef)
Ceres >

Ceres > at Ceres.Chess.NNEvaluators.NNEvaluatorFactory.DoBuildEvaluator(Ceres.Chess.NNEvaluators.Defs.NNEvaluatorDef)
Ceres >

Ceres > at Ceres.Chess.NNEvaluators.NNEvaluatorFactory.BuildEvaluator(Ceres.Chess.NNEvaluators.Defs.NNEvaluatorDef)
Ceres >

Ceres > at Ceres.MCTS.Params.NNEvaluatorSet.MakeEvaluator()
Ceres >

Ceres > at Ceres.MCTS.Params.NNEvaluatorSet.get_Evaluator1()
Ceres >

Ceres > at Ceres.MCTS.Search.MCTSSearchFlow..ctor(Ceres.MCTS.Iteration.MCTSManager, Ceres.MCTS.Iteration.MCTSIterator)
Ceres >

Ceres > at Ceres.MCTS.Iteration.MCTSManager.DoSearch(Ceres.Chess.SearchLimit, MCTSProgressCallback)
Ceres >

Ceres > at Ceres.MCTS.Iteration.MCTSManager.Search(Ceres.MCTS.Iteration.MCTSManager, Boolean, MCTSProgressCallback, Boolean)
Ceres >

Ceres > at Ceres.MCTS.Iteration.MCTSLaunch.Search(Ceres.MCTS.Params.NNEvaluatorSet, Ceres.MCTS.Params.ParamsSelect, Ceres.MCTS.Params.ParamsSearch, Ceres.MCTS.Managers.Limits.IManagerGameLimit, Ceres.MCTS.Iteration.ParamsSearchExecutionModifier, Ceres.MCTS.Iteration.MCTSIterator, Ceres.Chess.Positions.PositionWithHistory, Ceres.Chess.SearchLimit, Boolean, System.DateTime, System.Collections.Generic.List`1<Ceres.Chess.GameEngines.GameMoveStat>, MCTSProgressCallback, Boolean, Boolean)
Ceres >

Ceres > at Ceres.Features.GameEngines.GameEngineCeresInProcess.RunSearchPossiblyTreeReuse(Ceres.MCTS.Iteration.MCTSIterator, Ceres.Chess.Positions.PositionWithHistory, System.Collections.Generic.List`1<Ceres.Chess.GameEngines.GameMoveStat>, Ceres.Chess.SearchLimit, MCTSProgressCallback, Boolean)
Ceres >

Ceres > at Ceres.Features.GameEngines.GameEngineCeresInProcess.DoSearch(Ceres.Chess.Positions.PositionWithHistory, Ceres.Chess.SearchLimit, System.Collections.Generic.List`1<Ceres.Chess.GameEngines.GameMoveStat>, ProgressCallback, Boolean)
Ceres >

Ceres > at Ceres.Chess.GameEngines.GameEngine.Search(Ceres.Chess.Positions.PositionWithHistory, Ceres.Chess.SearchLimit, System.Collections.Generic.List`1<Ceres.Chess.GameEngines.GameMoveStat>, ProgressCallback, Boolean)
Ceres >

Ceres > at Ceres.Chess.GameEngines.GameEngine.Warmup()
Ceres >

Ceres > at Ceres.Features.UCI.UCIManager.InitializeEngineIfNeeded()
Ceres >

Ceres > at Ceres.Features.UCI.UCIManager.PlayUCI()
Ceres >

Ceres > at Ceres.Commands.DispatchCommands.LaunchUCI(System.String, System.String)
Ceres >

Ceres > at Ceres.Commands.DispatchCommands.ProcessCommand(System.String)
Ceres >

Ceres > at Ceres.Program.Main(System.String[])
Ceres >

Ceres < ucinewgame
Ceres < position startpos moves g1f3 d7d6 g2g3 e7e5 c2c4
Ceres < go infinite

GPUs with small memory may fail with large networks

Ceres creates 2x as many session as LC0 on the GPU and therefore has higher memory GPU memory requirement.

Some smaller GPUs may have difficult with this (perhaps only with large networks).

As a workaround/fix, as suggested by LC0 member borg, "you can reduce vram requirements by reducing the backend's max batch size."

Add support for MLH to influence search

Possibly MLH feature adds a small amount of Elo, and it improves the user experience. Finish support of MLH in search in Ceres, also adding arguments to allow configuration.

setoption

About this:

void ProcessSetOption(string command)

Both names and values can have spaces I'm afraid, so you need to find the (first) instance of name and the first instance of value and then take whatever string is between them as the name, and whatever string is after value as the value.

(Deleting leading and trailing whitespace from them, ofc.)

And I suppose one needs to worry about names that actually contain the string "value" and so need to check there's whitespace on both sides of value, yeah UCI has some questionable parts....

ceres takes time to build up speed

probably not an issue but it takes time for ceres to build up speed so at TC like 1sec+.1. It is much weaker than leela due to the slower speed.

Ceres unexpectedly slow due to build in Debug mode

Developers who pull Ceres and do a build in Visual Studio will by default get a "Debug" build instead of "Release" which will run at least 30% more slowly. There is no way to change this default behavior (that I'm aware of).

To avoid unexpected bad results from Ceres, a safeguard is added.

Commit 7d92a53 adds behavior that a debug build of Ceres will abort at startup (with a message):
"ERROR: Ceres was compiled in Debug mode and will only run\r\n"
+ "if the the DebugAllowed option is set to true\r\n"
+ "or the operating system environment variable CERES_DEBUG is defined.";

Occasional early match termination in cutechess

Tinker reports Ceres "getting time losses" on about 1 out of 10 games at 30 seconds + 1 second using cutechess. He kindly provided a sample log.

Initial investigation of the cutechess log does not explain this. Actually although Ceres was indeed on move when it stopped, cutechess does not claim that Ceres lost, it does not adjudicate it in favor of the opponent (as it usually would) with if there were a crash, i.e. we do not see any see entries such as:

Aug 10 08:35:01  io.elementary.cerbere.desktop[2026]: Engine Lc0(0) failed to respond to ping
Aug 10 08:35:01  io.elementary.cerbere.desktop[2026]: Terminating process of engine Lc0(0)

Instead we just see that it asked Ceres to stop thinking after 1.1seconds following a go command in which Ceres was informed it had 11.799 seconds left on its clock (before increment). Cutechess then marks it as "unterminated."

So the reason for cutechess ending the game/tournament is unknown. It may well be a Ceres bug, but there does not seem to be evidence of that (yet).

2210312 >ceres(20): isready
2210312 <ceres(20): readyok
2210312 >ceres(20): go wtime 11799 btime 14471 winc 1000 binc 1000
2210414 <ceres(20): info depth 0 seldepth 17 time 102 nodes 26244 score cp -5 tbhits 0 nps 10713 pv c3c4 e5c5 b5d6 e7d6 d1d6 c5c4 a4b5 c4c3 f3d5 c3c2 a5a6 c8a6 d6a6 g6g5 a6a7 c2f2 b5c4  string M= 115
2210931 <ceres(20): info depth 2 seldepth 17 time 619 nodes 35448 score cp -6 tbhits 2 nps 16636 pv c3c4 e5c5 b5d6 e7d6 d1d6 c5c4 a4b5 c4c3 f3d5 c3c2 a5a6 c8a6 d6a6 g6g5 a6a7 c2f2 b5c4  string M= 103
2211431 <ceres(20): info depth 3 seldepth 6 time 1119 nodes 46040 score cp -5 tbhits 2 nps 18658 pv c3c4 e7c5 b5d6 c8d7 d6b5 d7c8  string M= 92
2211478 >ceres(20): stop

The engine doesn't work

Hello Mr./Mrs.,
I downloaded the Ceres engine, but the engine it autocloses when I double click on it.
Do I need a dll file or something else?
Please help me.
Thanks a lot.

Possible crash on startup in OutputBanner - workaround

A user reported a crash upon startup in the method OutputBanner. It seems the code to query for the git version that is executed here may no work on some configurations.

As a workaround, one can just comment out the call to OutputBanner on line 42 of Program.cs.

Fails to win if tablebases used for engines but not adjudication

Because of failure to use DTZ feature of tablebases, Ceres can fail to convert overwhelmingly superior positions in the endgame.
Ceres is likely to suffer many draws if playing tournaments using tablebases for engines but not adjudication.

Example:
8/8/B7/8/8/Q3B1R1/K1k5/8 w - - 7 86

LC0 Bins not found when they exsist

image

I get this error on the first-time install. The file path is correct so I'm not sure what's happening.

I'm new to this, so if it's a simple issue please don't be annoyed :)

Crash with combination of immediate tablebase position and MultiPV enabled

Either of these two produces crash with v0.88:
uci
setoption name MultiPV value 500
setoption name SyzygyPath value C:\Users\Owner\Documents\Misc\Chess\Syzygy
position fen kr6/8/8/4KN2/8/8/8/8 w - - 0 1
go infinite

uci
setoption name VerboseMoveStats value true
setoption name LogLiveStats value true
setoption name SyzygyPath value C:\Users\Owner\Documents\Misc\Chess\Syzygy
position fen kr6/8/8/4KN2/8/8/8/8 w - - 0 1
go infinite

Two problems with output for go nodes 1

uci
setoption name MultiPV value 500
setoption name LogLiveStats value true
setoption name VerboseMoveStats value true
go nodes 1

Loaded network weights: 10x128 WDL MLH  from ./Networks/weights_run2_703810.pb.gz

CUDA device 0: NVIDIA GeForce RTX 2060 SMs: 30 Mem: 6gb
CUDA device 0: NVIDIA GeForce RTX 2060 SMs: 30 Mem: 6gb

info depth 1 seldepth 1 time 4 nodes 1 score cp 4 tbhits 0 nps 269 multipv 1 pv  string M= 134
info depth 0 seldepth 0 time 5 nodes 1 score cp 0 tbhits 0 multipv 2 pv c2c4
info depth 0 seldepth 0 time 5 nodes 1 score cp 0 tbhits 0 multipv 3 pv d2d4
info depth 0 seldepth 0 time 5 nodes 1 score cp 0 tbhits 0 multipv 4 pv g1f3
info depth 0 seldepth 0 time 5 nodes 1 score cp 0 tbhits 0 multipv 5 pv e2e3
info depth 0 seldepth 0 time 5 nodes 1 score cp 0 tbhits 0 multipv 6 pv c2c3
info depth 0 seldepth 0 time 5 nodes 1 score cp 0 tbhits 0 multipv 7 pv b2b3
info depth 0 seldepth 0 time 5 nodes 1 score cp 0 tbhits 0 multipv 8 pv g2g3
info depth 0 seldepth 0 time 5 nodes 1 score cp 0 tbhits 0 multipv 9 pv a2a3
info depth 0 seldepth 0 time 5 nodes 1 score cp 0 tbhits 0 multipv 10 pv b1c3
info depth 0 seldepth 0 time 5 nodes 1 score cp 0 tbhits 0 multipv 11 pv h2h3
info depth 0 seldepth 0 time 5 nodes 1 score cp 0 tbhits 0 multipv 12 pv d2d3
info depth 0 seldepth 0 time 5 nodes 1 score cp 0 tbhits 0 multipv 13 pv a2a4
info depth 0 seldepth 0 time 5 nodes 1 score cp 0 tbhits 0 multipv 14 pv h2h4
info depth 0 seldepth 0 time 5 nodes 1 score cp 0 tbhits 0 multipv 15 pv b2b4
info depth 0 seldepth 0 time 5 nodes 1 score cp 0 tbhits 0 multipv 16 pv f2f4
info depth 0 seldepth 0 time 5 nodes 1 score cp 0 tbhits 0 multipv 17 pv b1a3
info depth 0 seldepth 0 time 5 nodes 1 score cp 0 tbhits 0 multipv 18 pv f2f3
info depth 0 seldepth 0 time 5 nodes 1 score cp 0 tbhits 0 multipv 19 pv g1h3
info depth 0 seldepth 0 time 5 nodes 1 score cp 0 tbhits 0 multipv 20 pv g2g4
info string g2g4  (378 ) N:              0 (+    0) (P:      0.55%) (WL:     0.0000) (D:    0.0000) (M:    0.0) (Q:     0.0000) (U:    0.0096) (V:    0.0000)
info string g1h3  (161 ) N:              0 (+    0) (P:      0.72%) (WL:     0.0000) (D:    0.0000) (M:    0.0) (Q:     0.0000) (U:    0.0125) (V:    0.0000)
info string f2f3  (346 ) N:              0 (+    0) (P:      0.73%) (WL:     0.0000) (D:    0.0000) (M:    0.0) (Q:     0.0000) (U:    0.0128) (V:    0.0000)
info string b1a3  ( 34 ) N:              0 (+    0) (P:      0.79%) (WL:     0.0000) (D:    0.0000) (M:    0.0) (Q:     0.0000) (U:    0.0138) (V:    0.0000)
info string f2f4  (351 ) N:              0 (+    0) (P:      0.79%) (WL:     0.0000) (D:    0.0000) (M:    0.0) (Q:     0.0000) (U:    0.0139) (V:    0.0000)
info string b2b4  (234 ) N:              0 (+    0) (P:      0.86%) (WL:     0.0000) (D:    0.0000) (M:    0.0) (Q:     0.0000) (U:    0.0150) (V:    0.0000)
info string h2h4  (403 ) N:              0 (+    0) (P:      0.89%) (WL:     0.0000) (D:    0.0000) (M:    0.0) (Q:     0.0000) (U:    0.0155) (V:    0.0000)
info string a2a4  (207 ) N:              0 (+    0) (P:      1.24%) (WL:     0.0000) (D:    0.0000) (M:    0.0) (Q:     0.0000) (U:    0.0217) (V:    0.0000)
info string d2d3  (288 ) N:              0 (+    0) (P:      1.74%) (WL:     0.0000) (D:    0.0000) (M:    0.0) (Q:     0.0000) (U:    0.0304) (V:    0.0000)
info string h2h3  (400 ) N:              0 (+    0) (P:      1.78%) (WL:     0.0000) (D:    0.0000) (M:    0.0) (Q:     0.0000) (U:    0.0311) (V:    0.0000)
info string b1c3  ( 36 ) N:              0 (+    0) (P:      2.18%) (WL:     0.0000) (D:    0.0000) (M:    0.0) (Q:     0.0000) (U:    0.0381) (V:    0.0000)
info string a2a3  (204 ) N:              0 (+    0) (P:      2.54%) (WL:     0.0000) (D:    0.0000) (M:    0.0) (Q:     0.0000) (U:    0.0444) (V:    0.0000)
info string g2g3  (374 ) N:              0 (+    0) (P:      2.60%) (WL:     0.0000) (D:    0.0000) (M:    0.0) (Q:     0.0000) (U:    0.0453) (V:    0.0000)
info string b2b3  (230 ) N:              0 (+    0) (P:      2.75%) (WL:     0.0000) (D:    0.0000) (M:    0.0) (Q:     0.0000) (U:    0.0480) (V:    0.0000)
info string c2c3  (259 ) N:              0 (+    0) (P:      5.19%) (WL:     0.0000) (D:    0.0000) (M:    0.0) (Q:     0.0000) (U:    0.0905) (V:    0.0000)
info string e2e3  (317 ) N:              0 (+    0) (P:      7.12%) (WL:     0.0000) (D:    0.0000) (M:    0.0) (Q:     0.0000) (U:    0.1243) (V:    0.0000)
info string g1f3  (159 ) N:              0 (+    0) (P:      7.84%) (WL:     0.0000) (D:    0.0000) (M:    0.0) (Q:     0.0000) (U:    0.1368) (V:    0.0000)
info string d2d4  (293 ) N:              0 (+    0) (P:      9.64%) (WL:     0.0000) (D:    0.0000) (M:    0.0) (Q:     0.0000) (U:    0.1682) (V:    0.0000)
info string c2c4  (264 ) N:              0 (+    0) (P:     21.42%) (WL:     0.0000) (D:    0.0000) (M:    0.0) (Q:     0.0000) (U:    0.3739) (V:    0.0000)
info string e2e4  (322 ) N:              0 (+    0) (P:     28.59%) (WL:     0.0000) (D:    0.0000) (M:    0.0) (Q:     0.0000) (U:    0.4989) (V:    0.0000)
info string e2e4  (  0 ) N:              0 (+    0) (P:      0.00%) (WL:     0.0256) (D:    0.0000) (M:    0.0) (Q:     0.0256) (U:    0.0000) (V:    0.0256)
info string node  ( 20 ) N:              1 (+    0) (P:    100.00%) (WL:     0.0256) (D:    0.3096) (M:  134.0) (Q:     0.0256) (U:    0.0000) (V:    0.0256)
bestmove e2e4

First problem - standard UCI output

info depth 1 seldepth 1 time 4 nodes 1 score cp 4 tbhits 0 nps 269 multipv 1 pv string M= 134

The PV of the top move is blank and does not say which move is being reported.

Second problem - Verbose output

info string e2e4  (322 ) N:              0 (+    0) (P:     28.59%) (WL:     0.0000) (D:    0.0000) (M:    0.0) (Q:     0.0000) (U:    0.4989) (V:    0.0000)
info string e2e4  (  0 ) N:              0 (+    0) (P:      0.00%) (WL:     0.0256) (D:    0.0000) (M:    0.0) (Q:     0.0256) (U:    0.0000) (V:    0.0256)

There is a duplicate output in the VerboseMoveStats for the top move, for some reason.

avx2 really needed?

I actually have an old computer without avx2 but with a good graphic card, any chances to run it without AVX2 ?
Thanks

Arena Chess installation issue

2021-08-13 11:19:03.750<--1:Unhandled exception. System.AggregateException: One or more errors occurred. (Network ./weights_run2_703810.pb not registered via Register or discoverable via directories specified via NNWeightsFilesLC0.RegisterDirectory method.)

I'm getting the above error when trying to install Ceres in Arena chess. How do I fix this?

Incorrect value output in combo of WDL and non-WDL nets

As reported by jjosh, for example with T60 + T40.

Circa line 141 of NNEvaluatorLinearCombo, they have different representations that can't be mathematically averaged. Need to find an appropriate transformation, will probably have to add logic to "downgrade" the combination to be non-WDL.

Nibbler not working with Castling

Fix #15 did fix the UCI eval calls but Nibbler still does not work with Castling.

Seemingly, it both does not return any moves that involve Castling and also crashes the engine if you do Castle.

Example fen: r1bqkb1r/ppp3p1/2n2p2/3p1n1p/3P4/2P2N1P/PP1NBPP1/R1BQK2R w KQkq - 2 9

In Ceres.exe UCI it returns bestmove e1g1
In Nibbler it shows top move of Qb3

After you castle with White is crashes the engine...

Support depth UCI command

Ideally Ceres would support the depth command, or at least not report an ugly error message.

Chad commented "It would be nice if depth was tied to amount of nodes again since tools like Aquarium IDeA only use time and/or depth but not nodes."

Is it possible to tolerate Chess 960 format castling moves in UCI?

I've not built Ceres but I hear reports that castling causes problems for Nibbler.

Nibbler currently always runs in Chess 960 mode and so (for normal chess) sends castling moves as one of:

  • e1h1
  • e1a1
  • e8h8
  • e8a8

Would it be possible / easy to accept these as valid castling moves? Basically, check if the relevant king is present on the source square, then treat it as if e1g1 or whatever had come...

crashing on startup with AMD 2990 WX + 2080ti

right after loading the ceres.json it crashes with this message

96.625<--1:Ceres user settings loaded from file Ceres.json
96.641<--1:Unhandled exception. System.ComponentModel.Win32Exception (87): The parameter is incorrect.
96.641<--1: at System.Diagnostics.Process.set_ProcessorAffinityCore(IntPtr value)
96.641<--1: at System.Diagnostics.Process.set_ProcessorAffinity(IntPtr value)
96.641<--1: at Ceres.Base.OperatingSystem.HardwareManager.AffinitizeSingleProcessor() in C:\Ceres-main\src\Ceres.Base\OperatingSystem\HardwareManager.cs:line 91
96.641<--1: at Ceres.Base.OperatingSystem.HardwareManager.Initialize(Boolean affinitizeSingleProcessor) in C:\Ceres-main\src\Ceres.Base\OperatingSystem\HardwareManager.cs:line 37
96.641<--1: at Ceres.MCTS.Environment.MCTSEngineInitialization.BaseInitialize() in C:\Ceres-main\src\Ceres.MCTS\Environment\MCTSEngineInitialization.cs:line 40
96.641<--1: at Ceres.Program.Main(String[] args) in C:\Ceres-main\src\Ceres\Program.cs:line 68

WDL numbers not updating?

In running Ceres 0.91a today via Nibbler, Ceres quickly found the "right" move of Nd5...per Stockfish :-) However I noticed the WDL numbers did not update (continuing to show the move as unattractive even though the Q value got increasingly positive). Is this a Nibbler issue?
Screenshot (1)

Wrong output from VerboseMoveStats

setoption name LogLiveStats value true
setoption name VerboseMoveStats value true
position startpos moves e2e4

go infinite

info depth 6 seldepth 12 time 100 nodes 531 score cp -11 tbhits 0 nps 5290 pv c7c5 g1f3 e7e6 b1c3 b8c6 d2d4 c5d4 f3d4 g8f6 d4b5 d7d6  string M= 132
info string g2g4  (378 ) N:              0 (+    0) (P:      0.63%) (WL:     0.0000) (D:    0.0000) (M:    0.0) (Q:     0.0000) (U:    0.2595) (V:    0.0000)
info string f2f3  (346 ) N:              0 (+    0) (P:      0.65%) (WL:     0.0000) (D:    0.0000) (M:    0.0) (Q:     0.0000) (U:    0.2697) (V:    0.0000)
info string f2f4  (351 ) N:              0 (+    0) (P:      0.67%) (WL:     0.0000) (D:    0.0000) (M:    0.0) (Q:     0.0000) (U:    0.2768) (V:    0.0000)
info string b2b4  (234 ) N:              0 (+    0) (P:      0.74%) (WL:     0.0000) (D:    0.0000) (M:    0.0) (Q:     0.0000) (U:    0.3062) (V:    0.0000)
info string h2h4  (403 ) N:              0 (+    0) (P:      0.78%) (WL:     0.0000) (D:    0.0000) (M:    0.0) (Q:     0.0000) (U:    0.3237) (V:    0.0000)
info string g1h3  (161 ) N:              0 (+    0) (P:      0.78%) (WL:     0.0000) (D:    0.0000) (M:    0.0) (Q:     0.0000) (U:    0.3250) (V:    0.0000)
info string b1a3  ( 34 ) N:              0 (+    0) (P:      0.86%) (WL:     0.0000) (D:    0.0000) (M:    0.0) (Q:     0.0000) (U:    0.3582) (V:    0.0000)
info string a7a5  (207 ) N:              2 (+    0) (P:      1.08%) (WL:    -0.2378) (D:    0.2563) (M:  125.0) (Q:    -0.2307) (U:    0.1493) (V:   -0.2378)
info string b7b6  (230 ) N:              3 (+    0) (P:      1.45%) (WL:    -0.2227) (D:    0.2515) (M:  124.0) (Q:    -0.2320) (U:    0.1505) (V:   -0.2227)
info string h7h6  (400 ) N:              3 (+    0) (P:      1.56%) (WL:    -0.2078) (D:    0.2612) (M:  126.0) (Q:    -0.2263) (U:    0.1614) (V:   -0.2078)
info string g8f6  (159 ) N:              5 (+    0) (P:      1.54%) (WL:    -0.1963) (D:    0.2642) (M:  127.0) (Q:    -0.1590) (U:    0.1064) (V:   -0.1963)
info string g7g6  (374 ) N:              5 (+    0) (P:      2.01%) (WL:    -0.2002) (D:    0.2739) (M:  127.0) (Q:    -0.1774) (U:    0.1387) (V:   -0.2002)
info string d7d5  (293 ) N:              6 (+    0) (P:      1.91%) (WL:    -0.1326) (D:    0.2993) (M:  131.0) (Q:    -0.1490) (U:    0.1130) (V:   -0.1326)
info string a7a6  (204 ) N:              7 (+    0) (P:      2.85%) (WL:    -0.1741) (D:    0.2690) (M:  129.0) (Q:    -0.1898) (U:    0.1475) (V:   -0.1741)
info string b8c6  ( 36 ) N:              8 (+    0) (P:      2.19%) (WL:    -0.1731) (D:    0.2783) (M:  126.0) (Q:    -0.1458) (U:    0.1009) (V:   -0.1731)
info string d7d6  (288 ) N:             12 (+    0) (P:      3.54%) (WL:    -0.1416) (D:    0.2778) (M:  129.0) (Q:    -0.1550) (U:    0.1128) (V:   -0.1416)
info string c7c6  (259 ) N:             52 (+    0) (P:      8.76%) (WL:    -0.1494) (D:    0.2905) (M:  130.0) (Q:    -0.0969) (U:    0.0685) (V:   -0.1494)
info string e7e6  (317 ) N:             76 (+    0) (P:     15.77%) (WL:    -0.0986) (D:    0.2939) (M:  128.0) (Q:    -0.1128) (U:    0.0849) (V:   -0.0986)
info string e7e5  (322 ) N:            100 (+    0) (P:     15.88%) (WL:    -0.1055) (D:    0.3149) (M:  132.0) (Q:    -0.0856) (U:    0.0652) (V:   -0.1055)
info string c7c5  (264 ) N:            251 (+    0) (P:     36.30%) (WL:    -0.0857) (D:    0.2988) (M:  130.0) (Q:    -0.0806) (U:    0.0597) (V:   -0.0857)
info string node  ( 20 ) N:            531 (+    0) (P:    100.00%) (WL:    -0.1003) (D:    0.3037) (M:  130.0) (Q:    -0.0965) (U:    0.0000) (V:   -0.1003)

[further output deleted]

Note that the position I gave requires a move from Black, however several of the moves listed (all with N: 0) are by White.

Fatal error

I have Windows7, but I see the message:

"
|=========================================================|
| Ceres - A Monte Carlo Tree Search Chess Engine |
| |
| (c) 2020- David Elliott and the Ceres Authors |
| With network backend code from Leela Chess Zero. |
| |
| Version 0.91b Use help to list available commands. |
|=========================================================|

Fatal Error. Windows Version 7 or above required.
"

What's the matter?

Typo bug in Position.CheckDrawBasedOnMaterial

Line 197 of Position.cs appears to contain a typo. One of the bishopCountThem's should be an Us:

else if (bishopCountThem != 2 || bishopCountThem != 2) // two bishops same side may not be a draw

Confusing location of Ceres logic in LC0.DLL

Borg pointed out the one file that needs to be changed in the Leela source code tree is network_cudnn.cc. That is confusing because actually the Ceres addition to that code is currently hardwired to use CUDA and not CUDNN:

      _network[sessionIndex] = MakeCudaNetworkAuto(weights, od);

This is not an actual problem, just something confusing to be cleaned up.

Ceres doesn't output a readyok (nibbler)

When I select the Ceres.exe file in Nibbler as the engine, it (nibbler) gets stuck on "Awaiting readyok from engine". I am wondering why this is happening. My card is an NVIDIA GeForce GTX 980 (Gigabyte subseller). I followed the installation directions.

Add user warning if unsupported entries in Ceres.json

Users might make entries (intended for command line) such as pruning=false into Ceres.json not realizing that command-line and Ceres.json entries are not always the same. This can be confusing, at a minimum the documentation should make this clear and Ceres should warn if unsupported entries are found in the Ceres.json file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.