poor performance between a dual ppc970 and a p3 laptop

davis davis at skink.net
Thu Mar 18 07:34:50 EST 2004


Hello

I am trying to understand why the code below runs so poorly on a Dual 970 1.6Ghz
compared to a P3 700Mhz Laptop.  I have tried using a different compiler and
I get similar results.  I am beginning to think the 970 is somehow configured
wrong in some way.

Summary:
	computer			-O1 time	gcc version
	p3 700 Mhz			30 secs		3.3.3 (stock debian unstable)
	dual 970 1.6Ghz		26 secs		3.2	(stock suse 8)
	dual 970 1.6Ghz		27 secs		3.4 (i built using Janis's script)

Kernel Levels:
	Linux gpul-01 2.4.21-147-pseries64 #1 SMP
	Linux tadpole 2.4.22-pre2 #14



Details:

p3 700Mhz
256 KB cache
----
l3$ gcc -v
Reading specs from /usr/lib/gcc-lib/i486-linux/3.3.3/specs
Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-debug --enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc i486-linux
Thread model: posix
gcc version 3.3.3 20040125 (prerelease) (Debian)
---
real    0m31.737s
user    0m30.760s
sys     0m0.070s





processor       : 0
cpu             : PPC970
clock           : 1600MHz
revision        : 2.2

processor       : 1
cpu             : PPC970
clock           : 1600MHz
revision        : 2.2

timebase        : 199836808
machine         : CHRP IBM,884221X
-----
eading specs from /home/davis/testy/lib/gcc/powerpc-linux/3.4.0/specs
Configured with: /home/davis/gcc/gcc-3.4-20040310/configure --prefix=/home/davis/testy --build=powerpc-linux --host=powerpc-linux --target=powerpc-linux --enable-languages=c --disable-nls --disable-multilib --disable-checking
Thread model: posix
gcc version 3.4.0 20040310 (prerelease)
---
real    0m27.219s
user    0m25.560s
sys     0m0.060s


and using a different compiler...
----
Reading specs from /usr/lib/gcc-lib/powerpc-suse-linux/3.2/specs
Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib --enable-languages=c,c++,f77,objc,java,ada --enable-libgcj --with-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib --with-system-zlib --enable-shared --enable-__cxa_atexit powerpc-suse-linux
Thread model: posix
gcc version 3.2
---
real    0m26.353s
user    0m25.670s
sys     0m0.040s


----------------------------------------------
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>

float foo = 5.0;
float goo = 2.3;
float cig = 7.3;
float gar = 4.2;
float car = 9.8;

#define array_size 14000

float big_array[array_size];
float small_array[array_size];


void someFun(float var1, float var2, float fY, float fX) {

    int iY, iX, iN;
    float temp;

    for (iY=0; iY<500 ;iY++) {

        fY = iY*goo + fY - foo/2.0;
        temp = (fY*var1+cig)/gar + car;

        for(iX=0; iX<array_size; iX++) {

            iN = iX*goo + fX - foo/2.0;
            iN = (iN>array_size)? array_size : iN;
            iN = (iN<0)? 0 : iN;

            big_array[iX] = big_array[iX] + iN*small_array[iN];
        }
    }
}


void main(void) {

    int i;
    float fY = 2.3;
    float fX = 1/2.3;

    for (i=0; i<array_size; i++) {
        big_array[i] = (float)(i*i);
    }

    for (i=0; i<array_size; i++) {
        small_array[i] = (float) i;
    }

    for (i=0; i<50; i++) {
        someFun(0.5, 99.0, fY*i, fX*i*2);
    }
    for (i=0; i<array_size; i++) {
        printf("%f\n",big_array[i]);
    }
}
--------------------------------

OBJ_DIR=objs
#CC=/home/davis/testy/bin/gcc
CC=gcc
PROFILE=false
# 0 is none. 3 is max.
OPT_LEVEL=1
ifeq ($(PROFILE),true)
        CFLAGS=-Wall -O$(OPT_LEVEL) -g -pg
        LINKFLAGS= -lc_p -lm_p -pg
else
        CFLAGS=-Wall -O$(OPT_LEVEL) -g
        LINKFLAGS= -lm
endif
.SUFFIXES: # delete the default suffixes

% : $(OBJ_DIR)/%.o
        $(CC)  -o $@ $^ $(LINKFLAGS)
        chmod ugo+x $@

$(OBJ_DIR)/%.o : %.c bckp.h
        $(CC) $(CFLAGS) -c -o $@ $<


EXES = bckp testy


all: $(OBJ_DIR) $(EXES) $(OBJS)

clean:
        - rm $(EXES)
        - rm -rf objs
$(OBJ_DIR):
        mkdir $(OBJ_DIR)






--
Happy Trails

John F. Davis
ABC #6334 1992 R100GSPD                                  Durham, North Carolina
http://www.skink.net

** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc64-dev mailing list