LC0-Leela0 for Android Devices...?

Discussion of anything and everything relating to chess playing software and machines.

Moderators: bob, hgm, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
supersharp77
Posts: 754
Joined: Sat Jul 05, 2014 5:54 am
Location: Southwest USA

LC0-Leela0 for Android Devices...?

Post by supersharp77 » Sat Apr 06, 2019 5:36 am

Seems some folks have been successful in Using LC0 (Leela0) in android applications...Has anyone tried to compile a arm-7 or arm-8 for the LC0.exe engine? I guess everything else could be transferred over? (nets [small NN's] client dll's etc) My other option would be to try and see if it would play as a UCI under 'Chess for Android' Just a bit Curious...Please let me know what you have found out on this matter. Thanks, AR :) :wink:

https://groups.google.com/forum/#!topic ... TJbcF3LZZY


LCZero ›
Is there going to be an app for leela?
9 posts by 7 authors



Norton Freeman

8/30/18


It would be nice if leela could run on Android and iOS.



Stephen Ryan

8/30/18


The issue is that the weights are so large. If you had 3 difficulty settings, that's 3 weights, each of which are ~60mb.



jadelan

8/30/18


Difficulty setting may be adjusted by the number of nodes, though, so just one network will do. Let's hope someone will port Leela to Android and iOS soon, even a few tens of nodes will give us pretty decent play already.



Curious

8/30/18


One can probably train smaller nets that are strong enough for most people. If you play a 2800 Elo Leela vs a 3500 Elo Leela, would you notice a difference?



Scally

8/30/18


Hi,

I have leela compiled for the Raspberry Pi and PicoChess but as you say because of the size of the weights it runs slowly and loses on time in short time games.

I have asked more than once on here if I can compile differently, i.e. which parameters can I set to true and false in ‘meson_options.txt’ but no answers yet. I currently have cudnn, opencl & tensorflow set to false but wonder whether I should also set gtest or other options to false?

Or are there UCI parameters I can alter to quicken up the engine?

Thanks,

Al.



Norton Freeman

8/30/18


I think the size of the nets may not be the problem.There are apps for leela zero using elf`s 20b network,and they are pretty strong even running on average smartphones.



Francesco Tommaso

8/30/18


The same happens on my Celeron J1800 processor. It plays at 3 nps and it takes the processor around 7 seconds to "start running" the engine at every move, so I either set games with 15 seconds increments or with fixed time per move, higher than 30 seconds. On these conditions Leela plays over 3000 elo.



Eric Silverman

8/31/18


Yeah Leela Zero runs just fine on my Android phone (Moto G5) using Gridmaster. That being the case it should be possible to have LC0 running pretty decently on mid-range or higher smartphones. It'll eat battery for sure, but then so does Droidfish, so probably not a huge issue for people who would seek out a chess app with a strong engine.


On Thursday, August 30, 2018 at 12:12:20 PM UTC+1, Norton Freeman wrote:
I think the size of the nets may not be the problem.There are apps for leela zero using elf`s 20b network,and they are pretty strong even running on average smartphones.



Scally

9/1/18


Hi all,

Today’s Lc0 code change “Changes to build.sh (#322)” has solved my meson-options.txt dilemma, thanks.

Lc0 now plays a lot quicker on my Raspberry Pi.

I have one last request for those boffins out there, what uci options can I change to avoid any future losses on time?


Thanks,

Al.

User avatar
Scally
Posts: 95
Joined: Thu Sep 28, 2017 7:34 pm
Location: Bermondsey, London
Full name: Alan Cooper
Contact:

Re: LC0-Leela0 for Android Devices...?

Post by Scally » Sat Apr 06, 2019 7:22 am

Hi AR,

My Raspberry Pi 3b+ armv7 device is playing at around 2400+ using the distilled weights files found here:

https://github.com/dkappe/leela-chess-w ... d-Networks

Al.
Alan Cooper
My Chess Computers

supersharp77
Posts: 754
Joined: Sat Jul 05, 2014 5:54 am
Location: Southwest USA

Re: LC0-Leela0 for Android Devices...?

Post by supersharp77 » Sat Apr 06, 2019 6:53 pm

Scally wrote:
Sat Apr 06, 2019 7:22 am
Hi AR,

My Raspberry Pi 3b+ armv7 device is playing at around 2400+ using the distilled weights files found here:

https://github.com/dkappe/leela-chess-w ... d-Networks

Al.
Really? Do you have a arm 7 compile for LC0? Did you load the net & the client exe also? How about the dll files? Thx AR
:) :wink:

User avatar
Scally
Posts: 95
Joined: Thu Sep 28, 2017 7:34 pm
Location: Bermondsey, London
Full name: Alan Cooper
Contact:

Re: LC0-Leela0 for Android Devices...?

Post by Scally » Sat Apr 06, 2019 8:12 pm

Hi AR,

Yes I’ve compiled every version of Lc0 including the original lczero by following the Raspberry Pi build instructions here:

https://github.com/LeelaChessZero/lc0

Recently I’ve done static compiles so no extra libraries are needed except OpenBLAS.

I’m running Lc0 as CPU only using the distilled networks I mentioned earlier, here it is running on my Raspberry Pi:

Al@PicoChess:/opt/picochess/engines/armv7l $ ./lc0v0210
_
| _ | |
|_ |_ |_| v0.21.0 built Mar 8 2019
go infinite
Found pb network file: ./11258-112x9.txt
Creating backend [blas]...
BLAS, maximum batch size set to 256
BLAS vendor: OpenBlas.
OpenBlas [NO_AFFINITY ARMV7 MAX_THREADS=4].
OpenBlas found 4 ARMV7 core(s).
OpenBLAS using 1 core(s) for this backend.
BLAS max batch size is 256.
info depth 1 seldepth 2 time 1584 nodes 7 score cp 21 hashfull 0 nps 4 tbhits 0 pv d2d4 g8f6
info depth 2 seldepth 3 time 4199 nodes 16 score cp 13 hashfull 0 nps 3 tbhits 0 pv g2g3 d7d5 g1f3
info depth 3 seldepth 4 time 6812 nodes 35 score cp 16 hashfull 0 nps 5 tbhits 0 pv g2g3 e7e6 c2c4 d7d5
info depth 3 seldepth 5 time 9312 nodes 57 score cp 15 hashfull 0 nps 6 tbhits 0 pv g2g3 e7e6 c2c4 d7d5 f1g2
info depth 3 seldepth 5 time 9408 nodes 59 score cp 15 hashfull 0 nps 6 tbhits 0 pv c2c4 e7e5 d2d3 b8c6 g1f3
info depth 4 seldepth 5 time 9568 nodes 67 score cp 14 hashfull 0 nps 7 tbhits 0 pv g2g3 d7d5 g1f3 c7c5 f1g2 d5d4
info depth 4 seldepth 6 time 11189 nodes 74 score cp 14 hashfull 0 nps 6 tbhits 0 pv g2g3 d7d5 g1f3 c7c5 f1g2 d5d4
info depth 4 seldepth 7 time 12612 nodes 116 score cp 16 hashfull 1 nps 9 tbhits 0 pv g2g3 e7e6 c2c4 d7d5 f1g2 d5d4 c4c5
info depth 4 seldepth 7 time 14184 nodes 130 score cp 16 hashfull 1 nps 9 tbhits 0 pv c2c4 e7e5 d2d3 f8e7 g1f3 b8c6
quit


Cheers,

Al.
Alan Cooper
My Chess Computers

supersharp77
Posts: 754
Joined: Sat Jul 05, 2014 5:54 am
Location: Southwest USA

Re: LC0-Leela0 for Android Devices...?

Post by supersharp77 » Sat Apr 06, 2019 10:19 pm

Scally wrote:
Sat Apr 06, 2019 8:12 pm
Hi AR,

Yes I’ve compiled every version of Lc0 including the original lczero by following the Raspberry Pi build instructions here:

https://github.com/LeelaChessZero/lc0

Recently I’ve done static compiles so no extra libraries are needed except OpenBLAS.

I’m running Lc0 as CPU only using the distilled networks I mentioned earlier, here it is running on my Raspberry Pi:

Al@PicoChess:/opt/picochess/engines/armv7l $ ./lc0v0210
_
| _ | |
|_ |_ |_| v0.21.0 built Mar 8 2019
go infinite
Found pb network file: ./11258-112x9.txt
Creating backend [blas]...
BLAS, maximum batch size set to 256
BLAS vendor: OpenBlas.
OpenBlas [NO_AFFINITY ARMV7 MAX_THREADS=4].
OpenBlas found 4 ARMV7 core(s).
OpenBLAS using 1 core(s) for this backend.
BLAS max batch size is 256.
info depth 1 seldepth 2 time 1584 nodes 7 score cp 21 hashfull 0 nps 4 tbhits 0 pv d2d4 g8f6
info depth 2 seldepth 3 time 4199 nodes 16 score cp 13 hashfull 0 nps 3 tbhits 0 pv g2g3 d7d5 g1f3
info depth 3 seldepth 4 time 6812 nodes 35 score cp 16 hashfull 0 nps 5 tbhits 0 pv g2g3 e7e6 c2c4 d7d5
info depth 3 seldepth 5 time 9312 nodes 57 score cp 15 hashfull 0 nps 6 tbhits 0 pv g2g3 e7e6 c2c4 d7d5 f1g2
info depth 3 seldepth 5 time 9408 nodes 59 score cp 15 hashfull 0 nps 6 tbhits 0 pv c2c4 e7e5 d2d3 b8c6 g1f3
info depth 4 seldepth 5 time 9568 nodes 67 score cp 14 hashfull 0 nps 7 tbhits 0 pv g2g3 d7d5 g1f3 c7c5 f1g2 d5d4
info depth 4 seldepth 6 time 11189 nodes 74 score cp 14 hashfull 0 nps 6 tbhits 0 pv g2g3 d7d5 g1f3 c7c5 f1g2 d5d4
info depth 4 seldepth 7 time 12612 nodes 116 score cp 16 hashfull 1 nps 9 tbhits 0 pv g2g3 e7e6 c2c4 d7d5 f1g2 d5d4 c4c5
info depth 4 seldepth 7 time 14184 nodes 130 score cp 16 hashfull 1 nps 9 tbhits 0 pv c2c4 e7e5 d2d3 f8e7 g1f3 b8c6
quit


Cheers,

Al.
Wow...well you have a couple of arm 7 compiles I would love to try and get to work in my tablet (arm 7pgo x32) or arm 7's with whatever you used to get this LC0 to work? Send a link Thx AR



ps:LC0 not playing 3000 strength in my Windows 10 x64 laptop either..time issues and tactics problems so far.. :wink:

User avatar
Scally
Posts: 95
Joined: Thu Sep 28, 2017 7:34 pm
Location: Bermondsey, London
Full name: Alan Cooper
Contact:

Re: LC0-Leela0 for Android Devices...?

Post by Scally » Sun Apr 07, 2019 5:06 pm

Hi AR,

You can download the Arm7 Lc0v0210 binary from here:

https://github.com/ScallyBag/AlsPicoEng ... ter/addlc0

Please note you will need a weights file and install OpenBLAS, my README is mostly for the Raspberry Pi but contains some useful links.


Cheers,

Al.
Alan Cooper
My Chess Computers

dkappe
Posts: 262
Joined: Tue Aug 21, 2018 5:52 pm
Full name: Dietrich Kappe

Re: LC0-Leela0 for Android Devices...?

Post by dkappe » Sun Apr 07, 2019 5:44 pm

I run a lichess bot on a raspberry pi 3. I use a 48x5 network, but it’s worth testing 80x7 and 64x6. 112x9 works well on a cpu, but may be too slow on a pi.

User avatar
Scally
Posts: 95
Joined: Thu Sep 28, 2017 7:34 pm
Location: Bermondsey, London
Full name: Alan Cooper
Contact:

Re: LC0-Leela0 for Android Devices...?

Post by Scally » Sun Apr 07, 2019 6:03 pm

Thanks for hint. I haven’t got round to the even smaller distilled networks, I’ve been using a converted 9149 network until recently.

I’m using an overclocked Raspberry Pi 3b+ with heat sinc and a noctua cooling fan.


Cheers,

Al.
Alan Cooper
My Chess Computers

supersharp77
Posts: 754
Joined: Sat Jul 05, 2014 5:54 am
Location: Southwest USA

Re: LC0-Leela0 for Android Devices...?

Post by supersharp77 » Tue Apr 09, 2019 3:18 am

Scally wrote:
Sun Apr 07, 2019 5:06 pm
Hi AR,

You can download the Arm7 Lc0v0210 binary from here:

https://github.com/ScallyBag/AlsPicoEng ... ter/addlc0

Please note you will need a weights file and install OpenBLAS, my README is mostly for the Raspberry Pi but contains some useful links.


Cheers,

Al.
Thank You My friend..downloaded it with the weights and it seemed to load ok but got a exe error message when I clicked on the uci option in Chess For Android..will reread that Read-Me file again..did not spend much time reading it..just wanted to see if it would work..That is the smallest weights file I have seen so far.. probably engine will play "stronger' with a bit larger one...Thx again AR :D :wink:

supersharp77
Posts: 754
Joined: Sat Jul 05, 2014 5:54 am
Location: Southwest USA

Re: LC0-Leela0 for Android Phones..Theory

Post by supersharp77 » Tue Apr 09, 2019 3:21 am

https://groups.google.com/forum/#!topic ... _aRL5a3C2w
Leela engine for android (smartphones)(Theory)
11 posts by 6 authors



Alexander

8/1/18


Hello all!

I just thought that it would be nice if we have an application of Leela in Play Market (or iTunes).

That it might have two regimes:

=> playing with latest version of Leela
=> self-play mode for training Leela

everyone has a smartphone, and if such an application exsisted I think hundreds of self-play volunteers would occur due to simplicity of application and no need to download program on PC, make some tunes, wait until self-play is over, etc. Capacities of modern smartphones are quite high but even if low we could benefit from large number of volunteers which in sum would give thousands of games per day.

Myself, when back from work I have spare 4-5 hours on my Galaxy 8 before going to sleep, besides sometimes I could leave self-play for the whole night..

Or to create such an application it would need a sum of money for Play Market or programmers?


pocket Leela.. sounds very good ;)




LittleWarrior

8/1/18


Really would be a waste of time really....not suited for a PC CPU and certainly not for a Phone CPU
- show quoted text -



Alexander

8/1/18


Doesn't phone have a graphic card? or it's relatively = 0 in capacity needs for Leela?



среда, 1 августа 2018 г., 22:04:51 UTC+3 пользователь LittleWarrior написал:
- show quoted text -



Dave Whipp

8/1/18

Other recipients: luther...@gmail.com

Most modern smartphones (at least at the high end) have NEON support in their SoC. And there is support for NEON in TensorFlow. Probably wouldn't use it for training; but should be able to play with a reasonably sized network

- show quoted text -
- show quoted text -
--
You received this message because you are subscribed to the Google Groups "LCZero" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lcz...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lczer ... groups.com.
For more options, visit https://groups.google.com/d/optout.



Deep Blender

8/1/18


Phones are definitely not suitable to train neural networks. You would need to plug it in, but you might be able to boil some water on the phone :)
- show quoted text -



Alexander

8/1/18


Got it. Pity. Wake me up when quantum computer arises...

thx all for thoughts




Greg Mattson

8/1/18


Deep Blender/Alexander,

I get it that the phone itself may be a bad platform to train on.

But if you could connect the phone to, say a free cloud instance, as per:

- https://www.quora.com/Is-there-any-way- ... -the-cloud

where the phone client would:

1. setup the cloud instance if it does not exist with a wizard
2. login to that instance and provision a leela zero instance to run
3. do whatever is necessary to keep the cloud instance alive and actually training games
4. stream the results (if desired) to the phone to watch leela train

then each phone could leverage a lot more resources that it otherwise to train leela, give end-users a way to easily help, and get something out of it (namely high quality games on their phones, and maybe a status update as to where leela stands)

now i'm not much of an android programmer (not really at all) but I don't see show-stoppers above. Perhaps the will/expertise to do so is the main one :(.
- show quoted text -



Thomas Kaas

8/1/18


Not that i know, but I think the devs has to look into.
rgds
- show quoted text -



Thomas Kaas

8/1/18


I meant… The devs have many other things to ttand too, I think


onsdag den 1. august 2018 kl. 20.58.06 UTC+2 skrev Alexander:
- show quoted text -



Alexander

8/2/18


IMO

there needs to be some application that one could download and just press one button to allow one's phone capacity be used by cloud.

Of course, if the phone capacity could be shared like the Golem project (https://golem.network/).
If let say there are hundreds and soon thousands of computer chess fans who could share their phones then total capacity would be quite optimistic to generate thousands games per day..
Mybe it's just my dreams and utopia..

but who knows.. maybe there is some way to involve smartphones..
contributors rows would be significantly increased



Greg Mattson

8/2/18


alexander,

yes I get the appeal, but like deep blender said, a phone is a woefully underpowered piece of equipment with which to do deep learning.

plus the phone's batteries would be severely impacted - think being used up in an hour or so in the midst of training. Plus the amount of ram, etc used in training would basically make the phone unusable.

however, using it to control a cloud instance would offload all the training to a GPU off of the phone - all you would need to transfer is a series of moves, and all the phone would need to do is render a board; a much simpler exercise.

As it stands leela is trained by google colab, but this is severely implacted by the annoying tendency of the colab instances to stop/timeout; the phone could basically act as a heartbeat and restart the leela instances if/when the instance goes down.
- show quoted text -

Post Reply