+ Reply to Thread
Results 1 to 17 of 17
  1. #1
    Uncommon Man samwichse's Avatar
    Join Date
    Oct 2001
    Location
    State College, PA
    Posts
    4,281

    gcc 3.2 slows down athlon?

     
    Ok, I know little about compilation, but I was still running the old core I compiled for ecc2 under redhat 7.3 (gcc 2.96) with the defaults (I don't know how to change them or what to change them to). It was getting about 930kit/s.

    So I just realized, hey, gcc 3.x is supposed to compile better for athlons, I recompiled it (still with defaults) and now I get 665 kit/s.

    HELP! (note, I failed to back up the old core). How do I optimize this better???

    Sam

  2. #2
    Ultimate Member pbharris's Avatar
    Join Date
    Oct 2001
    Location
    Chicago, IL
    Posts
    2,514
    hi sam,
    what flags did you pass in? gcc3x slowed down pure C a bit but sped up C++ progies, in either case dropping that much is much much worse than can be accounted for by going from 2.96 to 3.2
    Odds are very good there are several spelling mistakes in this post.

  3. #3
    Uncommon Man samwichse's Avatar
    Join Date
    Oct 2001
    Location
    State College, PA
    Posts
    4,281
    Um... flags?


  4. #4
    Ultimate Member pbharris's Avatar
    Join Date
    Oct 2001
    Location
    Chicago, IL
    Posts
    2,514
    i use these:
    Code:
    export CFLAGS=$'-O2 -march=athlon'
    export CXXFLAGS=$'-O2 -march=athlon'
    w/o out them your compiler will used default glibc i think, which is i386 under rh
    Odds are very good there are several spelling mistakes in this post.

  5. #5
    Uncommon Man samwichse's Avatar
    Join Date
    Oct 2001
    Location
    State College, PA
    Posts
    4,281
    So you just type the exports before compiling?

    Where does this add/change things?

    Is there a way to edit this directly with vim/kate/gedit or something?

    Sam

    make -C ./src client
    make[1]: Entering directory `/home/samwich/Desktop/ecc2/src'
    nasm -felf mult109_mmx.asm
    gcc -Wall -Wno-unused -O3 -funroll-loops -fomit-frame-pointer -fexpensive-optimizations -I../include -o client client.c ecc2-109.c sq109_mmx.c mult109_mmx.o
    client.c:41:15: warning: multi-line string literals are deprecated
    mv client ..
    make[1]: Leaving directory `/home/samwich/Desktop/ecc2/src'
    That's what I get when I try it.

    EDIT: it's also just as slow.
    Last edited by samwichse; February 9th, 2003 at 06:44 PM.

  6. #6
    Ultimate Member BFlurie's Avatar
    Join Date
    Oct 2001
    Location
    Hagerstown, Maryland
    Posts
    3,221
    Put/edit these lines in /etc/profile

    export CFLAGS="02 -march=athlon"
    export CXXFLAGS=$CFLAGS

    then further down the file, make sure those 2 from above are in the gereral export line:
    export CFLAGS CXXFLAGS PATH MANPATH........etc

    gotta reboot then. You can use more flags than the above, but those'll give you most of the benefits.
    Last edited by BFlurie; February 9th, 2003 at 07:08 PM.

  7. #7
    Uncommon Man samwichse's Avatar
    Join Date
    Oct 2001
    Location
    State College, PA
    Posts
    4,281
    Ok, after adding the code, this is what it looks like:
    But, it didn't seem to change anything when I did a make on the core. The file size of the executible was identical, and the speed is the same.

    Code:
    # /etc/profile
    
    # System wide environment and startup programs, for login setup
    # Functions and aliases go in /etc/bashrc
    
    export CFLAGS="02 -march=athlon"
    export CXXFLAGS=$CFLAGS
    
    pathmunge () {
    	if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
    	   if [ "$2" = "after" ] ; then
    	      PATH=$PATH:$1
    	   else
    	      PATH=$1:$PATH
    	   fi
    	fi
    }
    
    # Path manipulation
    if [ `id -u` = 0 ]; then
    	pathmunge /sbin
    	pathmunge /usr/sbin
    	pathmunge /usr/local/sbin
    fi
    
    pathmunge /usr/X11R6/bin after
    
    unset pathmunge
    
    # No core files by default
    ulimit -S -c 0 > /dev/null 2>&1
    
    USER="`id -un`"
    LOGNAME=$USER
    MAIL="/var/spool/mail/$USER"
    
    HOSTNAME=`/bin/hostname`
    HISTSIZE=1000
    
    if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
        INPUTRC=/etc/inputrc
    fi
    
    export CFLAGS CXXFLAGS PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC
    
    for i in /etc/profile.d/*.sh ; do
        if [ -r "$i" ]; then
        	. $i
        fi
    done
    
    unset i

  8. #8
    Ultimate Member BFlurie's Avatar
    Join Date
    Oct 2001
    Location
    Hagerstown, Maryland
    Posts
    3,221
    Sorry, I didn't realize it was the kernel. Add -march=athlon -malign-functions=4 -mpreferred-stack-boundary=2

    to the file /usr/src/linux..../Makefile, on this line near the top:

    HOSTCFLAGS = -Wall -Wstrict-prototypes.....

  9. #9
    Uncommon Man samwichse's Avatar
    Join Date
    Oct 2001
    Location
    State College, PA
    Posts
    4,281
    No, it's not the kernel, it's the ecc2-109 core I'm trying to compile here.

    Can I add those options to /etc/profile ?

  10. #10
    Ultimate Member pbharris's Avatar
    Join Date
    Oct 2001
    Location
    Chicago, IL
    Posts
    2,514
    i just type them when i need to, if ya want them everywhere you can add them there. what were the orginal ones made with?
    Odds are very good there are several spelling mistakes in this post.

  11. #11
    Uncommon Man samwichse's Avatar
    Join Date
    Oct 2001
    Location
    State College, PA
    Posts
    4,281
    The original core I was using was made with all the defaults in RedHat 7.3 with gcc 2.96, it got 930-940k it/s.

    But when I compile now (even after adding all those to the profile, or just doing the "export" thing... I still get the same problem... about 665k it/s.

    Any other ideas?

  12. #12
    Ultimate Member BFlurie's Avatar
    Join Date
    Oct 2001
    Location
    Hagerstown, Maryland
    Posts
    3,221
    While compiling, are you seeing the:
    -02 -march=athlon -mpreferred-stack-boundary=2......
    in the compilation lines as they pass by? Also, -fomit-frame-pointer should appear by default for a -02 level or above compilation.

    Also, do you "make clean" before recompiling to start fresh?
    Last edited by BFlurie; February 10th, 2003 at 10:18 AM.

  13. #13
    Uncommon Man samwichse's Avatar
    Join Date
    Oct 2001
    Location
    State College, PA
    Posts
    4,281
    No, I'm seeing this exactly (this is a very small program):

    Code:
    make -C ./src client
    make[1]: Entering directory `/home/samwich/Desktop/ecc2/src'
    nasm -felf mult109_mmx.asm
    gcc -Wall -Wno-unused -O3 -funroll-loops -fomit-frame-pointer -fexpensive-optimizations -I../include -o client client.c ecc2-109.c sq109_mmx.c mult109_mmx.o
    client.c:41:15: warning: multi-line string literals are deprecated
    mv client ..
    make[1]: Leaving directory `/home/samwich/Desktop/ecc2/src'
    And no, no "make clean" I'm just deleting the whole source and re-unpacking it.

  14. #14
    Ultimate Member BFlurie's Avatar
    Join Date
    Oct 2001
    Location
    Hagerstown, Maryland
    Posts
    3,221
    Then for some reason GCC isn't importing your profile settings. Compiling as root?

    Try adding the flags:

    -march=athlon -malign-functions=4 -mpreferred-stack-boundary=2

    to the appropriate line in the install's makefile before running configure. Check it again before running "make" to be sure it didn't change.

    Personally, the -fexpensive-optimizations gains very little -- I'd drop that. I've also heard a fair bit of warning on using GCC 3xx, tho the newest stuff prb'ly requires it.
    Last edited by BFlurie; February 10th, 2003 at 11:39 AM.

  15. #15
    Ultimate Member strangerstill's Avatar
    Join Date
    Oct 2001
    Posts
    1,542
    Yep - I've tried various optimisations and have comprehensively failed to push it over 650 kIt/s (gcc 3.2, Athlon XP 1800) whereas the gcc 2.96 core gets 880 kIt/s.

    Get a gcc 2.96 compiled core from Sven Geier's page - http://www.its.caltech.edu/~sgeier/code/ecc2.html

    (Sven is in Ars Technica Team Vodka Martini, and has written a couple of cool shells for ecc2)

  16. #16
    Uncommon Man samwichse's Avatar
    Join Date
    Oct 2001
    Location
    State College, PA
    Posts
    4,281
    Oooooh... so this isn't just my stupidity perhaps?

    Oh well, downloading the precompiled one put it back up to about 910k it/s on a 1700+ (running at 2000+), so I guess the simplest solution is the best in this case.

    Thanks to everyone for their help though, I learned something anyway

    Sam

  17. #17
    Where's the beef? Scott Tiger's Avatar
    Join Date
    Mar 2002
    Location
    Southwest, VA
    Posts
    3,586
    Yeah, but I can't help but be disappointed here to know that the latest version of GCC puts out slower code than the one that came before it.. Or is this just an anomoly? (I know very little of compilers and there affects on performance).
    Where's Lunch?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Recommended Sites: ResellerRatings Store Reviews