Skip to content

Commit

Permalink
Update to Fairy Stockfish largeboards 14.1
Browse files Browse the repository at this point in the history
- Update to Fairy Stockfish largeboards 14.1
fairy-stockfish/Fairy-Stockfish@67af994
- Support Python 3.10:
`setDaemon()` is deprecated
- Windows Support for WandererXII#9
A script similar to the`./build-stockfish.sh` but for windows has not been added.
- Fix markdown formatting
  • Loading branch information
TheYoBots committed Feb 8, 2022
1 parent 4266e8a commit 2855db7
Show file tree
Hide file tree
Showing 10 changed files with 170 additions and 94 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.vscode/
__pycache__
fishnet.ini
YaneuraOu/
Fairy-Stockfish/
41 changes: 33 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# Shoginet - Distributed Network for [lishogi.org](lishogi.org)
# Shoginet - Distributed Network for [lishogi.org](https://lishogi.org/)

Based on [fairyfishnet](https://github.com/gbtami/fairyfishnet).

## How to setup

#### Linux

You need to have YaneuraOu for NNUE ready. To achieve this you can use the provided script `build-yaneuraou.sh`. The script first clones [YaneuraOu github](https://github.com/yaneurao/YaneuraOu) and then runs the make command either with avx2 or sse42 depending on your cpu.
You can also try using the provided precompiled 'YaneuraOu-by-gcc' for intel with avx2, if that works for you or build YaneuraOu with some script in YaneuraOu/script.
To test that engine works on you machine just run the engine `./YaneuraOu-by-gcc`.
You need to have Fairy Stockfish largeboards for linux ready. To achieve this you can use the provided script `build-stockfish.sh`. The script first clones [Fairy Stockfish github](https://github.com/ianfab/Fairy-Stockfish) and then runs the make command either with popcnt or bmi2 depending on your cpu. You can also try using the provided precompiled 'fairy-stockfish-largeboards' for intel with bmi2, if that works for you or you can [compile Fairy Stockfish largeboards seperately](https://github.com/ianfab/Fairy-Stockfish/wiki/Compiling-Fairy-Stockfish) or download Fairy Stockfish largeboards from the [latest release](https://github.com/ianfab/Fairy-Stockfish/releases).
To test that engine works on you machine just run the engine `./fairy-stockfish-largeboards`.

```
usi
Expand All @@ -18,13 +17,39 @@ after readyOk appears run:
`bench`
If the engine didn't crash, it probably works.

If you have YaneuraOu ready and python3 installed just run `python3 ./shoginet.py`, it will ask you about what working directory you want to use, path to the engine and similar things, leaving everything default should be fine. Currently no key is required.
If you want to go over this setup step again, just delete fishnet.ini.
If you have Fairy Stockfish largeboards ready and python3 installed just run,
```
pip install -r requirements.txt
python ./shoginet.py
```
It will ask you about what working directory you want to use, path to the engine and similar things, leaving everything default should be fine. Currently no key is required.

If you want to go over this setup step again, just delete the `fishnet.ini` file.

#### Windows

Windows is not supported right now. Although almost everything should be fine. You will obviously have to compile YaneuraOu for windows and provide the correct path, when shoginet.py asks you the first time.
Shoginet should works on windows the same way it does on linux, though you require make a few small changes.

Firstly, you need to get Fairy Stockfish largeboards for windows, which you will find in [Fairy Stockfish's releases](https://github.com/ianfab/Fairy-Stockfish/releases). You can also try using the provided precompiled 'fairy-stockfish-largeboards.exe' for intel with bmi2, if that works for you or [compile Fairy Stockfish largeboards seperately](https://github.com/ianfab/Fairy-Stockfish/wiki/Compiling-Fairy-Stockfish). To test that engine works on your machine just run the engine `\fairy-stockfish-largeboards.exe`.
```
usi
isready
```
after `readyOk` appears run:
```
bench
```
If the engine didn't crash, it probably works. Make sure to add the windows version of Fairy Stockfish largeboards that you have downloaded in the shoginet directory.

If you have Fairy Stockfish largeboards ready and python3 installed just run,
```
pip install -r requirements.txt
python shoginet.py
```
It will ask you about what working directory you want to use, path to the engine and similar things, leaving everything default should be fine. Currently no key is required.

If you want to go over this setup step again, just delete the `fishnet.ini` file.

## How it works

Every once in a while shoginet running on your computer asks lishogi.org for some work. If someone requested analysis of their game on lishogi.org, you may receive this work. The work is a simple json containing mainly the initial position and sequence of moves. You then run engine analysis on these data and send the results back to lishogi.org.
Every once in a while shoginet running on your computer asks [lishogi.org](https://lishogi.org/) for some work. If someone requested analysis of their game on [lishogi.org](https://lishogi.org/), you may receive this work. The work is a simple json containing mainly the initial position and sequence of moves. You then run engine analysis on these data and send the results back to [lishogi.org](https://lishogi.org/).
Binary file removed YaneuraOu-by-gcc
Binary file not shown.
38 changes: 38 additions & 0 deletions build-stockfish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/sh

echo "- Getting latest Fairy-Stockfish ..."

if [ -d Fairy-Stockfish/src ]; then
cd Fairy-Stockfish/src
make clean > /dev/null
git pull
else
git clone --depth 1 https://github.com/ianfab/Fairy-Stockfish.git
cd Fairy-Stockfish/src
fi

echo "- Determining CPU architecture ..."

ARCH=x86-64
EXE=fairy-stockfish-largeboards_x86-64

if [ -f /proc/cpuinfo ]; then
if grep "^flags" /proc/cpuinfo | grep -q popcnt ; then
ARCH=x86-64-modern
EXE=fairy-stockfish-largeboards_x86-64-modern
fi

if grep "^vendor_id" /proc/cpuinfo | grep -q Intel ; then
if grep "^flags" /proc/cpuinfo | grep bmi2 | grep -q popcnt ; then
ARCH=x86-64-bmi2
EXE=fairy-stockfish-largeboards_x86-64-bmi2
fi
fi
fi

echo "- Building $EXE ... (patience advised)"
make build ARCH=$ARCH EXE=../../$EXE largeboards=yes > /dev/null

cd ../..
mv ./fairy-stockfish* ./fairy-stockfish-largeboards
echo "- Done!"
42 changes: 0 additions & 42 deletions build-yaneuraou.sh

This file was deleted.

Binary file removed eval/nn.bin
Binary file not shown.
Binary file added fairy-stockfish-largeboards
Binary file not shown.
Binary file added fairy-stockfish-largeboards.exe
Binary file not shown.
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pyffish==0.0.69
requests
Loading

0 comments on commit 2855db7

Please sign in to comment.