Skip to content

Running the worker: overview

ppigazzini edited this page Dec 23, 2019 · 6 revisions

Get username/password for fishtest

In case you have not done so already, get a new account/password registering on fishtest:

https://tests.stockfishchess.org/signup

Please mind that after the registration you will be automatically redirected to the login page. The message "Permission Required. Creating or modifying tests requires you to be logged in. If you don't have an account, please Register." is an information, not an error message.

Install the worker

In case you have not installed the worker on your computer yet, follow the installation instructions on these pages :

Launch the worker

To launch the worker using the default parameters (e.g. using 3 CPU cores) simply open a console window in worker directory and run the following command providing your fishtest username and password:

python3 worker.py username password

Add the option concurrency to control the number of CPU cores allocated to the worker. The safest max setting suggested is to use the number of physical cores leaving one core for the OS. On a PC dedicated only to fishtest it's possible to set concurrency to the number of virtual cores leaving one core for the OS, but with the number of workers contributed today to the framework this is not strictly necessary.

python3 worker.py username password --concurrency 7

At the start the workers writes the parameters into the configuration file fishtest.cfg, so next time you can start the worker with the simple:

python3 worker.py

On Linux and Macintosh, you can use the nohup command to run the worker as a background task.

nohup python3 worker.py &

Worker parameters

python3 worker.py <username> <password> [-P <URL protocol>] [-n <URL domain>] [-p <URL port>] [-c <number of cores>] [-m <memory>] [-t <test min thread number>]

<username>         : your username on fishtest, first argument
<password>         : your password on fishtest, second argument
-P / --protocol    : protocol of the fishtest server URL (default: https)
-n / --host        : address of fishtest server URL (default: tests.stockfishchess.org)
-p / --port        : port of fishtest server URL (default: 443)
-c / --concurrency : the number of core allocated to the worker (default: 3)
-m / --max_memory  : memory used by the worker (default: system memory/2 expressed in MB)
-t / --min_threads : minimum number of thread that a test must have to be assigned to the worker (default: 1) 

Override default make command

Once launched, fishtest will automatically connect to host, download the book, the cutechess-cli game manager and the engine sources that will be compiled according to the type of worker platform. If default make command is not suitable for you, for instance if you need to use some other compiler than gcc/mingw, then you can create a custom_make.txt file in worker directory, containing a single line command that fishtest will run to compile the sources.

[CXXFLAGS=compiler_flags] make [-j [<n_cores>]] target ARCH=arch COMP=compiler

target:
build              > normal build
profile-build      > build with Profile Guided Optimization (PGO)

arch:
x86-64-bmi2        > x86 64-bit with pext support (also enables SSE4)
x86-64-modern      > x86 64-bit with popcnt support (also enables SSE3)
x86-64             > x86 64-bit generic
x86-32             > x86 32-bit (also enables SSE)

compiler:         
gcc                > Gnu compiler (default)
mingw              > Gnu compiler with MinGW under Windows
clang              > LLVM Clang compiler
icc                > Intel compiler

[-j [<n_cores>]]          : speedup compiling using all the CPU cores or the number of CPU cores if indicated

[CXXFLAGS=compiler_flags] : on linux passes optional compiler flags to the make command, e.g. CXXFLAGS='-march=native'

Stop the worker

To stop gracefully the worker write a file named fish.exit near the worker.py script, the worker will stop after finishing the batch games. On linux simply run the command touch fish.exit. Remember to delete the fish.exit before the next start or the worker will exit immediately.

By the way you can stop as soon as possible the worker simply killing the process, e.g. CRTL+C in the command window, using the kill command on linux etc. The games played by your worker will be used by the framework but the total batch games number will be credited to the user that will complete your batch.

You can’t perform that action at this time.