Skip to content

Running lc0 on Android with a chess GUI

Leandro Álvarez González edited this page May 29, 2019 · 21 revisions

Follow these simple steps and you'll be running lc0 on your Android device. No root needed. Just the right engine, a weights file and a chess GUI. Here's a small video of the steps just in case you need to see it in action:

https://streamable.com/fozkg

Get lc0 for Android

Android builds are not official yet, but there are some that you could try already. First lookup the architecture of your Android device. In general older devices are 32 bits in which case you must choose the first build. But recent devices are 64 bits so you should choose the second and faster one:

Architecture Engine Download
32 bits link
64 bits link

Notice: All the 64 bit builds are compiled targeting the API Level 21 (equivalent to Android 5.0 Lollipop). The 32 bit ones target the API Level 16 (Android 4.1 Jelly Bean). Older Android versions may not work.

Special builds with embedded weights

There are two special test builds for those who couldn't or wouldn't fiddle with UCI Options and full paths, or maybe those using a GUI without that capability. These builds contain a small 48x5 weights file embedded into the engine itself. You'll still be able to use other weights with them, but the embedded weights will load when you didn't specify one. Get them here:

Architecture Engine with embedded 48x5
32 bits link
64 bits link

For more options, check out the following table with the test builds posted so far by architecture and back-end:

Architecture OpenCL OpenBLAS Eigen
armv7-a link link
aarch64 link link link

It's better to try first the BLAS and Eigen links, as the OpenCL ones are heavier and they also have some extra requirements:

  • Device with OpenCL support (builds are linked to OpenCL version 2.0)
  • Expect a very long delay on the first start of the engine and when a different network size is tried. This happens because the OpenCL tuner needs to optimize its parameters to your device.

For more information about the above builds, please browse this PR: https://github.com/LeelaChessZero/lc0/pull/848

Select a network weights file

The regular nets will work just fine, get one from the usual place:

http://lczero.org/networks

But you could choose a small network like these ones, that will be faster:

https://github.com/dkappe/leela-chess-weights/wiki/Distilled-Networks

Choose a GUI

Any chess GUI that supports setting the UCI Options should do. DroidFish works quite good:

https://play.google.com/store/apps/details?id=org.petero.droidfish

There is another well-known GUI, Chess for Android that is reported to work too:

https://play.google.com/store/apps/details?id=com.google.android.chess

With Chess for Android you'll need to employ a little trick though. After installing the engine to the GUI, install the weights file too as if it were another engine. This way the weights file will be copied to the same destination as the engine and the auto-discover will work.

Install the GUI and copy the engine

You'll need to install DroidFish and give it access to the storage. Then unzip the lc0 engine downloaded in the first step and copy it to the DroidFish/uci folder on your Android device. After that, just open DroidFish and select the engine lc0. But don't start analysis/play yet as you'll have to configure it first.

Configure the engine

The auto-discover feature for the weights file won't work on Android, since some GUIs import the engine to a private directory. That's why you need to provide the engine with the full path to the weights file. You could use a file manager app that allows copying the full path of a file. Like this one:

https://play.google.com/store/apps/details?id=com.mi.android.globalFileexplorer

Navigate to the weights file you downloaded and copy its full path. Then paste it to the engine options, it's the first one.

If you followed until now then you should have an engine working. Start analysis and watch.

You can’t perform that action at this time.