QueensGambit / CrazyAra

A Deep Learning UCI-Chess Variant Engine written in C++ & Python :parrot:
https://lichess.org/@/CrazyAra
GNU General Public License v3.0
247 stars 42 forks source link

Could not install Classic Ara on Both Linux and Windows #109

Closed magicianfromriga closed 3 years ago

magicianfromriga commented 3 years ago

Hi, I am a chess player and analyst. Recently I tried installing Classic Ara on my Ubuntu 20.04 LTS. It already has CUDA 11.1 and CUDNN 8.1 for an RTX 2070 Super Graphics Card (Processor is an older I7 4th gen). I downloaded the Tensor RT version and tried to run isready by going to the directory, opening the terminal and typing ./ClassicAra. I get the following output:

info string onnx file: model/chess/model-1.23453-0.572-0537-bsize-1.onnx info string no engine file found info string Building TensorRT engine... info string This may take a few minutes... terminate called after throwing an instance of 'pwgen::PwgenException' what(): Driver error: Aborted (core dumped)

Then, I tried it on my laptop which has Chessbase 16 and CUDA 11.1 installed. The laptop also has a CUDA supported G-card (GTX 1660TI). I tried to create the engine from Chessbase 16 and open it, but it gives an error message and doesn't start.

I then tried running the .exe file. I opened it by double clicking it and then typing isready. This command worked, but when I tried benchmark 3000 it closed unexpectedly without any output. Can you please help me with installing this on my PC? Also, a kind request - please try to give detailed installation instructions on the GitHub page like the Stockfish and Leela repositories.

Congratulations on your TCEC entry! Your engine plays fantastic games! Looking forward to its further progress! Best regards, magicianofriga.

QueensGambit commented 3 years ago

Hello @magicianofriga , thank you for you detailed information about the installation process. I assume that you downloaded release 0.9.0 for Ubuntu. I think the driver error occurred because the binary for release 0.9.0 was built using CUDA 11.2 and TensorRT-7.2.3.4, not CUDA 11.1.

CrazyAra_ClassicAra_0.9.0_Linux_TensorRT.zip

There is, however, the option to install ClassicAra on Linux without having to update your drivers. For this, you can use the shell script update.sh provided in release 0.9.2.post1. The script will install all required dependencies, build the binary from the current master branch, download model Risev3.3. and generate the trt-files.

When the script asks the question How many GPUs do you want to use [4]: you should answer 1 in your case.

I haven't provided binaries for release 0.9.2 yet, because some TCEC matches revealed some bugs which I like to fix beforehand.


The reason why the binary crashed for benchmark 3000 on your laptop, is because the benchmark command is currently only supported for crayzhouse. It makes sense to support the command for classical chess, too.

A different command like go should work as expected in classical chess.

There are some installation instructions already

but I agree that more information helps.

I heard that there is a problem when trying to run ClassicAra in Chessbase. Other GUIs like cutechess, Arena, Winboard/XBoard, LiGround, ... should load the binary successfully.

Kind regards, Johannes Czech

magicianfromriga commented 3 years ago

Hi Johannes, Thank you for your detailed post! It really helps when the author is involved in helping us solve our issues! More power to you! The thing is that I use engines like yours to find new ideas, and Chessbase has the best interface for the same. The only other alternative is Scid Vs PC that I have on my Ubuntu - will this work? I will try installing ClassicAra with the script on my Laptop as well and update you if it works better. Till then, can I please keep this issue open? (Also - it seems that I don't have TensorRT installed on my PC. Will install that as well and check). Thank you, magicianofriga.

QueensGambit commented 3 years ago

I just tried loading ClassicAra in Scid Vs PC and it worked. However, I needed to move the model directory into /home/username/.scidb-beta/engines/ClassicAra-0.9.3-Dev-(May-15-2021) to make it work. I think Chessbase has a similar problem, that the active directory is not set correctly and the binary fails to load the model which is located relative to the binary. Can you give more information about the problem when trying to load it into Chessbase? For instance can you give information about the stdin communication with the binary? I was told that importing ClassicAra into the BanksiaGUI and Nibbler works as well.

magicianfromriga commented 3 years ago

Hi, I will try this out and let you know. Regarding using the script, it doesn't work for me. I am attaching whatever I have got in one of the files I have sent here. With regards to the rest, I will try them out tomorrow and let you know how it goes! Thank you, magicianofriga.

ClassicAraFailureInstall.txt

QueensGambit commented 3 years ago

You were using the latest TensoRT version 8, right? It looks like the method setAllTensorScales has been deprecated.

/home/dell/Downloads/CrazyAra/engine/src/nn/tensorrtapi.cpp:244:24: error: ‘setAllTensorScales’ is not a member of ‘samplesCommon’

I plan to make ClassicAra compatible to the latest TensorRT version.

magicianfromriga commented 3 years ago

Hi, Is there a possibility where I can install the latest version on Windows 10? I tried to make the script work on Windows using the latest option of running shell scripts on Windows, but it doesn't quite work. Thank you!

magicianfromriga commented 3 years ago

I just tried loading ClassicAra in Scid Vs PC and it worked. However, I needed to move the model directory into /home/username/.scidb-beta/engines/ClassicAra-0.9.3-Dev-(May-15-2021) to make it work. I think Chessbase has a similar problem, that the active directory is not set correctly and the binary fails to load the model which is located relative to the binary. Can you give more information about the problem when trying to load it into Chessbase? For instance can you give information about the stdin communication with the binary? I was told that importing ClassicAra into the BanksiaGUI and Nibbler works as well.

We get this error message saying that ClassicAra doesn't start - there is a problem with the engine. Apart from that, no other messages on Chessbase.

QueensGambit commented 3 years ago

Hi, Is there a possibility where I can install the latest version on Windows 10? I tried to make the script work on Windows using the latest option of running shell scripts on Windows, but it doesn't quite work. Thank you!

The shell script only works on Linux so far. However, there are instructions in the wiki pages, on how to build it on Windows:

If you want to contribute a batch installation script for Windows, you are welcome to do so.

magicianfromriga commented 3 years ago

Hi, I went back to my Linux station to try with TensorRT 7.2.3. First of all, it wasn't available for Ubuntu 20.04 so I downloaded the 18.04 one. The creation of the engine threw a lot of warnings, but the executable was created. However, it just doesn't run. I am attaching the entire file here. Please go through it and guide me. ClassicAraFailureInstall.txt Also, if you can tell me the steps you followed to install it on Scid, I would be really grateful. Your engine is rocking it at TCEC (even the game it lost it played really well and it is outplaying a lot of engines). MCGS is a really interesting algo for sure. I would love to start using it as quickly as I can. Please help me!

QueensGambit commented 3 years ago

Hello, nice to hear that you managed to build the binary. The 'pwgen::PwgenException' appears to be related to a driver issue or that you are missing the TensorRT library in your LD_LIBRARY_PATH and PATH variable.

Make sure you downloaded the correct TensorRT version, e.g.TensorRT-7.2.3.4.Ubuntu-18.04.x86_64-gnu.cuda-11.1.cudnn8.1.

To add the TensorRT path, you can open your .bashrc file using:

gedit ~/.bashrc

and add the corresponding file paths for you system:

export PATH=$PATH:/home/dell/Downloads/TensorRT/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/dell/Downloads/TensorRT/lib/

Next, you can use

source ~/.bashrc

to apply the changes.

Afterwards, you can launch the already built binary again.

./ClassicAra

By default, ClassicAra is looking for the neural network model in the directory model/chess. So you can either rename model/risev3.3_kingbaselite2019 into model/chess or update the Model_Directory value before isready.

setoption name Model_Directory value model/risev3.3_kingbaselite2019

The command isready will then generate the trt-files for later usage.

You can also inspect which libraries the ClassicAra binary depends on using.

ldd ClassicAra

By default, the trt-files will be generated for float16 precision. If you want to use ClassicAra with your GTX 1660TI, then the engine should be much faster if you choose int8 precision instead.

./ClassicAra
setoption name Precision value int8
isready
magicianfromriga commented 3 years ago

Hi, It seems that Ubuntu 20.04 isn't compatible with TensorRT 7. Can I keep this issue open while you update the binaries? Currently I uninstalled CUDA as well. Plan to install 11.1 from scratch and then CUDNN 8.1. Just a request - that you make the installation more intuitive for us. This engine has the potential to change chess theory, so it has a bright future! Best wishes, magicianofriga

QueensGambit commented 3 years ago

Yes, you can keep this issue open. TensorRT 8.0 works on Ubuntu 20.04, right? So it makes sense to resolve the deprecated code problem. Normally, the releases contain binaries for each operating system. On Windows, at least, the installation should not be too difficult as all dll files are provided. The only annoying installation step is to first generate the trt files before using the engine.

QueensGambit commented 3 years ago

I implemented some changes to support TensorRT 8.0. If the problem still persists on your machine, feel free to reopen this issue.