I have managed to cross-compile mpich2-1.3.2 for ARMv5 platforms (almost all Android phones).

To compile it you need to create an ARM-EABI toolchain using buildroot and then link it static against uclibc. I did not try to link it against Bionic.

To link it static, you just need to pass the -static argument to LDFLAGS before executing configure:

The output should be a static executable for ARM:

Onces the binaries / configuration files are copied to each phone, there are three things to sort out:
a) home folder (used to store smpd passwords)
b) hostnames (otherwise all reports will appear as localhost)
c) cannot compile code on phones themselves

a) I am using DroidSSHd as an SSH server (based on dropbear) for Android. By default it sets the home folder to /sdcard. However, smpd cannot work like that, since it will complain about the permissions (on Android, /sdcard is mounted in a special way and you cannot change permissions accordingly).

If you try, there will be many error lines like:

This is easily fixed by using:

This has to be executed on both phones of course. This is also where you’ll put the hosts.cfg file also.

b) By default, MPI_Get_processor_name returns value “localhost” which makes it useless for debugging purposes. There’s an easy fix too:

c) Compiling on the phone is not impossible, but doesn’t worth the try. You need the compiler installed too (arm-linux-gcc) with all dependencies, which is a big deployment (and normal phones have limited space on /system partition)

The code can be easily cross-compiled on the build machine (where mpich2 was compiled). I’ve tried the code below:

and after giving a host name to each phone and started smpd on each phone, the output was the following:

I can only imagine what if mobile phones could share resources commonly as idling PCs are doing around the world. The trouble is of course battery life …