Quantum-Espresso on Android

Ubuntu 13.10 makes it very easy to cross-compile Quantum-Espresso for the arm CPUs. Install the following packages: gcc-arm-linux-gnueabihf, gcc-4.8-arm-linux-gnueabihf and gfortran-4.8-arm-linux-gnueabihf, then create the missing link:sudo ln -s /usr/bin/arm-linux-gnueabihf-gfortran-4.8 /usr/bin/arm-linux-gnueabihf-gfortran

Next, get the latest QE version from SVN, configure and compile with:./configure --with-internal-blas --with-internal-lapack --disable-shared --disable-parallel --host=arm-linux-gnueabihf

make pw

Since I don't have the proper hardware (arm7 CPU with FPU), I've tested it in the Android emulator. I've created a 4.4.2 AVD image and used adb to interact with the emulator:

adb shell
# mkdir /data/user/espresso
# exit
adb push si-scf.in /data/user/espresso
adb push Si-vbc.UPF /data/user/espresso
adb push espresso/PW/src/pw.x /data/user/espresso
adb shell
# cd /data/user/espresso
# ./pw.x <si-scf.in >si-scf.out

Alternatively, install qemu-user-static package and run with QEMU on the host machine:

qemu-arm-static ./pw.x <si-scf.in >si-scf.out

On my workstation, in both cases, the calculation takes ~24 s.

(Obsolete) Old instructions

I've successfully compiled and run PW on my Android phone. On this page you will find my gcc toolchain including gfortran, my customized make.sys, and the pw.x executable for ARM CPUs.

Compiling quantum-espresso

./configure --disable-shared --with-internal-blas --with-internal-lapack CC=arm-linux-androideabi-gcc FC=arm-linux-androideabi-gfortran F77=arm-linux-androideabi-gfortran

then edit the make.sys to use the internal FFTW v2.

Testing with qemu-arm

ceresoli@milano:/scratch/ceresoli/ANDROID/silicon$ file pw.x
pw.x: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, not stripped
ceresoli@milano:/scratch/ceresoli/ANDROID/silicon$ qemu-arm ./pw.x <si-scf.in
     Program PWSCF v.4.3.1      starts on 16Jun2011 at 10:13:56
     This program is part of the open-source Quantum ESPRESSO suite
     for quantum simulation of materials; please cite
         "P. Giannozzi et al., J. Phys.:Condens. Matter 21 395502 (2009);
          URL http://www.quantum-espresso.org",
     in publications or presentations arising from this work. More details at
     http://www.quantum-espresso.org/wiki/index.php/Citing_Quantum-ESPRESSO
...
!    total energy              =     -15.82060780 Ry
...
     PWSCF        :  1m51.46s CPU     1m52.78s WALL
   This run was terminated on:  10:15:49  16Jun2011           
=------------------------------------------------------------------------------=
   JOB DONE.
=------------------------------------------------------------------------------=

The host machine is an Intel(R) Core(TM)2 Duo CPU E8400@3.00GHz running Ubuntu 10.04 64bit.

Running on the device

I've installed the Android SDK platform-tools and I've connected the device via USB.

ceresoli@milano:/scratch/ceresoli/ANDROID/android-sdk-linux_x86/platform-tools$ sudo ./adb shell
$ su
# cat /proc/cpuinfo
Processor    : ARMv6-compatible processor rev 5 (v6l)
BogoMIPS    : 245.61
Features    : swp half thumb fastmult vfp edsp java
CPU implementer    : 0x41
CPU architecture: 6TEJ
CPU variant    : 0x1
CPU part    : 0xb36
CPU revision    : 5
Hardware    : GT-S5830 Board
Revision    : 0005
Serial        : 3432fe4a638700ec
# cat /proc/meminfo
MemTotal:         284444 kB
MemFree:            5708 kB
Buffers:            1420 kB
# cd /data/misc/ceresoli
# ls -l
-rwxrwxr-x root     root         3414 2011-06-15 22:38 chello
-rwxrwxr-x root     root       422145 2011-06-15 22:38 fhello
-rwxrwxr-x root     root      8658692 2011-06-15 22:38 pw.x
-rwxrwxr-x root     root        65267 2011-06-15 22:38 Si.pz-vbc.UPF
-rwxrwxr-x root     root          436 2011-06-16 11:29 si-scf.in
drwxrwxrwx root     root              2011-06-16 11:23 silicon.save
# ./pw.x <si-scf.in
     Program PWSCF v.4.3.1      starts on 16Jun2011 at 11:30: 1
     This program is part of the open-source Quantum ESPRESSO suite
     for quantum simulation of materials; please cite
         "P. Giannozzi et al., J. Phys.:Condens. Matter 21 395502 (2009);
          URL http://www.quantum-espresso.org",
     in publications or presentations arising from this work. More details at
     http://www.quantum-espresso.org/wiki/index.php/Citing_Quantum-ESPRESSO
...
!    total energy              =     -15.82060780 Ry
...
     PWSCF        :    40.50s CPU        41.60s WALL
   This run was terminated on:  11:30:42  16Jun2011           
=------------------------------------------------------------------------------=
   JOB DONE.
=------------------------------------------------------------------------------=

The phone is a Samsung Galaxy ACE. The calculation takes 40 s compared to 110 s on the emulator. However, on the Intel E8400 desktop, the job runs in less than 1 second!