kblomdahl / dream-go

Artificial go player based on reinforcement and supervised learning
Apache License 2.0
47 stars 8 forks source link

Compiling #11

Closed as0770 closed 6 years ago

as0770 commented 6 years ago

Hi, this looks like an interesting project. I am new in Rust and I tried to compile it. After installing the Rust stable release channel I got this error message:

  Installing dream_go v0.5.0 (file:///home/alex/Downloads/dream-go-0.5.0)
   Compiling dream_go v0.5.0 (file:///home/alex/Downloads/dream-go-0.5.0)
error[E0554]: #![feature] may not be used on the stable release channel
  --> src/lib.rs:14:1
   |
14 | #![feature(asm)]
   | ^^^^^^^^^^^^^^^^

error[E0554]: #![feature] may not be used on the stable release channel
  --> src/lib.rs:15:1
   |
15 | #![feature(io)]
   | ^^^^^^^^^^^^^^^

error[E0554]: #![feature] may not be used on the stable release channel
  --> src/lib.rs:16:1
   |
16 | #![feature(link_llvm_intrinsics)]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0554]: #![feature] may not be used on the stable release channel
  --> src/lib.rs:17:1
   |

After updating to the nightly release channel and even after completely removing Rust and installing the nightly release channel I get still the same error. Any ideas?

kblomdahl commented 6 years ago

I can re-produce your problem when using the following version of rustc and cargo. They correspond to the stable release of rust.

kalle@coffee:[~]$ cargo --version
cargo 0.24.0 (45043115c 2017-12-05)
kalle@coffee:[~]$ rustc --version
rustc 1.23.0 (766bd11c8 2018-01-01)

After a fresh re-install of nightly (I use the rustup installer, but had to remove some directories to get it to actually re-install) it works correctly. If you are still getting the wrong version, even after removing the ~/.cargo/ and ~/.rustup/ directories check which binary you are using with which and adjust your PATH environment variable appropriately. If that does not help, then please post the exact versions of rust and cargo you are using and I'll debug further:

kalle@coffee:[dream-go]$ rm -rf ~/.cargo/ ~/.rustup/
kalle@coffee:[dream-go]$ curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly
kalle@coffee:[dream-go]$ cargo --version
cargo 0.25.0-nightly (a88fbace4 2017-12-29)
kalle@coffee:[dream-go]$ rustc --version
rustc 1.25.0-nightly (73ac5d6a8 2018-01-11)

I will fix the README.md file, since it seems I was not using the correct release when test compiling it on stable. If you have not found them already, you will need some pre-trained weights if you want to train against it, you can find them in the release tab in the dg050_weights.zip archive. Just put them in your current working directory.

as0770 commented 6 years ago

Thanks for your help, the Rust problem is solved now. By deleting the .cargo and .rustup folders I was able to install the nightly channel. Unfortunately there seems to be a problem with cudnn:

Compiling utf8-ranges v1.0.0 Compiling unicode-width v0.1.4 Compiling void v1.0.2 Compiling regex-syntax v0.4.1 Compiling lazy_static v1.0.0 Compiling libc v0.2.34 Compiling num-traits v0.1.41 Compiling bitflags v0.4.0 Compiling encode_unicode v0.1.3 Compiling unreachable v1.0.0 Compiling unreachable v0.1.1 Compiling rand v0.4.1 Compiling nix v0.5.1 Compiling time v0.1.38 Compiling num_cpus v1.7.0 Compiling memchr v2.0.1 Compiling thread_local v0.3.5 Compiling ordered-float v0.5.0 Compiling rustyline v1.0.0 Compiling aho-corasick v0.6.4 Compiling threadpool v1.7.1 Compiling regex v0.2.3 Compiling dream_go v0.5.0 (file:///home/alex/dream-go-0.5.0) error: linking withccfailed: exit code: 1 | = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.16u6js6g0l3k1ic6.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.1fxq14vrn4hmbyv6.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.1im38lueib99jsk0.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.1mvmz58owquyropc.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.1pyg38ew8eq184bu.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.1rnt618l5epcaf5a.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.1s3socv0drccut20.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.1vut2eft6nlujjxr.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.1zeawhkbeobww1zn.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.28m6b5dkfoixx5aa.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.2g4eewwjdzplofwt.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.2jqywn86b2gsqohu.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.2kjrmm4fe2aha78f.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.3171x0bwu82dptu7.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.32vw6ghja9acb48h.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.3ayaeypdcro9d6yk.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.3cx7oljifvb206q7.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.3kfx4ynvkmi2y9i5.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.3rngp6bm2u2q5z0y.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.3ysg602ly0el3m63.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.43v6g0y2xsxoggnt.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.45pc7c65foh9i35f.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.47dqcamjlp23ma80.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.49a7n47po4ttqjl7.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.49lx1q7cxvpykyv0.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.4b8ptp1vn215jmoe.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.4bwka44cn8t3u4h3.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.4jdnq7xfjeka1bt.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.4sw9hz7i7fiueihz.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.4w500rvf7dii7p2s.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.4ypvbwho0bu5tnww.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.5205e1onhko1v9bb.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.55ezy8i7h0n87k30.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.56dly8q07ws8ucdq.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.572bgozz9kcwe4zq.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.5b1vh7iwaxrgdt9b.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.5frs3mx5dzjbj7u6.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.63mmpc50mjcb0lb.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.8xzrsc1ux72v29j.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.9elsx31vb4it187.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.e19kx9t7xhzajfl.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.n847vnkjamrby94.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.pqmjx25qpxkduz7.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.r5omkko2zyx5xap.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.v21vw1vc14hni5m.rcgu.o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.xr3ikvc7ts2t4bo.rcgu.o" "-o" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304" "/home/alex/dream-go-0.5.0/target/debug/deps/dream_go-d879b36547e48304.crate.allocator.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-nodefaultlibs" "-L" "/home/alex/dream-go-0.5.0/target/debug/deps" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/home/alex/dream-go-0.5.0/target/debug/deps/libdream_go-75be65bde271a37a.rlib" "/home/alex/dream-go-0.5.0/target/debug/deps/libtime-208229ee025cc99c.rlib" "/home/alex/dream-go-0.5.0/target/debug/deps/libthreadpool-46033fdfb0f77afa.rlib" "/home/alex/dream-go-0.5.0/target/debug/deps/libnum_cpus-8f2c36ee6cf6cee2.rlib" "/home/alex/dream-go-0.5.0/target/debug/deps/librustyline-f2511d187fa5b5b6.rlib" "/home/alex/dream-go-0.5.0/target/debug/deps/libencode_unicode-827f0a975b13b3e8.rlib" "/home/alex/dream-go-0.5.0/target/debug/deps/libunicode_width-ee415645aa70de78.rlib" "/home/alex/dream-go-0.5.0/target/debug/deps/libnix-9e93ec24403fbffd.rlib" "/home/alex/dream-go-0.5.0/target/debug/deps/libbitflags-02ee79d082293e93.rlib" "/home/alex/dream-go-0.5.0/target/debug/deps/libregex-99ea2a43858c0784.rlib" "/home/alex/dream-go-0.5.0/target/debug/deps/libutf8_ranges-99acaeb751d2e81a.rlib" "/home/alex/dream-go-0.5.0/target/debug/deps/libregex_syntax-2fcfd1423b2fedff.rlib" "/home/alex/dream-go-0.5.0/target/debug/deps/libthread_local-1b70ce483a505e4d.rlib" "/home/alex/dream-go-0.5.0/target/debug/deps/libunreachable-1494770b8f9d8264.rlib" "/home/alex/dream-go-0.5.0/target/debug/deps/libaho_corasick-ddea6661d9644274.rlib" "/home/alex/dream-go-0.5.0/target/debug/deps/libmemchr-49223650e4ecad2b.rlib" "/home/alex/dream-go-0.5.0/target/debug/deps/librand-bd8807c6b9a8054b.rlib" "/home/alex/dream-go-0.5.0/target/debug/deps/libordered_float-abfeba11bf0cd008.rlib" "/home/alex/dream-go-0.5.0/target/debug/deps/libunreachable-7fc9b532984d108e.rlib" "/home/alex/dream-go-0.5.0/target/debug/deps/libvoid-19d980e8f24c2428.rlib" "/home/alex/dream-go-0.5.0/target/debug/deps/libnum_traits-850636949e43ed22.rlib" "/home/alex/dream-go-0.5.0/target/debug/deps/liblibc-c03fbabdb0ceadd5.rlib" "/home/alex/dream-go-0.5.0/target/debug/deps/liblazy_static-382e19916cacf2d7.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-69df205dfb019f43.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-0533d7030957184a.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_jemalloc-c9aa248bf12e5ed8.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-0bb0bc7901f3da7b.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_system-45647787d4fc874d.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-c235c2f01f47fa30.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-c2bec69206b7815e.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_unicode-4fbb515f7b40d6cb.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-2eed9f7fcc01d8f4.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-5a1c21433b34595b.rlib" "-Wl,-Bdynamic" "-l" "cublas" "-l" "cuda" "-l" "cudart" "-l" "cudnn" "-l" "util" "-l" "util" "-l" "dl" "-l" "rt" "-l" "pthread" "-l" "pthread" "-l" "gcc_s" "-l" "c" "-l" "m" "-l" "rt" "-l" "pthread" "-l" "util" "-l" "util" = note: /home/alex/dream-go-0.5.0/target/debug/deps/libdream_go-75be65bde271a37a.rlib(dream_go-75be65bde271a37a.nqkos8i0yyd5rrg.rcgu.o): In Funktiondream_go::nn::forward::h1939f90e5c3dd002': /home/alex/dream-go-0.5.0/src/nn/mod.rs:72: Nicht definierter Verweis auf cudnnConvolutionBiasActivationForward' /home/alex/dream-go-0.5.0/src/nn/mod.rs:89: Nicht definierter Verweis aufcudnnConvolutionBiasActivationForward' /home/alex/dream-go-0.5.0/src/nn/mod.rs:104: Nicht definierter Verweis auf cudnnConvolutionBiasActivationForward' /home/alex/dream-go-0.5.0/src/nn/mod.rs:128: Nicht definierter Verweis aufcudnnConvolutionBiasActivationForward' /home/alex/dream-go-0.5.0/src/nn/mod.rs:203: Nicht definierter Verweis auf cudnnConvolutionBiasActivationForward' /home/alex/dream-go-0.5.0/target/debug/deps/libdream_go-75be65bde271a37a.rlib(dream_go-75be65bde271a37a.nqkos8i0yyd5rrg.rcgu.o):/home/alex/dream-go-0.5.0/src/nn/mod.rs:72: Weitere nicht definierte Verweise aufcudnnConvolutionBiasActivationForward' folgen collect2: error: ld returned 1 exit status

error: aborting due to previous error

error: Could not compile dream_go. ` I had cuda 8 and just installed cuda 9.1 and cuDNN 7 without success... How about releasing binaries? :-)

kblomdahl commented 6 years ago

Rust is a bit weird when it comes to shared libraries, it uses the LIBRARY_PATH environment variable instead of the more normal approaches. So if you installed the CUDA libraries from the NVIDIA packages you will need to point that variable to the correct path. The following is what I usually have to do when compiling on the AWS cloud:

$ export LIBRARY_PATH=/usr/local/cuda/lib64
$ cargo build

Alternatively, I attached a binary that is linked against CUDA 9.1 and CUDNN 7 to this post. Put the two files in the same directory and it should pick up the weights.

dream_go_c91dnn7.zip

It is linked against the following, which should be pretty standard:

kalle@coffee:[dream-go-copy]$ ldd dream_go
    linux-vdso.so.1 =>  (0x00007ffd5c97f000)
    libcublas.so.9.1 => /usr/local/cuda-9.1/targets/x86_64-linux/lib/libcublas.so.9.1 (0x00007f59a5ae8000)
    libcudart.so.9.1 => /usr/local/cuda-9.1/targets/x86_64-linux/lib/libcudart.so.9.1 (0x00007f59a587a000)
    libcudnn.so.7 => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libcudnn.so.7 (0x00007f59943e3000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f59941df000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f5993fd7000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f5993db8000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f5993ba1000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f59937c1000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f59a9487000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f599346b000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f59930e5000)

Maybe I will generate some .deb, and .rpm files for the next release...

as0770 commented 6 years ago

Many thanks for the binary, this seems to work well! I started some test games against other engines.

With $ export LIBRARY_PATH=/usr/local/cuda/lib64 $ cargo build or $ export LIBRARY_PATH=/usr/local/cuda-9.1/lib64 $ cargo build I still get the same error message... Some easy way to install Dream Go would be much appreciated, I am not a programmer and there are often problems when compiling or installing engines with cuda dependency.

kblomdahl commented 6 years ago

Cool, I'll see if I can put some .deb and .rpm packages into the next release. I was also planning to put some windows builds in there at some point.

By default the engine will use 800 playouts, you can control how many it uses by setting the NUM_ITER environment variable. In their paper DeepMind used 1600 and it results in quite a large increase in strength. It is using a low number of playouts by default at the moment to make the self-play faster, if you are running a tournament you might want to increase that.

The exact value depends on your computer, but a value of 800 makes it think for about 0.2 seconds per move and 4000 makes the engine think for roughly 1 seconds per move.

$ export NUM_ITER=1600
$ ./dream_go

alternatively

$ NUM_ITER=1600 ./dream_go

If it is not too much trouble I would be interested in the results since I've only done small scale testing against Leela and Dream Go tends to outperform it when using the same number of playouts (note that playouts means different things for the to engines, so a bit of an unfair comparison).

as0770 commented 6 years ago

Nice, setting the number of playouts with NUM_ITER=x ./dream_go works well.

But with the default setting of 800 it needs ~15sec for the first move here. for the next moves the number of playouts increase but the used time remains the same more or less. Still I am far away from 0.2sec/move.

I am on a i5 @ 2,9GHz x 4, 8GB RAM, GeForce 840M/PCIe/SSE2 and 64BIT Ubuntu 16.04

The GPU is used 100%, and the CPU 25% which is 1 thread of 4.

`genmove b Nodes: 800, Win: 49.6%, PV: d4 q4 c16 q17 e17 c6 f3 b4 o3 r6 c8 c3 c5 b5 d6 d4 -> 493 (W: 49.54%) (N: 57.91%) PV: d4 q4 c16 q17 e17 c6 f3 b4 o3 r6 c8 c3 c5 b5 d6 = d4

d3 -> 282 (W: 49.81%) (N: 30.69%) PV: d3 d16 r4 q16 c14 f17 c8 p4 p3 o3 q3 n4 r6 e4 -> 13 (W: 48.93%) (N: 1.99%) PV: e4 d16 r4 q16 d1 -> 8 (W: 45.74%) (N: 2.17%) PV: d1 q16 r4

genmove w Nodes: 1293, Win: 50.4%, PV: q4 c16 q17 e17 c6 f3 b4 o3 r6 c8 c3 c5 b5 d6 d7 c7 b6 e7 m3 d10 k16 r14 q4 -> 666 (W: 50.17%) (N: 48.64%) PV: q4 c16 q17 e17 c6 f3 b4 o3 r6 c8 c3 c5 b5 d6 d7 c7 b6 e7 m3 d10 k16 r14 q16 -> 477 (W: 50.73%) (N: 29.20%) PV: q16 q3 c16 r14 o17 r8 k3 f3 n3 o4 o3 p3 p5 n4 m4 m5 l4 q3 -> 116 (W: 50.24%) (N: 8.27%) PV: q3 d17 q16 o17 r14 k16 c14 c16 c11 r16 -> 22 (W: 50.54%) (N: 1.45%) PV: r16 d17 q3 p17 d15 c15 p13 -> 7 (W: 46.39%) (N: 1.29%) PV: p13 r4 q16

= q4

genmove b Nodes: 1466, Win: 50.0%, PV: c16 q17 e17 c6 f3 b4 o3 r6 c8 c3 c5 b5 d6 d7 c7 b6 e7 m3 d10 k16 r14 r16 q10 q12 r12 q13 r13 c16 -> 850 (W: 50.46%) (N: 43.38%) PV: c16 q17 e17 c6 f3 b4 o3 r6 c8 c3 c5 b5 d6 d7 c7 b6 e7 m3 d10 k16 r14 r16 q10 q12 r12 q13 r13 d17 -> 488 (W: 49.49%) (N: 34.66%) PV: d17 q16 o17 r14 k16 c14 c16 c11 c9 e14 d13 d14 g16 e11 d16 -> 85 (W: 48.44%) (N: 7.79%) PV: d16 q17 q15 r15 r14 r16 o3 r6 q13 o17 r9 q2 g17 -> 16 (W: 48.47%) (N: 1.60%) PV: g17 q17 q15 r15 r14 l6 -> 11 (W: 48.15%) (N: 1.23%) PV: l6 q16 d16 f3 n14 -> 10 (W: 47.69%) (N: 1.29%) PV: n14 q16 o17 r14

= c16

genmove w Nodes: 1650, Win: 49.5%, PV: q17 e17 c6 f3 b4 o3 r6 c8 c3 c5 b5 d6 d7 c7 b6 e7 m3 d10 k16 r14 r16 q10 q12 r12 q13 r13 q17 -> 1077 (W: 49.45%) (N: 59.75%) PV: q17 e17 c6 f3 b4 o3 r6 c8 c3 c5 b5 d6 d7 c7 b6 e7 m3 d10 k16 r14 r16 q10 q12 r12 q13 r13 q16 -> 486 (W: 49.70%) (N: 24.64%) PV: q16 o17 r14 h17 c10 c6 c13 d14 b15 d13 c15 d15 b16 c17 c12 o15 q18 q13 q14 o13 e16 -> 26 (W: 49.65%) (N: 1.40%) PV: e16 e17 f17 d17 q16 f16 g17 f15 k17 p17 -> 23 (W: 48.95%) (N: 1.58%) PV: p17 e17 r16 f3 c10 c8 k17 -> 20 (W: 47.61%) (N: 1.94%) PV: k17 e17 q16 r14 o16 s16 r10 -> 6 (W: 44.71%) (N: 1.15%) PV: r10 q16 e16 e17 f17 m1 -> 5 (W: 43.68%) (N: 1.15%) PV: m1 q17 r15

= q17

genmove b Nodes: 1877, Win: 50.4%, PV: e17 c6 f3 b4 o3 r6 c8 c3 c5 b5 d6 d7 c7 b6 e7 m3 d10 k16 r14 r16 q10 q12 r12 q13 r13 e17 -> 764 (W: 50.55%) (N: 34.32%) PV: e17 c6 f3 b4 o3 r6 c8 c3 c5 b5 d6 d7 c7 b6 e7 m3 d10 k16 r14 r16 q10 q12 r12 q13 r13 r15 -> 550 (W: 50.98%) (N: 20.66%) PV: r15 e17 h16 e14 d17 d15 e18 c15 e16 c10 o17 p16 o16 q15 -> 319 (W: 48.99%) (N: 23.31%) PV: q15 r15 q16 r16 p17 r14 q18 r17 j17 c10 o16 c13 d14 b15 d13 c15 f17 -> 135 (W: 50.58%) (N: 6.07%) PV: f17 c6 f3 b4 c7 d7 c8 d6 c3 d8 c10 c9 b9 h17 -> 38 (W: 50.94%) (N: 1.46%) PV: h17 c10 c6 c13 d14 b15 d13 c15 d15 e16 -> 37 (W: 50.43%) (N: 1.72%) PV: e16 k16 r14 r16 q10 r8 p14 e18 -> 14 (W: 48.35%) (N: 1.33%) PV: e18 c6 f3 b4 c7 d7 = e17

g19 -> 12 (W: 45.70%) (N: 1.66%) PV: g19 c10 r15 r11 r6 r8

genmove w Nodes: 1564, Win: 49.7%, PV: c6 f3 b4 o3 r6 c8 c3 c5 b5 d6 d7 c7 b6 e7 m3 d10 k16 r14 r16 q10 q12 r12 q13 r13 c6 -> 553 (W: 48.38%) (N: 46.45%) PV: c6 f3 b4 o3 r6 c8 c3 c5 b5 d6 d7 c7 b6 e7 m3 d10 k16 r14 r16 q10 q12 r12 q13 r13 r15 -> 509 (W: 51.45%) (N: 11.93%) PV: r15 c10 f3 d6 d2 c3 j3 r6 s5 q10 r8 q8 r11 -> 241 (W: 50.09%) (N: 11.91%) PV: r11 o3 q6 q2 r3 l3 c6 f4 b4 c7 d7 c8 d6 c10 -> 184 (W: 48.72%) (N: 14.06%) PV: c10 r15 r11 r6 r5 q6 o4 p16 p17 o16 n17 r9 r12 -> 39 (W: 50.82%) (N: 1.43%) PV: r12 f3 c10 c12 c6 c8 b8 b7 c7 b9 f3 -> 22 (W: 48.58%) (N: 1.76%) PV: f3 c6 d2 c3 j3 q15 r15 r14 e12 -> 9 (W: 46.83%) (N: 1.18%) PV: e12 q15 r15 q16 r16

= c6

genmove b Nodes: 1353, Win: 51.6%, PV: f3 b4 o3 r6 c8 c3 c5 b5 d6 d7 c7 b6 e7 m3 d10 k16 r14 r16 q10 q12 r12 q13 r13 q14 f3 -> 1130 (W: 52.07%) (N: 66.02%) PV: f3 b4 o3 r6 c8 c3 c5 b5 d6 d7 c7 b6 e7 m3 d10 k16 r14 r16 q10 q12 r12 q13 r13 q14 c9 -> 91 (W: 49.65%) (N: 10.13%) PV: c9 f4 d6 c3 d3 d7 c5 e6 d5 b7 e7 d8 f6 b5 b4 c8 -> 40 (W: 49.26%) (N: 4.84%) PV: c8 c3 c4 d3 e4 b4 b5 b3 c5 f3 q15 r15 q16 r16 d9 -> 40 (W: 50.25%) (N: 3.96%) PV: d9 f3 d6 c3 d3 c4 c5 b5 d5 b7 c7 b6 g3 -> 20 (W: 50.45%) (N: 1.88%) PV: g3 c3 c4 d3 e4 e3 b4 f3 f4 g2 s15 -> 10 (W: 48.80%) (N: 1.50%) PV: s15 f3 f4 g4 f5 d3 e3 o5 -> 7 (W: 47.16%) (N: 1.39%) PV: o5 f3 f4 g4 f5 d18 -> 7 (W: 44.38%) (N: 1.89%) PV: d18 f3 f4 g4 f5 e3

= f3

genmove w Nodes: 1930, Win: 47.9%, PV: b4 o3 r6 c8 c3 c5 b5 d6 d7 c7 b6 e7 m3 d10 k16 r14 r16 q10 p14 r12 g17 m17 l17 m15 l14 m14 b4 -> 1012 (W: 48.01%) (N: 46.94%) PV: b4 o3 r6 c8 c3 c5 b5 d6 d7 c7 b6 e7 m3 d10 k16 r14 r16 q10 p14 r12 g17 m17 l17 m15 l14 m14 c15 -> 477 (W: 48.56%) (N: 17.60%) PV: c15 d15 c14 b16 d10 r15 r11 r6 r8 n17 p16 k16 c10 -> 260 (W: 47.13%) (N: 15.91%) PV: c10 r15 r11 r6 r5 q6 o4 r9 p16 p15 o15 p14 b16 -> 100 (W: 47.15%) (N: 6.23%) PV: b16 c15 d10 r15 r11 r6 r8 o4 r5 d10 -> 26 (W: 48.00%) (N: 1.29%) PV: d10 c12 b4 c8 d8 d9 e9 c9 d7 l9 -> 22 (W: 46.38%) (N: 1.78%) PV: l9 q15 r13 r17 r18 r16 l8 -> 17 (W: 47.62%) (N: 0.95%) PV: l8 r6 r8 r14 a18 -> 7 (W: 41.39%) (N: 1.45%) PV: a18 c5 d6 d10 f5

= b4`

kblomdahl commented 6 years ago

If the GPU was at 100% then everything is working correctly. The CPU only does the minimum amount of work it needs to keep the GPU busy.

Looking at the specifications those run times are not completely unreasonable since my cited numbers were from running it on a 1080 Ti which is about 14.93 times faster in pure TFlops, and 30.26 times faster in memory throughput. Un-clear what difference in performance that actually translate to since it is hard to find reliable neural network benchmarks online, but the magnitudes looks about correct.

There are also some additional slowdowns for the very first move, since it needs to load and transfer all of the weights to the GPU (+ some other initialization).


The number of playouts you are seeing is slightly misleading since since the Nodes number refers to the size of the search tree and it re-uses as much of the same search tree between moves as it can.

So for the first move you will notice that it performed 493 playouts for the move d4 (which it ended up playing), and the next search terminated at 800 + 493 = 1293 total playouts. So it re-used the 493 playouts from the first move and then added an additional 800 for the next move.

This pattern continues with 666 playouts for q4 and 800 + 666 = 1466 total playouts for the next move.


There might be improvements in the next release for you in terms of performance, since as a side-effect of the DP4A implementation #8 (which you will unfortunately not benefit from directly due to compute capabilities) there is more auto-calibration in regard to which exact algorithm to use at each step on the GPU and different architectures might benefit from different algorithms.

There is currently no deadline on that as it is proving more tricky than I thought to implement.

as0770 commented 6 years ago

Many thanks for your help! I'll let you know my results.

as0770 commented 6 years ago

Finally the promised results. In my tournaments Dream Go made it into League B:

> 
>  1. Ray 9.0.1                    31/36
>  2. Pachi DCNN 11.99             30/36
>  3. Dream Go 0.5.0               29/36
>  4. Leela Zero 0.9 (2018.01.01)  21/36
>  5. MoGo 4.86                    18/36
>  6. deltaGo 1.0.0                18/36
>  7. Fuego 1.1                    15/36
>  8. Michi C-2 1.4.2               8/36
>  9. Orego 7.08                    8/36
> 10. GNU Go 3.8                    2/36
>   

Conditions are: 1h/game, pondering off, 1 thread, 1GB on 4 x Intel® Core™ i5-4210H CPU @ 2.90GHz, 8 GiB Ram and GeForce 840M/PCIe/SSE2

It lost some games because of a ladder, and I observed that Dream Go sometimes misevaluates the games, showing a winning percentage >99% and a winning score at the end:

(;GM[1]FF[4]SZ[19]AP[SmartGo:3.1]CA[UTF-8] GN[w-dream_go-b-ray-1] PW[dream_go] PB[Ray] DT[2018-01-19] KM[6.5] RE[B+35.5] C[Black command: /home/alex/Programme/Engines/Go/ray --time 3600 --thread 1 --no-debug White command: /home/alex/Programme/Engines/Go/dream_go Black version: 9.0.1 White version: 0.5.0 Result[Black]: B+36.5 Result[White]: W+8.5 Host: alex-Aspire-VN7-791 (Intel(R) Core(TM) i5-4210H CPU @ 2.90GHz) Date: January 19, 2018 8:37:23 AM CET] ;B[pd];W[pp];B[dd];W[dp];B[nq];W[qn];B[pr];W[qq];B[kq];W[nc];B[lc];W[qf] ;B[nd];W[qc];B[qd];W[pc];B[oc];W[ob];B[od];W[nb];B[mc];W[rd];B[re];W[rc] ;B[qe];W[rf];B[of];W[ph];B[nh];W[pj];B[gh];W[fc];B[hc];W[cc];B[dc];W[cd] ;B[de];W[db];B[eb];W[cb];B[ec];W[cf];B[cn];W[fq];B[bp];W[cq];B[dl];W[df] ;B[ef];W[eg];B[ff];W[cj];B[dg];W[cg];B[dh];W[ch];B[di];W[dj];B[hq];W[bq] ;B[fr];W[er];B[fp];W[gq];B[gp];W[hp];B[ho];W[ip];B[iq];W[jp];B[jq];W[in] ;B[hm];W[jl];B[hn];W[kn];B[io];W[jo];B[im];W[jm];B[ik];W[kj];B[nj];W[mi] ;B[ni];W[kh];B[ll];W[jk];B[ji];W[ki];B[jh];W[mk];B[nk];W[ml];B[pk];W[qk] ;B[ql];W[pl];B[ok];W[qj];B[pm];W[rl];B[qm];W[rm];B[pn];W[po];B[no];W[on] ;B[om];W[nm];B[ol];W[mp];B[np];W[nn];B[mo];W[kf];B[jg];W[kg];B[mj];W[lm] ;B[mn];W[mm];B[oo];W[mf];B[mh];W[og];B[ng];W[nf];B[pf];W[pg];B[lj];W[lk] ;B[li];W[md];B[me];W[ld];B[le];W[kd];B[ke];W[ne];B[jd];W[kc];B[kb];W[jc] ;B[ic];W[oe];B[lf];W[lg];B[jb];W[mg];B[pe];W[se];B[md];W[jf];B[kl];W[kp] ;B[lp];W[lq];B[lo];W[jn];B[gr];W[eq];B[il];W[lr];B[kr];W[fs];B[hr];W[dn] ;B[go];W[dm];B[ig];W[el];B[ij];W[qr];B[or];W[ei];B[eh];W[fi];B[fh];W[if] ;B[hf];W[ea];B[fa];W[da];B[fb];W[fk];B[ek];W[fm];B[cm];W[bl];B[cl];W[bk] ;B[ci];W[bi];B[dk];W[ej];B[gi];W[mb];B[ls];W[ie];B[he];W[id];B[hd];W[ps] ;B[os];W[qs];B[mr];W[gs];B[hs];W[es];B[ks];W[la];B[lb];W[gj];B[gl];W[fl] ;B[fn];W[eo];B[gm];W[hj];B[hi];W[hk];B[jj];W[kk];B[lh];W[oi];B[je];W[oj] ;B[rn];W[qo];B[ro];W[oh];B[rp];W[rq];B[qp];W[sp];B[pq];W[sn];B[op];W[so] ;B[sm];W[sl];B[rk];W[rj];B[sd];W[sc];B[sk];W[sj];B[rh];W[qg];B[ri];W[ma] ;B[ka];W[ce];B[fd];W[fo];B[co];W[bm];B[bn];W[aq];B[an];W[ap];B[ao];W[cp] ;B[bo];W[];B[] TB[fa][ga][ha][ia][ja][ka][eb][fb][gb][hb][ib][jb][kb][lb][dc][ec][fc][gc][hc][ic][jc][kc][lc][mc][oc][dd][ed][fd][gd][hd][id][jd][kd][ld][md][nd][od][pd][qd][de][ee][fe][ge][he][ie][je][ke][le][me][ne][oe][pe][qe][re][ef][ff][gf][hf][if][jf][kf][lf][mf][nf][of][pf][dg][eg][fg][gg][hg][ig][jg][kg][lg][mg][ng][dh][eh][fh][gh][hh][ih][jh][kh][lh][mh][nh][ci][di][gi][hi][ii][ji][ki][li][mi][ni][ij][jj][kj][lj][mj][nj][ik][jk][kk][lk][mk][nk][ok][pk][gl][il][jl][kl][ll][ml][nl][ol][pl][ql][gm][hm][im][jm][km][lm][mm][nm][om][pm][qm][fn][gn][hn][in][jn][kn][ln][mn][nn][on][pn][qn][rn][go][ho][io][jo][ko][lo][mo][no][oo][po][qo][ro][fp][gp][hp][ip][jp][kp][lp][mp][np][op][pp][qp][rp][hq][iq][jq][kq][lq][mq][nq][oq][pq][fr][gr][hr][ir][jr][kr][lr][mr][nr][or][pr][hs][is][js][ks][ls][ms][ns][os] TW[aa][ba][ca][da][ea][la][ma][na][oa][pa][qa][ra][sa][ab][bb][cb][db][mb][nb][ob][pb][qb][rb][sb][ac][bc][cc][nc][pc][qc][rc][sc][ad][bd][cd][rd][sd][ae][be][ce][se][af][bf][cf][df][qf][rf][sf][ag][bg][cg][og][pg][qg][rg][sg][ah][bh][ch][oh][ph][qh][rh][sh][ai][bi][ei][fi][oi][pi][qi][ri][si][aj][bj][cj][dj][ej][fj][gj][hj][oj][pj][qj][rj][sj][ak][bk][ck][dk][ek][fk][hk][qk][rk][sk][al][bl][cl][dl][el][fl][rl][sl][am][bm][cm][dm][fm][rm][sm][an][bn][cn][dn][sn][ao][bo][co][do][eo][fo][so][ap][bp][cp][dp][sp][aq][bq][cq][dq][eq][fq][gq][qq][rq][sq][ar][br][cr][dr][er][qr][rr][sr][as][bs][cs][ds][es][fs][gs][ps][qs][rs][ss] TZ[km] DB[ha][ia][ja][hb][ib][gc][jc][kc][ed][gd][kd][ld][fe][ge][gf][fg][gg][hh][ih][ii][gn][qn][qo][pp][mq][oq][ir][jr][nr][is][js][ms][ns] DW[ca][na][oa][pa][qa][ra][sa][ab][bb][pb][qb][rb][sb][ac][bc][ad][bd][sd][ae][be][af][bf][sf][ag][bg][ah][bh][ai][pi][aj][bj][fj][ak][ck][rk][sk][al][am][sm][do][dq][sq][ar][br][cr][dr][rr][sr][as][bs][cs][rs][ss] V[35.5])

kblomdahl commented 6 years ago

Thank you, I appreciate you sharing your results with me and even though we did not win I am not too unhappy with the result. I will have to look into the ladder and score issues to see if I can resolve them for the next release.

My initial guess would be that the score evaluation is because when reaching a terminal game state (two passes) the engine is given the correct score according to the Tromp-Taylor Rules. Since the Tromp-Taylor Rules rules requires that all dead stones are captured, and all stones still on the board are considered alive, it fails see that some of its stones are in fact dead.

This was implemented mostly to help with the Expert Iteration training procedure, but may have adverse effects during tournament play since the network is playing according to Chinese rules (because it was trained on human games) not Tromp-Taylor rules. This conflict should be resolved after more self-play, but I may disable the terminal state score evaluation during tournament play in the mean time.

The ladder issue is probably the fault of the neural network not being sufficiently exposed to failed ladders. The human training games (from strong amateurs) presumably did not contain any broken ladders being played out so the engine never learned what would happen. I may add ladder features to the neural network since I've long considered doing so anyway, since it took the DeepMind AI a long time to figure them out on its own.

as0770 commented 6 years ago

I don't think it is necessary to add special knowledge for tournament mode. Will be fun to see how Dream Go will learn it itself :)

BTW: Dream Go performed better than Leela Zero with a human trained network:


    1. Pachi DCNN 11.99             29/32
    2. Ray 9.0.1                    27/32
    3. MoGo 4.86                    21/32
    4. deltaGo 1.0.0                17/32
    5. Fuego 1.1                    17/32
    6. Leela Zero 0.1               15/32   
    7. Michi C-2 1.4.2               9/32
    8. Orego 7.08                    7/32
    9. GNU Go 3.8                    2/32

I can't say anything about the quality of the network though...

as0770 commented 6 years ago

Some more results: `

1. Leela 0.11.0                    18/20
2. Rayon 4.6.0                     15/20
3. Oakfoam 0.2.1 NG-06             12/20
4. Hiratuka 10.37B (CPU)            7/20
5. Leela Zero 0.11 5773f44c         6/20
6. DreamGo 0.5.0                    2/20

1. DreamGo 0.5.0                   15/20
2. DarkForrest MCTS 1.0            12/20
3. Pachi 11.99                     12/20
4. DarkGo 1.0                      10/20
5. Ray 9.0.1                        9/20
6. Mogo 4.86                        2/20

`

kblomdahl commented 6 years ago

Interesting, I have not finished everything I wanted for 0.6.0 but maybe I should push a new release since there has been some self-play progress that are showing promise.

The network from the current release (0.5.0) lose 2 - 48 against the latest self-play network in blitz games. It is unclear how it would scale to games with longer time-settings but it shouldn't be much worse. It still can't correctly score the large dead dragon game you posted earlier in this thread, but it doesn't seem to play out ladders (too often) anymore.

as0770 commented 6 years ago

You could also release a v0.5.9 or just the network if it is working with v0.5.0. But it is your decision if it is worth the effort. I am looking forward the next release, no matter when it is available :)