6

I am using an embedded Linux board based on a fairly old Freescale ARM chip. How do I determine whether the Python interpreter there is using the hardware FPU on the chip or not?

My /proc/cpuinfo is:

Processor       : ARM926EJ-S rev 5 (v5l)
BogoMIPS        : 179.81
Features        : swp half thumb fastmult edsp java
CPU implementer : 0x41
CPU architecture: 5TEJ
CPU variant     : 0x0
CPU part        : 0x926
CPU revision    : 5
6

In the ARM world from ARMv4 to ARMv7 floating-point support is called VFP, and hardware support for it appears in the Features line of /proc/cpuinfo or in the VFP support log message printed by the kernel while booting. (In ARMv8 it's just "FP".)

In /proc/cpuinfo on an Allwinner A20 this gives:

Features    : swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 

(see the various vfp features) and in the boot log:

VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 4

If VFP isn't fully supported, the kernel will instead log

VFP support v0.3: not present

or

VFP support v0.3: no double precision support

As to whether your Python interpreter is capable of using this, it appears to depend mainly on the architecture of your ARM Linux distribution. If I understand things correctly, basic Debian armel won't use the FPU, Debian armhf (and Raspbian armhf) will; the older Debian arm variant used FPU instructions, but these were emulated if the hardware didn't support them. On armel you can install kernels or C libraries with FPU support (although no such C library appears to be available in the Debian archives).

  • Thanks Stephen, very detailed answer. My /proc/cpuinfo is below, so from that looks like I am definitely not using hardware FP? Processor : ARM926EJ-S rev 5 (v5l) BogoMIPS : 179.81 Features : swp half thumb fastmult edsp java CPU implementer : 0x41 CPU architecture: 5TEJ CPU variant : 0x0 CPU part : 0x926 CPU revision : 5 – SeanLabs Feb 16 '15 at 20:50
  • 1
    It would appear so, at least your kernel doesn't support your FPU. There is a VFP9-S in the ARM926EJ-S, but I don't know if there's a mainstream kernel which would support the combination... – Stephen Kitt Feb 16 '15 at 22:54
1

Try

awk '$1 == "fpu" { print $3 ; }' /proc/cpuinfo

which give

yes
yes

you cant refine with

 awk '$1 == "fpu" { print $3 ; exit ;}' /proc/cpuinfo

to have only one yes.

A mere grep would yield (flags line abbridged)

fpu         : yes
fpu_exception       : yes
flags               : fpu vme de pse tsc msr pae mce cx8 apic sep mtr ...
fpu         : yes
fpu_exception       : yes
flags               : fpu vme de pse tsc msr pae mce cx8 apic sep mtr ...

unfortunatly I don't have a FPU less linux to make the test, maybe a rapsberry owner ?

  • 1
    /proc/cpuinfo on my FPU-less Seagate DockStar doesn't even have a fpu line, so one probably needs to check if the line is absent or contains no to be sure that no FPU is being used. – Tblue Feb 15 '15 at 15:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.