-
Notifications
You must be signed in to change notification settings - Fork 4
/
readme.txt
453 lines (308 loc) · 15.9 KB
/
readme.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
Introduction
------------
Texel is a free software (GPL v3) chess engine written in C++11.
More information about the program is available in the chess programming wiki:
https://www.chessprogramming.org/Texel
Pre-compiled executables
------------------------
The Texel distribution contains the following pre-compiled executables
located in the bin directory:
texel64-avx512.exe
For Windows 7 or later x86-64 systems using AVX-512, VNNI, POPCOUNT and BMI2
instructions.
texel64-avx2-bmi.exe:
For Windows 7 or later x86-64 systems using AVX2, POPCOUNT and BMI2
instructions.
texel64-avx2-pop.exe:
For Windows 7 or later x86-64 systems using AVX2 and POPCOUNT instructions.
texel64-avx2.exe:
For Windows 7 or later x86-64 systems using AVX2 instructions.
texel64-ssse3.exe
For Windows x86-64 systems with SSSE3 support.
texel64-old.exe
For Windows x86-64 systems.
texel64cl.exe:
Cluster version of texel64-avx2-pop.exe.
Requires Microsoft MPI to be installed.
texel-arm64:
For the ARMv8-A 64-bit architecture.
Should work on most modern Android devices.
texel-arm64-dot:
For the ARMv8-A 64-bit architecture with dot product CPU instruction.
Should work on many modern Android devices.
texel64:
For Linux x86-64 systems with AVX2 and POPCOUNT support.
If you need an executable for a different system, see the "Compiling" section
below.
UCI options
-----------
Hash
Controls the size of the main (transposition) hash table. Texel supports up to
512GiB for transposition tables. Other hash tables are also used by the
program, such as a pawn hash table. These secondary tables are quite small and
their sizes are not configurable.
OwnBook
When set to true, Texel uses its own opening book. When set to false,
Texel relies on the GUI to handle the opening book.
BookFile
If set to the file name of an existing polyglot opening book file, Texel uses
this book when OwnBook is set to true. If set to an empty string, Texel uses
its own small built in book when OwnBook is true. BookFile is not used when
OwnBook is false. An opening book called texelbook.bin is included in this
distribution.
Ponder
Texel supports pondering mode, also called permanent brain. In this mode the
engine calculates also when waiting for the other side to make a move. This
option changes the time allocation logic to better suit pondering mode. The
option is normally handled automatically by the GUI.
UCI_AnalyseMode
This option is normally set automatically by the GUI when in analysis mode.
In analysis mode, Texel does not use its opening book.
Strength
Strength can be smoothly adjusted between playing random legal moves (0) and
playing at full strength (1000).
UCI_LimitStrength, UCI_Elo
These are standard UCI options to reduce the playing strength and should be
handled by the GUI. Internally the Elo value is converted to a Strength value,
so the Strength option has no effect when UCI_LimitStrength is enabled.
MaxNPS
If set to a value larger than 0, Texel will not search faster than this many
nodes per second. This can be used as an alternative to or in combination with
the Strength option to reduce the playing strength.
Threads
Texel can use multiple CPUs and cores using threads. For best performance,
don't set this value higher than the number of cores or hyperthreads in the
computer.
MultiPV
Set to a value larger than 1 to find the N best moves when analyzing a
position. This setting has no effect when playing games. The GUI normally
handles this option so the user does not have to set it manually.
UseNullMove
When set to true, the null move search heuristic is disabled. This can be
beneficial when analyzing positions where zugzwang is an important factor.
Contempt
When playing a game this value specifies how big an advantage, measured in
centipawns, the engine thinks it has over its opponent, because of differences
in playing strengths. A positive value means the engine sees itself as
stronger than the opponent and therefore tries to avoid draws by repetition
and simplifying piece trades. A negative value has the opposite effect,
causing the engine to actively look for draws and simplifying exchanges.
AnalyzeContempt
When analyzing a position the AnalyzeContempt value is used instead of the
Contempt value. AnalyzeContempt is always specified from the white player's
point of view, even when it is black's turn to move. For example, if you are
analyzing an adjourned game where you are playing white and are happy with a
draw, you can set AnalyzeContempt to a negative value, such as -50. The
analysis will then take into account that white "wants" a draw, even when you
are analyzing a position where it is black's turn to move.
AutoContempt
When AutoContempt is set to true, the Contempt option is ignored and the
contempt value during game play is instead determined based on the opponent as
defined by the ContemptFile option.
ContemptFile
Used when AutoContempt is set to true. Specifies the path to the text file
that defines what contempt value to use for a given opponent. Each line in the
file has the format regex <tab> contempt. The regular expression has the C++
ECMAScript format, see http://en.cppreference.com/w/cpp/regex/ecmascript.
The regular expression is matched against the value of the UCI_Opponent
option, which should be set automatically by the GUI.
Example:
\w+ \w+ \w+ AlphaZero.* -100
.* 0
GaviotaTbPath
Semicolon separated list of directories that will be searched for Gaviota
tablebase files (*.gtb.cp4).
GaviotaTbCache
Gaviota tablebase cache size in megabytes.
SyzygyPath
Semicolon (Windows) or colon (Linux, Android) separated list of directories
that will be searched for Syzygy tablebase files.
MinProbeDepth
Minimum remaining search depth required to probe tablebases. If tablebase
probing slows down the engine too much, try making this value larger. If all
tablebase files are on fast SSD drives or cached in RAM, a value of 0 or 1 can
probably be used without much slowdown.
MinProbeDepth6, MinProbeDepth7
Minimum remaining search depth required to probe 6-men and 7-men tablebases.
Values smaller than MinProbeDepth are ignored. Values larger than
MinProbeDepth can be useful if the larger tablebases are on slower disks than
the smaller tablebases.
MinProbeDepth6dtz, MinProbeDepth7dtz
Minimum remaining search depth required to probe 6-men and 7-men DTZ
tablebases. Values smaller than MinProbeDepth6, MinProbeDepth7 are ignored.
Values larger than MinProbeDepth6/7 can be useful if DTZ tables are on slower
disks than WDL tables.
Clear Hash
When activated, clears the hash table and the history heuristic table, so that
the next search behaves as if the engine had just been started.
AnalysisAgeHash
When set to false the transposition table is not "aged" when starting a new
search in analysis mode. This helps keeping older but deeper entries around in
the transposition table, which is useful when analysing a position and making
and un-making moves to explore the position.
Tablebases
----------
Texel can use endgame tablebases to improve game play and analysis in the
endgame. Both Gaviota tablebases (only .cp4 compression) and Syzygy tablebases
are supported, and both tablebase types can be used simultaneously.
For game play Syzygy tablebases are recommended because the Syzygy probing code
scales better when the engine uses multiple cores.
For analysis, using both Syzygy and Gaviota tablebases at the same time is
recommended. This gives accurate mate scores and PVs when the search can reach a
5-men position (thanks to Gaviota tablebases), and game theoretically correct
results (also taking 50-move draws into account) when the search can reach a
6-men position (thanks to Syzygy tablebases).
Syzygy tablebases contain distance to zeroing move (DTZ) information instead of
distance to mate (DTM) information. DTZ values are converted internally to upper
or lower DTM bounds before being presented to the user. This means that there is
no separate score range for known tablebase wins, but it also means that the
shortest possible mate can be much shorter than the reported mate score
indicates.
For syzygy tablebases it is recommended to have the corresponding DTZ table for
each WDL table. Texel tries to handle missing tablebase files gracefully, but in
some situations missing DTZ tables may lead to trouble converting a won
tablebase position. This can happen even in relatively simple endgames that
Texel could have won without using tablebases at all.
Because of technicalities in the Syzygy probing code, 6-men tablebases are only
supported for the 64-bit versions of Texel.
The 6-men Syzygy tablebases will likely only increase the playing strength of
Texel if at least the WDL tables are stored on SSD.
NUMA
----
Non-uniform memory access (NUMA) is a computer memory design common in computers
that have more than one CPU. Texel can take advantage of NUMA hardware when
running on Windows or Linux.
The pre-compiled 64-bit Windows executables are compiled with NUMA awareness.
The pre-compiled Linux executable is not NUMA aware because it adds a dependency
on the libnuma library which may not be installed on all Linux systems.
When running a NUMA aware executable, NUMA awareness can be disabled at runtime
by giving the -nonuma argument when starting Texel.
When NUMA awareness is enabled and Texel runs on NUMA hardware, Texel binds its
search threads to suitable NUMA nodes and tries to allocate thread-local memory
on the same nodes as the threads run on. If Texel uses fewer search threads than
there are cores in the computer, the threads will be bound to NUMA nodes such
that there are no more than one thread per core and such that as few NUMA nodes
as possible are used. This arrangement speeds up memory accesses.
Cluster
-------
Texel can run on computer clusters by using the MPI system. It has only been
tested using MPICH in Linux and MS-MPI in Windows but should work with other MPI
implementations as well.
The pre-compiled windows executable texel64cl.exe is compiled and linked against
MS-MPI version 8.1. It requires the MS-MPI redistributable package to be
installed and configured on all computers in the cluster.
Running on a cluster is an advanced functionality and probably requires some
knowledge of cluster systems to set up.
Texel uses a so called hybrid MPI design. This means that it uses a single MPI
process per computer. On each computer it uses threads and shared memory, and
optionally NUMA awareness.
After Texel has been started, use the "Threads" UCI option to control the total
number of search threads to use. Texel automatically decides how many threads to
use for each computer, and can also handle the case where different computers
have different number of CPUs and cores.
* Example using MPICH and Linux:
If there are 4 Linux computers called host1, host2, host3, host4 and
MPICH is installed on all computers, start Texel like this:
mpiexec -hosts host1,host2,host3,host4 /path/to/texel
Note that /path/to/texel must be valid for all computers in the cluster, so
either install Texel on all computers or install it on a network disk that is
mounted on all computers.
Note that it must be possible to ssh from host1 to the other hosts without
specifying a password. Use for example ssh-agent and ssh-add to achieve this.
* Example using MS-MPI and Windows:
If there are two computers called host1 and host2 and MS-MPI is installed on
both computers, proceed as follows:
1. On all computers, log in as the same user.
2. On all computers, add firewall exceptions to allow the programs mpiexec and
smpd (located in C:\Program Files\Microsoft MPI\Bin) to communicate over the
network.
3. On all computers, start a command prompt and execute:
smpd -d 0
4. Make sure Texel is installed in the same directory on all computers.
5. On the host1 computer, start a command prompt and execute:
cd /directory/where/texel/is/installed
mpiexec -hosts 2 host1 host2 texel64cl.exe
* Running the cluster version in a GUI
To run the cluster version of Texel in a GUI, the engine should be defined as
the mpiexec command with all parameters as given in the examples above. If the
GUI does not support adding command line parameters to the engine you can use a
wrapper program that passes the required parameters to mpiexec. If you are using
Linux, creating a one-line shell script should be enough. If you are using
Windows, you can use the included runcmd.exe program:
1. Copy the runcmd.exe program to the directory where Texel is located.
2. In the same directory create a text file called runcmd.txt that contains the
mpiexec command to run. Make sure the file ends with a newline character.
3. Install the runcmd.exe program as a UCI engine in the GUI.
Compiling
---------
Texel uses the CMake build system. To compile Texel follow these steps, assuming
you have access to a terminal environment:
1. cd <directory_where_texel_was_unpacked>
2. mkdir build
3. cd build
4. cmake ..
5. Run "cmake-gui ."
- Enable desired options
- Click "Generate"
- Exit cmake-gui
6. make -j8
7. ./texel
The following options can be enabled to activate CPU, OS and compiler specific
features. Not all options are available for all operating systems and compilers:
USE_SSSE3
Use SSSE3 instructions to speed up neural network evaluation.
USE_AVX2
Use AVX2 instructions to speed up neural network evaluation.
USE_AVX512
Use AVX-512 instructions to speed up neural network evaluation.
USE_BMI2
Use BMI2 instructions to speed up move generation.
USE_POPCNT
Use CPU popcount instructions to speed up counting of number of 1 bits in a
bitboard object.
USE_NEON
Use NEON instructions (for ARM CPUs) to speed up neural network evaluation.
USE_NEON_DOT
Use NEON and dot product instructions (for ARM CPUs) to speed up neural
network evaluation.
USE_CTZ
Use a special CPU instruction to find the first 1 bit in a bitboard object.
USE_PREFETCH
Use CPU prefetch instructions to speed up hash table access.
USE_NUMA
Optimize thread affinity and memory allocations when running on NUMA hardware.
USE_LARGE_PAGES
Prefer large pages when allocating memory for the transposition table. Only
effective if large page support is enabled in the operating system. For Linux
systems an alternative to using this option is to execute the following
command as root:
echo always >/sys/kernel/mm/transparent_hugepage/enabled
USE_CLUSTER
Use MPI to distribute the search to several computers connected in a cluster.
USE_WIN7
Compile for Windows 7 and later versions. This is required to be able to take
advantage of large computers that have more than 64 hardware threads.
Additional source code
----------------------
Source code for Texel's automatic test suite is provided in the test directory.
Source code for various tools used during Texel development is provided in the
app/texelutil directory. This program depends on the libraries Armadillo and GSL
for full functionality.
Source code for neural network training is provided in the app/torchutil
directory. This program depends on LibTorch, which is the C++ part of PyTorch.
Source code for an interactive interface to the Texel book building algorithm is
provided in the app/bookgui directory. It depends on gtkmm-3.0 and probably only
works in Linux.
Some utilities require access to tablebases. Set the environment variables
GTBPATH and RTBPATH to specify where the tablebase files are located.
Copyright
---------
The core Texel chess engine is developed by Peter Österlund, but Texel also
contains auxiliary code written by other people:
Gaviota Tablebases Probing Code, Copyright 2010 Miguel A. Ballicora.
See lib/texellib/gtb/readme.txt for more information.
LZMA compression by Igor Pavlov, used by the Gaviota Tablebases Probing code.
Syzygy tablebases probing code, Copyright 2011-2013 Ronald de Man.
Chess Cases font by Matthieu Leschemelle, used by the opening book builder
graphical user interface.
Google Test framework, Copyright 2008, Google Inc.