[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference rusure::math

Title:Mathematics at DEC
Moderator:RUSURE::EDP
Created:Mon Feb 03 1986
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:2083
Total number of notes:14613

1775.0. "FFT AOSF benchmark fails to run" by TAV02::KATZAV () Fri Jul 16 1993 12:58

 Also posted in ALPHA_OSF_IFT & DECC
    
 Attached are two file cdefs.c and fft100k.c that represents a benchmark.
 The fft100k.c is taken from a mathematical recepies book, it runs fine
 on DECstation & SUN, but fails to run on alpha/OSF.

 The problem is in the line:

                                tempr=wr*data[j]-wi*data[j+1];

 with the current defenitions we fail on CVTTS.
 when we changed it to double we failed on multiply.


 Could someone help me on that ???
 if someone wants to run it, please extract bothe files , compile fft100k.c
 and run.

 Thanks,
 Shimon




this is cdefs.h


#define loopv(X,Y,v) {for(v=X; v<=Y; v++) { 
#define loop1(X,Y) {int tmp_var1; for(tmp_var1=X; tmp_var1<=Y; tmp_var1++) { 
#define loop(X,Y) {int tmp_var; for(tmp_var=X; tmp_var<=Y; tmp_var++) { 
#define endloop }}
#define put_EOL printf("\n")
#define repeat do
#define until(X) while(!(X))
#define Cases_of(X) switch((X)){
#define End_of_cases break;default: break;}
#define If(X) if((X)){
#define Endif }
#define Else }else{
#define When break;case
#define TRUE 1
#define FALSE 0






This is fft100k.c .

#include <stdio.h>
#include <math.h>
#include "cdefs.h"
#define fftPnt 128
#define numfft 100000
#define rand_m (256.0 * ((float)rand()/(0x7fffffff)))
void fft();
main()
{
    int width;
    int i,j,k;
    float in_data[256];
    float data[256];
    unsigned long nn = fftPnt;

    loopv(0,127,i)
       in_data[i] = rand_m;
    endloop

    printf("Computing fft %d times...\n",numfft);
    loopv(1,numfft,i)
       loopv(0,127,k)
          data[k] = in_data[k];
       endloop
       fft(data,nn);
    endloop
}
 
#define SWAP(a,b) tempr=(a);(a)=(b);(b)=tempr
void fft(data, nn)
float *data;
unsigned long nn;
{
        unsigned long n,mmax,m,j,istep,i;
        double wtemp,wr,wpr,wpi,wi,theta;
        float tempr,tempi;
 
        n=nn << 1;
        j=1;
        for (i=1;i<n;i+=2)
        {
                if (j > i)
                {
                        SWAP(data[j],data[i]);
                        SWAP(data[j+1],data[i+1]);
                }
                m=n >> 1;
                while (m >= 2 && j > m)
                {
                        j -= m;
                        m >>= 1;
                }
                j += m;
        }
        mmax=2;
        while (n > mmax)
        {
                istep=mmax << 1;
                theta=6.28318530717959/mmax;
                wtemp=sin(0.5*theta);
                wpr = -2.0*wtemp*wtemp;
                wpi=sin(theta);
                wr=1.0;
                wi=0.0;
                for (m=1;m<mmax;m+=2)
                {
                        for (i=m;i<=n;i+=istep)
                        {
                                j=i+mmax;
                                tempr=wr*data[j]-wi*data[j+1];
                                tempi=wr*data[j+1]+wi*data[j];
                                data[j]=data[i]-tempr;
                                data[j+1]=data[i+1]-tempi;
                                data[i] += tempr;
                                data[i+1] += tempi;
                        }
                        wr=(wtemp=wr)*wpr-wi*wpi+wr;
                        wi=wi*wpr+wtemp*wpi+wi;
                }
                mmax=istep;
        }
}

T.RTitleUserPersonal
Name
DateLines
1775.1y3D::ROTHGeometry is the real life!Fri Jul 16 1993 13:533
    I entered an erroneous reply to this and just deleted it...

    - Jim
1775.2Solution in DECC #277TAV02::KATZAVSun Jul 18 1993 03:385
    
    Solved in DECC # 277.
    
    Thanks,
    Shimon.