Post your speeds - Calculate 50 Million Factorials

245678

Comments

  • Reply 21 of 146
    lundylundy Posts: 4,466member
    Quote:

    Originally posted by PB

    This is an interesting test. It would be, however, more interesting to see how the relative rating, between the several configurations, changes when you make your code a little more complicated. For example, how about calculating the factorials for all integers between 1 and, say, 20000?



    Can't be done with regular arithmetic - you'd have to use the BigNumber library and then most of the code would be function calls. (The factorial of 64 is 1.26 x 10 to the 89th power). Although doing the calcs in floating-point on the G5 would be interesting.



    So far, there have not been any unexpected or anomalous results in this test, unlike the XBench which is all over the place. We ran a few over at DSLReports in the All Things Mac forum, but still waiting for that G5 here to report in to see the 64-bit arithmetic.
  • Reply 22 of 146
    pbpb Posts: 4,255member
    Quote:

    Originally posted by lundy

    Can't be done with regular arithmetic - you'd have to use the BigNumber library and then most of the code would be function calls.



    Yes, I know, but I am not sure what the author of calc did; the source, if you are interested, is here. By the way, I find calc an extremely well performer, in big factorials too (it prints all the digits quite fast!).



    PS: Oh, and don't forget to check out this
  • Reply 23 of 146
    gabidgabid Posts: 477member
    Well this is nice! From a stock G5 1.8 GHz:



    Quote:

    Start: 1063112803 End: 1063112813



    i= 50000001

    Time=10





    This was with the processor set to "Highest". With "Automatic" the score was 10 when I ran it before I changed to "Highest" and 13 when I changed it back to "Automatic".



    Still, I'm right in thinking this looks good, aren't I?
  • Reply 24 of 146
    Ok, now THIS is a benchmark I can buy into!



    MDD, Single 1.25GHz G4:



    Single-Threaded, gcc:



    Start: 1063119137 End: 1063119157



    i= 50000001

    Time=20



    -John
  • Reply 25 of 146
    lundylundy Posts: 4,466member
    Quote:

    Originally posted by Gabid

    Well this is nice! From a stock G5 1.8 GHz:

    This was with the processor set to "Highest". With "Automatic" the score was 10 when I ran it before I changed to "Highest" and 13 when I changed it back to "Automatic".



    Still, I'm right in thinking this looks good, aren't I?




    Oh yeah. That's fast. This little code probably isn't testing memory bandwidth G4 versus G5. And the executable you are using isn't compiled for 64-bit either!



    Let me see if I can get a 64-bit executable up there.



    >>Johnny
  • Reply 26 of 146
    lundylundy Posts: 4,466member
    Quote:

    Originally posted by Eugene

    For GCC 3.3:

    -mcpu=970

    -mtune=970

    -mpowerpc64



    That's a good place to start.




    Hmm.. doesn't recognize the mcpu or mtune value of 970.



    EDIT: OK I think I can't do a G5 compile since I am running Panther - the Developer Tools Patch won't install.



    Can anybody else put up a G5 64-bit executable, or email to johnnylundy at mac dot com and I will add it to my FTP site? According to the tech notes, some lines need to be added to the compiler settings in PB.
  • Reply 27 of 146
    Quote:

    Originally posted by lundy

    Hmm.. doesn't recognize the mcpu or mtune value of 970.



    The Apple version of GCC 3.3 has to be downloaded and installed separately if you haven't already. This requires an online ADC membership.



    Maybe someone should compile these things properly and put up binaries?



    -- Mark
  • Reply 28 of 146
    Quote:

    Originally posted by lundy

    So far, there have not been any unexpected or anomalous results in this test



    I wouldn't go THAT far. I'm surprised, for example, that my Athlon 1.4 GHz was only 5% slower (or so) than the 2.8 GHz Xeon at work running a single processor.



    -- Mark
  • Reply 29 of 146
    lundylundy Posts: 4,466member
    Quote:

    Originally posted by mark_wilkins

    The Apple version of GCC 3.3 has to be downloaded and installed separately if you haven't already. This requires an online ADC membership.



    Maybe someone should compile these things properly and put up binaries?



    -- Mark




    I have a Premier membership.



    But the patch for 3.3 only installs on Jaguar.
  • Reply 30 of 146
    Quote:

    Originally posted by lundy

    I have a Premier membership.



    But the patch for 3.3 only installs on Jaguar.




    I thought the Panther Xcode tools included a G5-aware version of 3.3? (I don't personally know, as I stopped renewing my developer program membership around the time they started charging for it... I want to say that was... 1991 or so )



    Anyway, you might try downloading and using the IBM compiler.



    -- Mark
  • Reply 31 of 146
    Code:




    paul% gcc --version

    gcc (GCC) 3.3 20030304 (Apple Computer, Inc. build 1435)

    Copyright (C) 2002 Free Software Foundation, Inc.

    This is free software; see the source for copying conditions. There is NO

    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.









    I have an iMac 17", but I am correct in thinking I can still compile G5 optimised code ??? If you wanna tell me what to change, I will happily compile the binary's for you.
  • Reply 32 of 146
    lundylundy Posts: 4,466member
    Quote:

    Originally posted by Gargoyle

    Code:




    paul% gcc --version

    gcc (GCC) 3.3 20030304 (Apple Computer, Inc. build 1435)

    Copyright (C) 2002 Free Software Foundation, Inc.

    This is free software; see the source for copying conditions. There is NO

    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.









    I have an iMac 17", but I am correct in thinking I can still compile G5 optimised code ??? If you wanna tell me what to change, I will happily compile the binary's for you.



    Yep, it works under Jaguar. The ADC site is missing XCode right now and I don't have a copy and gcc 3.3 won't install yet under Panther.



    So - here's a quote from the ADC site ( http://developer.apple.com/technotes/tn/tn2086.html ):



    Quote:

    Getting The Right Tools





    There are three main developer tools components you will want to install to get setup for G5 tuning. The Tachyon 1.0 Developer Preview CD can also be used, although since that tools release is not yet final, it will not be the focus of this technote.





    Step 1





    The first piece you need to install is the December 2002 Mac OS X Developer Tools. If you don't already have these (they ship on a CD with every copy of Mac OS X, and in an image on the hard drive of new Macintoshes), you can download a copy.





    Step 2





    The second piece you need to install is the June 2003 Mac OS X Developer Tools Patch. This can also be downloaded from the ADC website. This tools patch adds a new compiler version (gcc 3.3) that has been tuned for the G5, along with other tools such as gdb that have been updated for the new architecture. While you can do some limited optimization for G5 using earlier versions of gcc, many performance wins will only come when using this new version of the compiler.





    The tools patch also includes an updated version of gcc_select, the tool used for switching which version of gcc is used by default. This tools can be accessed from the command line, and can be used like so to select gcc 3.3 as your system's compiler:





    sudo gcc_select 3.3





    You can also switch back to another version of the compiler by using 3.1 or 2 instead of 3.3. Out of the box, you may not need to use gcc_select, because by default, installing the tools patch will cause gcc 3.3 to become the system compiler.





    Because the December 2002 Developer Tools do not have knowledge of gcc 3.3, there are three build settings that need to be added to projects that you want to be compiled with gcc 3.3. These settings can be added to your Target build settings, or to a Build Style (see the Project Builder documentation for more information on Targets and Build Styles). The three settings you need to add are:





    CC = /usr/bin/gcc-3.3





    CPLUSPLUS = /usr/bin/g++-3.3





    GCC_VERSION = 3.3



    If you can get it to work, then you can email me the binary and I will upload it.



    From the command line you can use the three flags listed by Eugene.



    Thanks
  • Reply 33 of 146
    ok here we go:-

    To download, RIGHT/CMD Click and choose download link to disk.

    Then in the console type chmod 755 {drag icon to terminal window} {hit enter}



    then run the command.





    Binary 1 - No optimisation

    compiled with "gcc -o threaded_no-opim threaded_factorial.c"

    threaded_no-opim



    Binary 2 - Standard optimisation

    compiled with "gcc -03 -lpthread -o threaded_std threaded_factorial.c"

    threaded_std



    And Finally - G5 optimisation

    compiled with "paul% gcc -O3 -lpthread -mcpu=970 -mtune=970 -mpowerpc64 -force_cpusubtype_ALL -o threaded_g5 threaded_factorial.c"

    threaded_g5



    Funnily enough, running the g5 version on my iMac gives "Illegal Instruction"
  • Reply 34 of 146
    Quote:

    Originally posted by Gargoyle

    Funnily enough, running the g5 version on my iMac gives "Illegal Instruction"



    Yeah, well, you enabled 64-bit code generation, so that's going to produce operations your machine won't run.



    -- Mark
  • Reply 35 of 146
    gabidgabid Posts: 477member
    Quote:

    Originally posted by Gargoyle

    ok here we go:-

    To download, RIGHT/CMD Click and choose download link to disk.

    Then in the console type chmod 755 {drag icon to terminal window} {hit enter}



    then run the command.





    Binary 1 - No optimisation

    compiled with "gcc -o threaded_no-opim threaded_factorial.c"

    threaded_no-opim



    Binary 2 - Standard optimisation

    compiled with "gcc -03 -lpthread -o threaded_std threaded_factorial.c"

    threaded_std



    And Finally - G5 optimisation

    compiled with "paul% gcc -O3 -lpthread -mcpu=970 -mtune=970 -mpowerpc64 -force_cpusubtype_ALL -o threaded_g5 threaded_factorial.c"

    threaded_g5



    Funnily enough, running the g5 version on my iMac gives "Illegal Instruction"






    If the Terminal doesn't scare me off I'll give this a run when I get home this evening. Out of curiosity, what does "chmod 755" do exactly?
  • Reply 36 of 146
    Quote:

    Originally posted by Gabid

    If the Terminal doesn't scare me off I'll give this a run when I get home this evening. Out of curiosity, what does "chmod 755" do exactly?



    chmod is used to change permissions. There are two ways to use it, and chmod 755 is an example of the more cryptic of the two.



    If you treat each digit as three bits in binary, you get this pattern of zeroes and ones:



    111 101 101

    (7) (5) (5)



    The first three bits specify whether the owner should have, in order, permission to read, write, or execute the file. 1 means yes, 0 means no. The second three bits specify whether other people in the owner's "group" should have permission to read, write or execute, and the last three bits specify what permissions everyone else in the world should have.



    By default, in OS X, each new user is in their own "group" by themselves, so the second set of digits don't really matter. In fact, if you're the only one who uses your machine, only the first set matter.



    So, the chmod 755 command:



    1) gives you permission to read the contents of a file, write to it, and execute it like a program.



    2) gives every other account on your system the right to read it or execute it but not to write to it.



    The slightly more readable approach to using chmod allows you to set these settings using easier to remember letters. For example, to allow the owner to execute a file, you would type:



    chmod o+x <filename>



    where <filename> is the name of the file. o+x means "add the eXecute permission to the Owner."



    Most people who change permissions of files a lot in UNIX-like operating systems get used to using the numeric notation because the patterns of numbers become quite familiar. Most programs that you might compile are set to a mode of 755 (or 555 if you want to protect yourself from overwriting them.) Most data files are set to 644. Letting everyone write to something is 777 or 666 (usually a bad idea in case someone breaks into your computer) and letting nobody touch a file for any reason is 000.



    If you were taking a class on UNIX you might spend an entire day or more talking about permissions, so sorry if my brief explanation does not make it entirely clear.



    -- Mark
  • Reply 37 of 146
    EDIT: Mark put it so much better! and beat me \
  • Reply 38 of 146
    gabidgabid Posts: 477member
    Gargoyle and Mark: thank you! It's actually all suprisingly clear. Someday I really need to teach myself UNIX. It's all very interesting though. Again, thanks for the explanations: guess its the price you pay for having a political scientist run G5 benchmarks .
  • Reply 39 of 146
    qaziiqazii Posts: 305member
    Quote:

    Originally posted by lundy

    The output shows they were a few seconds apart. You mean the threads appeared to run sequentially? That could be - nondetached is assumed by this code, and isn't necessarily true for every C implementation.





    Yes. It appeared to run sequentially, and top only showed one thread (i.e. only one processor being used). Any way to get around this? By the way, gcc version is 2.95.3.



    I'll try those 4-proc modifications tonight....
  • Reply 40 of 146
    lundylundy Posts: 4,466member
    Quote:

    Originally posted by qazII

    Yes. It appeared to run sequentially, and top only showed one thread (i.e. only one processor being used). Any way to get around this? By the way, gcc version is 2.95.3.



    I'll try those 4-proc modifications tonight....




    Well, top on the Mac shows only one process, which it is (but the process has two threads), and shows the processor usage from 0% to 200% on a dualie.



    Fixing the sequential thing I'm not really sure what is going on. Let's see what the 4-thread results are. When looking at top, note what it says under the "#TH" (threads) column.
Sign In or Register to comment.