/* thread_fft1.c run 4, hopefully in parallel, fft1test.c */ /* see later, one file, versions time_mp2.c time_mp4.c */ #include #include /* for strerror() */ #include #include #include #include #include "fft.h" #define NTHREADS 4 #define errexit(code,str) \ fprintf(stderr,"%s: %s\n",(str),strerror(code)); \ exit(1); /******** this is the thread code */ void *compute(void * arg) { int myid=*(int *) arg; printf("computing %d\n",myid); fflush(stdout); /* fft1test canned data, timing test */ int i, j, k, m, n; FTYPE *a1, *a2, *b; int sgn = 1; /* default sign is 1 for FFT */ FTYPE PI = 3.141592653589793238462643; FTYPE w; n = 65536; m = 32; w = 2.0*PI/(FTYPE)n; printf("fft1test: allocating space for 4*%d elements\n", n); b = (FTYPE *) malloc( 2*n*sizeof(FTYPE) ); /* complex */ a1 = (FTYPE *) malloc( n*sizeof(FTYPE) ); /* real */ a2 = (FTYPE *) malloc( n*sizeof(FTYPE) ); /* real */ printf(" running %d FFT and IFFT of length %d\n", m, n); for (i=0; i