LeelaChessZero / lc0

The rewritten engine, originally for tensorflow. Now all other backends have been ported here.
GNU General Public License v3.0
2.45k stars 530 forks source link

Build doesn't fail when no backends cannot be built #898

Closed scaljeri closed 4 years ago

scaljeri commented 5 years ago

I tried to run lc0 inside a docker container. I followed the instructions for Ubuntu 18.04.

$> CC=clang-6.0 CXX=clang++-6.0 INSTALL_PREFIX=~/.local ./build.sh

Downloaded a weight file from here Now when I try to run

$> ./lc0 -w LD2.pb.gz
       _
|   _ | |
|_ |_ |_| v0.22.0-dev built Jun 23 2019
go
Loading weights file from: /LD2.pb.gz
Creating backend [check]... 
Working backend set to opencl.
Reference backend set to blas.
Creating backend [opencl]...
error Unknown backend: opencl

I cannot find much about backend, but I noticed that when I use a backend which doesn't exist it will list the available backends:

 ./lc0 -w /LD2.pb.gz -b xyz
         _
 |   _ | |
 |_ |_ |_| v0.22.0-dev built Jun 23 2019
 terminate called after throwing an instance of 'lczero::Exception'
  what():  Flag '--backend' must be one of the following values: check random roundrobin 
 multiplexing demux.
 Aborted

So, I've tried all of them and only random seems to work, but I would like it to play a good game against, for example, stockfish. Now. I'm using an old mac book (2013) so I guess I can only use some kinds of CPU backend

Is this possible and is this somewhere documented (Lc0 inside docker and backends)

Found an article that states:

And BLAS is for running Lc0 not with a GPU, but with a CPU. That is MUCH slower

But how can I define a BLAS backend? Or is there a better alternative for my docker on my macbook?

mooskagh commented 5 years ago

It wasn't able to build any sensible (not random-playing) backend, probably because required libraries were not installed in the system. What's broken though (other than "check" backend having higher priority than "random", I've just sent #900 for that) is that it was built successfully, it was supposed to fail the build explaining what's going on.

scaljeri commented 5 years ago

Ok, so thats the reason, thnx. I just installed Blas and it works like a charm :)

borg323 commented 5 years ago

The BLAS backend should be buildable with Eigen out of the box (and mey be faster than openblas since it is customized for the build machine). Try adding -Dblas=true -Deigen=true at the end of the build command.

DanielUranga commented 5 years ago

If you have a GPU that supports CUDA the best approach would be to use this Docker image: danieluranga/leela_chess_zero-lc0_ubuntu_builder and Nvidia Docker.

scaljeri commented 5 years ago

Thanks a lot, this is all I needed. If all is working find, CUDA will be the next step!

mooskagh commented 5 years ago

I've re-purposed this issue to build-should-fail one. (originally introduced in this commit: https://github.com/LeelaChessZero/lc0/commit/d9f1652744998954a20d341da495902cd7046645, not sure when stopped working).

borg323 commented 5 years ago

This is very weird. Reviewing meson.build everything seems like it should be, and trying to build on a fresh windows 10 VM (with no cuda/opencl/blas) the build did indeed fail. @scaljeri do you still have the log from the lc0 build reported in the first post?

Edit: The only scenario I can come up with, it that there was an earlier build with -Dbuild_backends=false. The options from previous builds are cached and should be explicitly reversed.

scaljeri commented 5 years ago

I don't have the old images/containers anymore and I cannot reproduce it :( It just works now as expected. Super weird.

Naphthalin commented 4 years ago

@mooskagh if I understand you correctly, the issue described here should now fail successfully?

borg323 commented 4 years ago

We never figured out what the problem was, the build does fails correctly for me (I did test it a few days ago coincidentally) but it should have failed back then as well.