baldyza
Posts: 37
Joined: Fri Sep 21, 2012 11:23 am

cflags for raspberry pi

Fri Sep 21, 2012 11:27 am

I am using the default flags CFLAGS="-O2 -pipe -march=armv6j -mfpu=vfp -mfloat-abi=hard" which are working fine. Is anyone using anything better?

IntelMiner
Posts: 22
Joined: Wed Jul 18, 2012 1:07 pm

Re: cflags for raspberry pi

Sun Sep 23, 2012 8:41 pm

CFLAGS="-O2 -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard"

CXXFLAGS="${CFLAGS}"

CHOST="armv6j-hardfloat-linux-gnueabi"

sirclockalot
Posts: 14
Joined: Wed Jun 13, 2012 11:08 am

Re: cflags for raspberry pi

Tue Sep 25, 2012 6:26 pm

IntelMiner wrote:CFLAGS="-O2 -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard"

CXXFLAGS="${CFLAGS}"

CHOST="armv6j-hardfloat-linux-gnueabi"
I would be very interested in knowing the difference between:

Code: Select all

-mcpu=arm1176jzf-s
and,

Code: Select all

-march=armv6j
Is the first option a more complete detailing of the processor than the second?

baldyza
Posts: 37
Joined: Fri Sep 21, 2012 11:23 am

Re: cflags for raspberry pi

Sun Oct 07, 2012 4:56 pm

Have seen a few reference that the -mcpu=arm1176jzf-s actually is slower, so did some nbench tests (default gcc-4.5.4).

With CFLAGS="-O2 -pipe -march=armv6j -mfpu=vfp -mfloat-abi=hard"

Code: Select all

BYTEmark* Native Mode Benchmark ver. 2 (10/95)
Index-split by Andrew D. Balsa (11/97)
Linux/Unix* port by Uwe F. Mayer (12/96,11/97)

TEST                : Iterations/sec.  : Old Index   : New Index
                    :                  : Pentium 90* : AMD K6/233*
--------------------:------------------:-------------:------------
NUMERIC SORT        :           198.6  :       5.09  :       1.67
STRING SORT         :          27.034  :      12.08  :       1.87
BITFIELD            :      6.0819e+07  :      10.43  :       2.18
FP EMULATION        :          22.129  :      10.62  :       2.45
FOURIER             :            2256  :       2.57  :       1.44
ASSIGNMENT          :          2.5866  :       9.84  :       2.55
IDEA                :          706.16  :      10.80  :       3.21
HUFFMAN             :          387.15  :      10.74  :       3.43
NEURAL NET          :          3.0972  :       4.98  :       2.09
LU DECOMPOSITION    :          74.619  :       3.87  :       2.79
==========================ORIGINAL BYTEMARK RESULTS==========================
INTEGER INDEX       : 9.647
FLOATING-POINT INDEX: 3.668
Baseline (MSDOS*)   : Pentium* 90, 256 KB L2-cache, Watcom* compiler 10.0
==============================LINUX DATA BELOW===============================
CPU                 : 
L2 Cache            : 
OS                  : Linux 3.2.27+
C compiler          : armv6j-hardfloat-linux-gnueabi-gcc
libc                : 
MEMORY INDEX        : 2.183
INTEGER INDEX       : 2.591
FLOATING-POINT INDEX: 2.034
Baseline (LINUX)    : AMD K6/233*, 512 KB L2-cache, gcc 2.7.2.3, libc-5.4.38
* Trademarks are property of their respective holder.
With CFLAGS="-O2 -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard"

Code: Select all

BYTEmark* Native Mode Benchmark ver. 2 (10/95)
Index-split by Andrew D. Balsa (11/97)
Linux/Unix* port by Uwe F. Mayer (12/96,11/97)

TEST                : Iterations/sec.  : Old Index   : New Index
                    :                  : Pentium 90* : AMD K6/233*
--------------------:------------------:-------------:------------
NUMERIC SORT        :           216.8  :       5.56  :       1.83
STRING SORT         :          26.454  :      11.82  :       1.83
BITFIELD            :      5.1968e+07  :       8.91  :       1.86
FP EMULATION        :          20.088  :       9.64  :       2.22
FOURIER             :          1966.4  :       2.24  :       1.26
ASSIGNMENT          :          2.5692  :       9.78  :       2.54
IDEA                :          679.19  :      10.39  :       3.08
HUFFMAN             :          381.97  :      10.59  :       3.38
NEURAL NET          :          3.0523  :       4.90  :       2.06
LU DECOMPOSITION    :          80.928  :       4.19  :       3.03
==========================ORIGINAL BYTEMARK RESULTS==========================
INTEGER INDEX       : 9.313
FLOATING-POINT INDEX: 3.582
Baseline (MSDOS*)   : Pentium* 90, 256 KB L2-cache, Watcom* compiler 10.0
==============================LINUX DATA BELOW===============================
CPU                 : 
L2 Cache            : 
OS                  : Linux 3.2.27+
C compiler          : armv6j-hardfloat-linux-gnueabi-gcc
libc                : 
MEMORY INDEX        : 2.052
INTEGER INDEX       : 2.551
FLOATING-POINT INDEX: 1.987
Baseline (LINUX)    : AMD K6/233*, 512 KB L2-cache, gcc 2.7.2.3, libc-5.4.38
* Trademarks are property of their respective holder.
Interesting results, not really a clear better option from my interpretation of the results.

baldyza
Posts: 37
Joined: Fri Sep 21, 2012 11:23 am

Re: cflags for raspberry pi

Sun Oct 07, 2012 7:01 pm

http://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html
I tried a few different combinations based on the GCC docs. The most logical cflags based on the docs and benchmark seem to me "-O2 -pipe -march=armv6j -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard" overall it is still not faster than the default -march=armv6j.

With "-O2 -pipe -march=armv6j -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard"

Code: Select all

BYTEmark* Native Mode Benchmark ver. 2 (10/95)
Index-split by Andrew D. Balsa (11/97)
Linux/Unix* port by Uwe F. Mayer (12/96,11/97)

TEST                : Iterations/sec.  : Old Index   : New Index
                    :                  : Pentium 90* : AMD K6/233*
--------------------:------------------:-------------:------------
NUMERIC SORT        :          218.36  :       5.60  :       1.84
STRING SORT         :          26.404  :      11.80  :       1.83
BITFIELD            :      5.2037e+07  :       8.93  :       1.86
FP EMULATION        :          20.072  :       9.63  :       2.22
FOURIER             :          2235.5  :       2.54  :       1.43
ASSIGNMENT          :          2.5814  :       9.82  :       2.55
IDEA                :          678.92  :      10.38  :       3.08
HUFFMAN             :          382.12  :      10.60  :       3.38
NEURAL NET          :          3.0499  :       4.90  :       2.06
LU DECOMPOSITION    :          81.176  :       4.21  :       3.04
==========================ORIGINAL BYTEMARK RESULTS==========================
INTEGER INDEX       : 9.327
FLOATING-POINT INDEX: 3.742
Baseline (MSDOS*)   : Pentium* 90, 256 KB L2-cache, Watcom* compiler 10.0
==============================LINUX DATA BELOW===============================
CPU                 : 
L2 Cache            : 
OS                  : Linux 3.2.27+
C compiler          : armv6j-hardfloat-linux-gnueabi-gcc
libc                : 
MEMORY INDEX        : 2.055
INTEGER INDEX       : 2.555
FLOATING-POINT INDEX: 2.075
Baseline (LINUX)    : AMD K6/233*, 512 KB L2-cache, gcc 2.7.2.3, libc-5.4.38
* Trademarks are property of their respective holder.

IntelMiner
Posts: 22
Joined: Wed Jul 18, 2012 1:07 pm

Re: cflags for raspberry pi

Mon Oct 08, 2012 6:46 pm

The flags I posted were a result of running gcc -march=native -E -v - </dev/null 2>&1 | grep cc1 as per the Safe CFlags page http://en.gentoo-wiki.com/wiki/Safe_Cflags

That said, as the Pi matures, I predict there'll be patches to GCC etc to speed things up

baldyza
Posts: 37
Joined: Fri Sep 21, 2012 11:23 am

Re: cflags for raspberry pi

Tue Oct 09, 2012 3:46 pm

IntelMiner wrote:The flags I posted were a result of running gcc -march=native -E -v - </dev/null 2>&1 | grep cc1 as per the Safe CFlags page http://en.gentoo-wiki.com/wiki/Safe_Cflags

That said, as the Pi matures, I predict there'll be patches to GCC etc to speed things up
Out of interest what version of gcc are you using? I think I tried native with gcc-4.5.4 and got an error.

IntelMiner
Posts: 22
Joined: Wed Jul 18, 2012 1:07 pm

Re: cflags for raspberry pi

Wed Oct 10, 2012 1:17 am

I'm using Gentoo's stable GCC 4.5.4 for ARM

Return to “Gentoo”