understanding android chess engine binary formats

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

adams161
Posts: 626
Joined: Sun May 13, 2007 9:55 pm
Location: Bay Area, CA USA
Full name: Mike Adams

understanding android chess engine binary formats

Post by adams161 »

Hi,

Mike here the Pulsar engine author and now working on porting my OpeningTree on iOS to Android. OpeningTree on iOS uses Crafty with Robert Hyatts permission to link to the code. On Android I can just open binaries so using Stockfish 10. Now what's confusing is at the Stockfish download site there are 3 binaries in the Android folder but only one works for me on my two tablets: stockfish-10-armv7. But on simulator none of the 3 Stockfish binaries work however this file I got out of the Droidfish assets folder works: stockfish-x86.

I'm wondering if anyone knows what engine files to use when on Android for Stockfish in particular but more generally all of Android as it's natural over time to open more engines than one. Glad to have any help with this even if you don't use Stockfish but know a bit about Android or any contributions on topic in general.

thanks
Mike
Ras
Posts: 2487
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: understanding android chess engine binary formats

Post by Ras »

Basically, you have Android in 32 bit, that's the armv7 executable. And then in 64 bit, that's the arm64 ones. The arm64-pgo is optimised after profiling, so it is faster than the normal arm64 one, but the arm64-pgo has the drawback of being twice as large. All of them are for ARM CPUs, which are the norm with Android devices.

Newer Android devices have an ARM CPU that can run 64 bit executables. From August 2019, 64 bit support will be mandatory in Google's app store anyway. So ARM 32 bit executables are for old devices. The supplied one will require at least Android 4.1 (from 2012) because this is the oldest Android version that can run position independent code - a feature that Android 5.0 or later requires from executables, or else Android 5.0 or later will not start them.

Android devices with Intel x86 CPUs are rare, but they can also run ARM executables in 32 bit, albeit with 50% performance loss because of the emulation. They cannot run ARM-64 executables. Given that Intel has failed on the smartphone market and then withdrawn, and that AMD has never been there, Android devices with x86 CPUs are irrelevant in terms of market share.

The simulator on the PC runs on an x86 CPU, and if it doesn't emulate a complete ARM CPU, then it's clear why it can only run an x86 executable. In this case, the intended usage is compiling from source and debugging.
Rasmus Althoff
https://www.ct800.net
adams161
Posts: 626
Joined: Sun May 13, 2007 9:55 pm
Location: Bay Area, CA USA
Full name: Mike Adams

Re: understanding android chess engine binary formats

Post by adams161 »

Thank you for the answer. Makes it easier to understand. I guess the trick is to know when you got 64 bit support.
adams161
Posts: 626
Joined: Sun May 13, 2007 9:55 pm
Location: Bay Area, CA USA
Full name: Mike Adams

Re: understanding android chess engine binary formats

Post by adams161 »

Ras wrote: Tue Feb 19, 2019 4:55 pm Android devices with Intel x86 CPUs are rare, but they can also run ARM executables in 32 bit, albeit with 50% performance loss because of the emulation. They cannot run ARM-64 executables. Given that Intel has failed on the smartphone market and then withdrawn, and that AMD has never been there, Android devices with x86 CPUs are irrelevant in terms of market share.
They may not be a big market share but the trouble is they area bigger market share of one star reviews if you don't support them. Anyway to tell if the device is on one of these intel chips?

Mike
User avatar
yurikvelo
Posts: 710
Joined: Sat Dec 06, 2014 1:53 pm

Re: understanding android chess engine binary formats

Post by yurikvelo »

I have android tablet with Intel Atom Z-series CPU, it's not ARM
Ras
Posts: 2487
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: understanding android chess engine binary formats

Post by Ras »

adams161 wrote: Thu Apr 30, 2020 8:04 amThey may not be a big market share but the trouble is they area bigger market share of one star reviews if you don't support them. Anyway to tell if the device is on one of these intel chips?
Well there's a couple of them on Intel's website, and the last somewhat popular smartphone with x86 was Asus Zenphone2 from 2015.
https://www.intel.com/content/www/us/en ... blets.html
https://www.intel.in/content/www/in/en/ ... hones.html
But just look at the really old Android versions.

Looks like the only way to exclude them is doing that manually in the app store:
https://support.google.com/googleplay/f ... RHEW8HQFnc
https://support.google.com/googleplay/a ... er/7353455

That should be first and foremost the Asus Zenfones:
https://en.wikipedia.org/wiki/Asus_ZenFone
Rasmus Althoff
https://www.ct800.net
adams161
Posts: 626
Joined: Sun May 13, 2007 9:55 pm
Location: Bay Area, CA USA
Full name: Mike Adams

Re: understanding android chess engine binary formats

Post by adams161 »

Ras wrote: Thu Apr 30, 2020 10:23 am
adams161 wrote: Thu Apr 30, 2020 8:04 amThey may not be a big market share but the trouble is they area bigger market share of one star reviews if you don't support them. Anyway to tell if the device is on one of these intel chips?
Looks like the only way to exclude them is doing that manually in the app store:
https://support.google.com/googleplay/f ... RHEW8HQFnc
https://support.google.com/googleplay/a ... er/7353455
Thanks. I have an intel compatible stockfish i use in the simulator on Mac. So i think i'll give them an option in settings. It be nice if i could detect it and just run the right one for this subcategory and call it a day. But if not i think settings and a message if engine doesnt start to change settings is good. Maybe i can just have it keep trying engines till it finds one that runs, 32 bit or intel.

MIke