Stan on ARM-architecture system

Has anybody tested if Stan works on ARM-architecture systems (say, Raspberry Pi with Linux, or Android phone)?

Thanks!

Raspberry pi is more or less a normal linux, so it should work.

Android:

On android you can use Termux + clang. I have a working pystan installed. Only thing is that I need to create models without obfuscation due to maximum path problem (android 5). On android 6 there is a fix for it.

Officially one can not get gcc+gfortran but there is an unofficial release that works (mostly) so in theory one could install R.

Edit. CmdStan works. Build failed probably due to memory error (-j4 / -j3). Without -jx build did run normally.

CmdStan build is crashing. I don’t know why.

2 Likes

Thank you! Great! I will proceed then with Raspberry Pi and report my experience.

1 Like

We don’t currently compile wheels for arm64 (e.g., Raspberry Pi). If
there was a lot of interest in this we could figure out a way to do this.

A while ago I tried to compile PyStan on Raspberry Pi, but it was taking an eternity to finish (also had to extend the virtual memory size), so then I tried cross compiling on Docker, but it didn’t workout after a lot of attempts and I gave up. My guess is that, even if successful, it would run awfully slowly.

Running would depend on floating-point performance. Compilation will probably be very slow; it’s slow enough on a multicore i7.

Compiling 8 schools (/or any other model) on android phone (ZTE5) takes 8 minutes, sampling takes milliseconds).

But some pads/phones are nowdays quite fast due to 4k video stuff.

On raspberry pi the latest version (3) could have decent compilation times.

But it’s not always about the performance. Sometimes phone /raspberry pi is the only thing you got and you can still practice with it.

Has anyone tried running/benchmarking Stan on ARM servers, for example using Amazon EC2 A1?

Would like to bump @ericnovik 's post back up. Gravitron has gone from a curiosity to what appears to be a highly-competitive, and possibly superior EC2 option (M6g instances, for example).

Has anyone tried to compile rstan or cmdstanr on such an instance? If not are there compilations / environments for ARM equivalents that might point the way?

Sorry for missing this. We have tried it on the c6g and its very performant. @Adam_Haber and I are planning to make a blog post comparing the c6g instances with x86 instances with similar price/number of cores. What I have seen working on some models is that the ARM c6g instances are anywhere from 50% to 3x faster than a similarly priced x86 instance.

For cmdstanr install using

install_cmdstan(release_url = "https://github.com/stan-dev/cmdstan/releases/download/v2.26.1/cmdstan-2.26.1-linux-arm64.tar.gz", cores = 4)

the next release of cmdstanr should install this version automatically.

For rstan 2.21 the default installation should work though I have not tried it. You will have to install from source.

4 Likes

Outstanding! Thanks so much.

Bump that we saw a ~50% speedup as well moving from intel-based to ARM-based EC2 instances.

2 Likes

It also works on Android (through Termux and proot-distro)

I wonder what the performance improvements are from? Looking at the specs here I don’t see anything eye catching, idt they even have SIMD instructions for doubles. My only guess is that they are able to do something clever sharing data across sockets and cores