Skip to contentSkip to conversation

mcpu options for AMCC440 with fpu

DISCUSSION Patrice Bouchand 3 participants 7 messages Feb 19, 2007 – Feb 24, 2007

lore
Share & tools
lore
#0 lore raw

Hello,

I was searching for the best mcpu option for amcc440, compiling and running a small program you can find here:
http://magnux.free.fr/gcc/mandelbrot.c. My distro is a ppc fedora core 6, and results are obviously the same using DENX4.0.

--------------------
-bash-3.00# gcc -O2 ./mandelbrot.c -o ./mandelbrot && time ./mandelbrot && rm -f ./mandelbrot

real    1m15.059s
user    1m14.996s
sys     0m0.060s

-bash-3.00# gcc -O2 -mcpu=440 ./mandelbrot.c -o ./mandelbrot && time ./mandelbrot && rm -f ./mandelbrot

real    0m39.606s
user    0m39.552s
sys     0m0.028s

-bash-3.00# gcc -O2 -mcpu=440fp ./mandelbrot.c -o ./mandelbrot && time ./mandelbrot && rm -f ./mandelbrot

real    1m15.016s
user    1m14.988s
sys     0m0.024s

-bash-3.00# gcc -O2 -msoft-float ./mandelbrot.c -o ./mandelbrot && time ./mandelbrot && rm -f ./mandelbrot

real    0m39.577s
user    0m39.544s
sys     0m0.032s

--------------------

* I do not explain why not using FPU gives better results ?

* I did also a test with bzip2.c ( http://pag.csail.mit.edu/~smcc/projects/single-file-programs/bzip2.c ).

----------------------
-bash-3.00# gcc -O2 ./bzip2.c -o ./bzip2 && time ./bzip2 ./oggenc.c && ./bzip2 -d ./oggenc.c.bz2 && rm ./bzip2

real    0m18.478s
user    0m18.216s
sys     0m0.152s

-bash-3.00# gcc -O2 -mcpu=440 ./bzip2.c -o ./bzip2 && time ./bzip2 ./oggenc.c && ./bzip2 -d ./oggenc.c.bz2 && rm ./bzip2

real    0m18.786s
user    0m18.544s
sys     0m0.128s

-bash-3.00# gcc -O2 -mcpu=440fp ./bzip2.c -o ./bzip2 && time ./bzip2 ./oggenc.c && ./bzip2 -d ./oggenc.c.bz2 && rm ./bzip2

real    0m18.811s
user    0m18.548s
sys     0m0.144s

-bash-3.00# gcc -O2 -mcpu=G3 ./bzip2.c -o ./bzip2 && time ./bzip2 ./oggenc.c && ./bzip2 -d ./oggenc.c.bz2 && rm ./bzip2

real    0m18.871s
user    0m18.644s
sys     0m0.104s

----------------------

* mcpu option seems to not have any effect ?

* My third test was to compile and run mplayer.
- With default options (no mcpu specified), my test mpeg was smooth.
- With mcpu=440fp, my test mpeg was not smooth.

Can anybody bring me some lights about the right gcc mcpu option for amcc440 ?

Best regards,

Patrice Bouchand

---------------------------------
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses.

#1 lore raw

FYI, I got the following answer on mplayer mailing list:

Quoted 2 lines

Apparently -mcpu=440fp is the one. However, it's possible, that GCC "optimizations" actually make the code slower.

Can someone confirme this possiblity ?

Any answer would be greatly appreciated ;)

Patrice Bouchand

Quoted 90 lines

Hello,

I was searching for the best mcpu option for amcc440, compiling and
running a small program you can find here:
http://magnux.free.fr/gcc/mandelbrot.c. My distro is a ppc fedora core 6, and results are obviously the same using DENX4.0.

--------------------
-bash-3.00# gcc -O2 ./mandelbrot.c -o ./mandelbrot && time ./mandelbrot && rm -f ./mandelbrot

real    1m15.059s
user    1m14.996s
sys     0m0.060s

-bash-3.00# gcc -O2 -mcpu=440 ./mandelbrot.c -o ./mandelbrot && time ./mandelbrot && rm -f ./mandelbrot

real    0m39.606s
user    0m39.552s
sys     0m0.028s

-bash-3.00# gcc -O2 -mcpu=440fp ./mandelbrot.c -o ./mandelbrot && time ./mandelbrot && rm -f ./mandelbrot

real    1m15.016s
user    1m14.988s
sys     0m0.024s

-bash-3.00# gcc -O2 -msoft-float ./mandelbrot.c -o ./mandelbrot && time ./mandelbrot && rm -f ./mandelbrot

real    0m39.577s
user    0m39.544s
sys     0m0.032s

--------------------

* I do not explain why not using FPU gives better results ?

* I did also a test with bzip2.c
( http://pag.csail.mit.edu/~smcc/projects/single-file-programs/bzip2.c ).

----------------------
-bash-3.00# gcc -O2 ./bzip2.c -o ./bzip2 && time ./bzip2 ./oggenc.c && ./bzip2 -d ./oggenc.c.bz2 && rm ./bzip2

real    0m18.478s
user    0m18.216s
sys     0m0.152s

-bash-3.00# gcc -O2 -mcpu=440 ./bzip2.c -o ./bzip2 && time ./bzip2 ./oggenc.c && ./bzip2 -d ./oggenc.c.bz2 && rm ./bzip2

real    0m18.786s
user    0m18.544s
sys     0m0.128s

-bash-3.00# gcc -O2 -mcpu=440fp ./bzip2.c -o ./bzip2 && time ./bzip2 ./oggenc.c && ./bzip2 -d ./oggenc.c.bz2 && rm ./bzip2

real    0m18.811s
user    0m18.548s
sys     0m0.144s

-bash-3.00# gcc -O2 -mcpu=G3 ./bzip2.c -o ./bzip2 && time ./bzip2 ./oggenc.c && ./bzip2 -d ./oggenc.c.bz2 && rm ./bzip2

real    0m18.871s
user    0m18.644s
sys     0m0.104s

----------------------

* mcpu option seems to not have any effect ?

* My third test was to compile and run mplayer.
- With default options (no mcpu specified), my test mpeg was smooth.
- With mcpu=440fp, my test mpeg was not smooth.

Can anybody bring me some lights about the right gcc mcpu option for
amcc440 ?

Best regards,

Patrice Bouchand

______________________________________________________________________
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses.
_______________________________________________
Linuxppc-embedded mailing list [email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-embedded

#2 lore raw

Hi,

Have you tried using the -ffast-math option?

/Magnus

Quoted 44 lines · On Wed, 21 Feb 2007 20:47:50 +0100 Patrice Bouchand <[email protected]>…

=20
FYI, I got the following answer on mplayer mailing list:
=20

Quoted 2 lines

Apparently -mcpu=3D440fp is the one. However, it's possible, that GCC "optimizations" actually make the code slower.

=20
Can someone confirme this possiblity ?
=20
Any answer would be greatly appreciated ;)=20
=20
=20
Patrice Bouchand
=20
=20

Quoted 30 lines

Hello,
=20
I was searching for the best mcpu option for amcc440, compiling and
running a small program you can find here:=20
http://magnux.free.fr/gcc/mandelbrot.c. My distro is a ppc fedora core 6, and results are obviously the same using DENX4.0.
=20
--------------------
-bash-3.00# gcc -O2 ./mandelbrot.c -o ./mandelbrot &&
time ./mandelbrot && rm -f ./mandelbrot
=20

real    1m15.059s
user    1m14.996s
sys     0m0.060s
-bash-3.00# gcc -O2 -mcpu=3D440 ./mandelbrot.c -o ./mandelbrot &&
time ./mandelbrot && rm -f ./mandelbrot
=20
real    0m39.606s
user    0m39.552s
sys     0m0.028s
-bash-3.00# gcc -O2 -mcpu=3D440fp ./mandelbrot.c -o ./mandelbrot &&
time ./mandelbrot && rm -f ./mandelbrot
=20
real    1m15.016s
user    1m14.988s
sys     0m0.024s

-bash-3.00# gcc -O2 -msoft-float ./mandelbrot.c -o ./mandelbrot && time ./mandelbrot && rm -f ./mandelbrot
=20
real 0m39.577s

Quoted 8 lines
Quoted 8 lines

user 0m39.544s
sys 0m0.032s
--------------------
=20
* I do not explain why not using FPU gives better results ? =20
* I did also a test with bzip2.c
( http://pag.csail.mit.edu/~smcc/projects/single-file-programs/bzip2.c =

).

Quoted 57 lines
Quoted 44 lines

=20
----------------------
-bash-3.00# gcc -O2 ./bzip2.c -o ./bzip2 && time ./bzip2 ./oggenc.c && ./bzip2 -d ./oggenc.c.bz2 && rm ./bzip2
=20

real    0m18.478s
user    0m18.216s
sys     0m0.152s
-bash-3.00# gcc -O2 -mcpu=3D440 ./bzip2.c -o ./bzip2 &&
time ./bzip2 ./oggenc.c && ./bzip2 -d ./oggenc.c.bz2 && rm ./bzip2
=20
real    0m18.786s
user    0m18.544s
sys     0m0.128s
-bash-3.00# gcc -O2 -mcpu=3D440fp ./bzip2.c -o ./bzip2 &&
time ./bzip2 ./oggenc.c && ./bzip2 -d ./oggenc.c.bz2 && rm ./bzip2
=20
real    0m18.811s
user    0m18.548s
sys     0m0.144s
-bash-3.00# gcc -O2 -mcpu=3DG3 ./bzip2.c -o ./bzip2 &&
time ./bzip2 ./oggenc.c && ./bzip2 -d ./oggenc.c.bz2 && rm ./bzip2
=20
real    0m18.871s
user    0m18.644s
sys     0m0.104s

----------------------
=20
* mcpu option seems to not have any effect ?
=20
* My third test was to compile and run mplayer.
- With default options (no mcpu specified), my test mpeg was smooth.
- With mcpu=3D440fp, my test mpeg was not smooth.
=20
Can anybody bring me some lights about the right gcc mcpu option for
amcc440 ?
=20
Best regards,
=20
Patrice Bouchand
=20
=20
=20
=20

Quoted 8 lines

______________________________________________________________________
D=E9couvrez une nouvelle fa=E7on d'obtenir des r=E9ponses =E0 toutes vos questions ! Profitez des connaissances, des opinions et des exp=E9riences des internautes sur Yahoo! Questions/R=E9ponses.
_______________________________________________
Linuxppc-embedded mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-embedded

=20
_______________________________________________
Linuxppc-embedded mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-embedded

#3 lore raw

Thanks for your answer but unfortunately, it makes just the thing a bit slower:

-bash-3.00# gcc -O2 -mcpu=440fp -ffast-math ./mandelbrot.c -o ./mandelbrot && time ./mandelbrot && rm -f ./mandelbrot

real    1m17.901s
user    1m17.828s
sys     0m0.036s

-bash-3.00# gcc -O2 -mcpu=440 -ffast-math ./mandelbrot.c -o ./mandelbrot && time ./mandelbrot && rm -f ./mandelbrot

real    0m41.180s
user    0m41.116s
sys     0m0.040s

-bash-3.00# gcc -O2 -mcpu=G3 -ffast-math ./mandelbrot.c -o ./mandelbrot && time ./mandelbrot && rm -f ./mandelbrot

real    1m14.820s
user    1m14.760s
sys     0m0.044s

Magnus Hjorth <[email protected]> a écrit : Hi,

Have you tried using the -ffast-math option?

/Magnus

Quoted 96 lines · On Wed, 21 Feb 2007 20:47:50 +0100 Patrice Bouchand wrote:

FYI, I got the following answer on mplayer mailing list:

Quoted 2 lines

Apparently -mcpu=440fp is the one. However, it's possible, that GCC "optimizations" actually make the code slower.

Can someone confirme this possiblity ?

Any answer would be greatly appreciated ;)

Patrice Bouchand

Quoted 82 lines

Hello,

I was searching for the best mcpu option for amcc440, compiling and
running a small program you can find here:
http://magnux.free.fr/gcc/mandelbrot.c. My distro is a ppc fedora core 6, and results are obviously the same using DENX4.0.

--------------------
-bash-3.00# gcc -O2 ./mandelbrot.c -o ./mandelbrot && time ./mandelbrot && rm -f ./mandelbrot

real    1m15.059s
user    1m14.996s
sys     0m0.060s

-bash-3.00# gcc -O2 -mcpu=440 ./mandelbrot.c -o ./mandelbrot && time ./mandelbrot && rm -f ./mandelbrot

real    0m39.606s
user    0m39.552s
sys     0m0.028s

-bash-3.00# gcc -O2 -mcpu=440fp ./mandelbrot.c -o ./mandelbrot && time ./mandelbrot && rm -f ./mandelbrot

real    1m15.016s
user    1m14.988s
sys     0m0.024s

-bash-3.00# gcc -O2 -msoft-float ./mandelbrot.c -o ./mandelbrot && time ./mandelbrot && rm -f ./mandelbrot

real    0m39.577s
user    0m39.544s
sys     0m0.032s

--------------------

* I do not explain why not using FPU gives better results ?

* I did also a test with bzip2.c
( http://pag.csail.mit.edu/~smcc/projects/single-file-programs/bzip2.c ).

----------------------
-bash-3.00# gcc -O2 ./bzip2.c -o ./bzip2 && time ./bzip2 ./oggenc.c && ./bzip2 -d ./oggenc.c.bz2 && rm ./bzip2

real    0m18.478s
user    0m18.216s
sys     0m0.152s

-bash-3.00# gcc -O2 -mcpu=440 ./bzip2.c -o ./bzip2 && time ./bzip2 ./oggenc.c && ./bzip2 -d ./oggenc.c.bz2 && rm ./bzip2

real    0m18.786s
user    0m18.544s
sys     0m0.128s

-bash-3.00# gcc -O2 -mcpu=440fp ./bzip2.c -o ./bzip2 && time ./bzip2 ./oggenc.c && ./bzip2 -d ./oggenc.c.bz2 && rm ./bzip2

real    0m18.811s
user    0m18.548s
sys     0m0.144s

-bash-3.00# gcc -O2 -mcpu=G3 ./bzip2.c -o ./bzip2 && time ./bzip2 ./oggenc.c && ./bzip2 -d ./oggenc.c.bz2 && rm ./bzip2

real    0m18.871s
user    0m18.644s
sys     0m0.104s

----------------------

* mcpu option seems to not have any effect ?

* My third test was to compile and run mplayer.
- With default options (no mcpu specified), my test mpeg was smooth.
- With mcpu=440fp, my test mpeg was not smooth.

Can anybody bring me some lights about the right gcc mcpu option for
amcc440 ?

Best regards,

Patrice Bouchand

Quoted 13 lines
Quoted 8 lines

______________________________________________________________________
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses.
_______________________________________________
Linuxppc-embedded mailing list [email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-embedded

_______________________________________________
Linuxppc-embedded mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-embedded

---------------------------------
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses.

#4 lore raw
In reply to Patrice Bouchand
Quoted 3 lines · In message <[email protected]> you wrote:

I was searching for the best mcpu option for amcc440, compiling and running a small program you can find here:
http://magnux.free.fr/gcc/mandelbrot.c. My distro is a ppc fedora core 6, and results are obviously the same using DENX4.0.

In general, you should need to meddle much with such options; the ELDK default settings are usually OK.

Quoted 13 lines

--------------------
-bash-3.00# gcc -O2 ./mandelbrot.c -o ./mandelbrot && time ./mandelbrot && rm -f ./mandelbrot

real    1m15.059s
user    1m14.996s
sys     0m0.060s

-bash-3.00# gcc -O2 -mcpu=440 ./mandelbrot.c -o ./mandelbrot && time ./mandelbrot && rm -f ./mandelbrot

real    0m39.606s
user    0m39.552s
sys     0m0.028s

-bash-3.00# gcc -O2 -mcpu=440fp ./mandelbrot.c -o ./mandelbrot && time ./mandelbrot && rm -f ./mandelbrot

Quoted 8 lines
real    1m15.016s
user    1m14.988s
sys     0m0.024s

-bash-3.00# gcc -O2 -msoft-float ./mandelbrot.c -o ./mandelbrot && time ./mandelbrot && rm -f ./mandelbrot

real    0m39.577s
user    0m39.544s
sys     0m0.032s

This looks to me as if you have been runing all these tests in the SAME environment, probably the /opt/eldk/ppc_4xx root file system, which is soft-float based. You must not do this.

For tests with FP instructions, you MUST use the /opt/eldk/ppc_4xxFP root file system. For tests with soft-float, you MUST use the /opt/eldk/ppc_4xx root file system.

You CANNOT link an application build with one settings against libraries using other settings, or you will run into trouble. You would probably have seen the problems if you had used any test where the results of the calculations would have been visible.

Quoted 1 line

* I do not explain why not using FPU gives better results ?

Because you did not run the tests you thought yoiu were running.

Quoted 1 line

* mcpu option seems to not have any effect ?

Use "gcc -v" to see exactly which options get passed to the compiler stages.

Quoted 5 lines

* My third test was to compile and run mplayer.
- With default options (no mcpu specified), my test mpeg was smooth.
- With mcpu=440fp, my test mpeg was not smooth.

Can anybody bring me some lights about the right gcc mcpu option for amcc440 ?

Just use the defaults, unless you know exactly what you are doing.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH, HRB 165235 Munich, CEO: Wolfgang Denk
Office:  Kirchenstr. 5,       D-82194 Groebenzell,            Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [email protected]
If there was anything that depressed him more than his own  cynicism,
it was that quite often it still wasn't as cynical as real life.
                                 - Terry Pratchett, _Guards! Guards!_
#5 lore raw

Indeed ! I was waiting for warnings or errors while compiling to tell me I was doing something wrong but I should not.

Thanks for your time.

Patrice

Quoted 65 lines
Quoted 3 lines · In message <[email protected]> you wrote:

I was searching for the best mcpu option for amcc440, compiling and running a small program you can find here:
http://magnux.free.fr/gcc/mandelbrot.c. My distro is a ppc fedora core 6, and results are obviously the same using DENX4.0.

In general, you should need to meddle much with such options; the ELDK default settings are usually OK.

Quoted 13 lines

--------------------
-bash-3.00# gcc -O2 ./mandelbrot.c -o ./mandelbrot && time ./mandelbrot && rm -f ./mandelbrot

real    1m15.059s
user    1m14.996s
sys     0m0.060s

-bash-3.00# gcc -O2 -mcpu=440 ./mandelbrot.c -o ./mandelbrot && time ./mandelbrot && rm -f ./mandelbrot

real    0m39.606s
user    0m39.552s
sys     0m0.028s

-bash-3.00# gcc -O2 -mcpu=440fp ./mandelbrot.c -o ./mandelbrot && time ./mandelbrot && rm -f ./mandelbrot

Quoted 8 lines
real    1m15.016s
user    1m14.988s
sys     0m0.024s

-bash-3.00# gcc -O2 -msoft-float ./mandelbrot.c -o ./mandelbrot && time ./mandelbrot && rm -f ./mandelbrot

real    0m39.577s
user    0m39.544s
sys     0m0.032s

This looks to me as if you have been runing all these tests in the SAME environment, probably the /opt/eldk/ppc_4xx root file system, which is soft-float based. You must not do this.

For tests with FP instructions, you MUST use the /opt/eldk/ppc_4xxFP root file system. For tests with soft-float, you MUST use the /opt/eldk/ppc_4xx root file system.

You CANNOT link an application build with one settings against libraries using other settings, or you will run into trouble. You would probably have seen the problems if you had used any test where the results of the calculations would have been visible.

Quoted 1 line

* I do not explain why not using FPU gives better results ?

Because you did not run the tests you thought yoiu were running.

Quoted 1 line

* mcpu option seems to not have any effect ?

Use "gcc -v" to see exactly which options get passed to the compiler stages.

Quoted 5 lines

* My third test was to compile and run mplayer.
- With default options (no mcpu specified), my test mpeg was smooth.
- With mcpu=440fp, my test mpeg was not smooth.

Can anybody bring me some lights about the right gcc mcpu option for amcc440 ?

Just use the defaults, unless you know exactly what you are doing.

Best regards,

Wolfgang Denk

#6 lore raw
Quoted 3 lines · In message <[email protected]> you wrote:

Indeed ! I was waiting for warnings or errors while compiling to tell me I was doing something wrong but I should not.

There might be situations where what you did was fully intentional.

"UNIX was not designed to stop you from doing stupid things, because
that would also stop you from doing clever things." - Doug Gwyn

:-)

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH, HRB 165235 Munich, CEO: Wolfgang Denk
Office:  Kirchenstr. 5,       D-82194 Groebenzell,            Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [email protected]
History tends to exaggerate.
	-- Col. Green, "The Savage Curtain", stardate 5906.4