IPP 的FFT測試

來源:互聯網
上載者:User

double雙精確度型複數fft測試

平台:Intel Core(TM)2 Duo CPU E8500 3.16GHz 3.16GHz

4.00GB記憶體  32位win7

ipp測試代碼: 

#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <ipps.h>

/* Maximum value that can be returned by the rand function. */
#ifndef RAND_MAX
#define RAND_MAX 0x7fff
#endif
int main()
{
    double t0;
    unsigned int myOrder,myLength,n;
    int myBufferSize;
    Ipp8u *myBuffer;
    Ipp64fc *myA,*myB;
    IppsFFTSpec_C_64fc *mySpec;
    for (myOrder = 10; myOrder < 22; myOrder++)
    {
        myLength = 1 << myOrder;
        ippsFFTInitAlloc_C_64fc(&mySpec, myOrder, IPP_FFT_NODIV_BY_ANY, ippAlgHintFast);

        myBufferSize = 0;
        ippsFFTGetBufSize_C_64fc(mySpec, &myBufferSize);
        myBuffer = ippsMalloc_8u(myBufferSize);

        myA = ippsMalloc_64fc(myLength);
        myB = ippsMalloc_64fc(myLength);
        for(n = 0; n < myLength; ++n)
        {
            myA[n].re = rand()/RAND_MAX;
            myA[n].im = rand()/RAND_MAX;
        }

        t0=clock();
            ippsFFTFwd_CToC_64fc(myA, myB, mySpec, myBuffer);
        printf("%8.d  %20.10f       /n",myLength,(clock()-t0)/CLOCKS_PER_SEC); 

        ippsFree(myA);
        ippsFree(myB);
        ippsFree(myBuffer);
        ippsFFTFree_C_64fc(mySpec);
    }
    system("pause");
}

 

make命令:

@echo off
rem call "D:/Microsoft Visual Studio 10.0/VC/bin/VCVARS32.BAT"
call "C:/Program Files/Intel/Parallel Studio 2011/ips-vars.cmd"
call "C:/Program Files/Intel/Parallel Studio 2011/Composer/ipp/bin/ippvars.bat"

icl /c /o3 ipptest.c

xilink /subsystem:console ipptest.obj ipps.lib

del *.obj

pause

 

結果:

     n                 time (s)

    1024          0.0000000000
    2048          0.0000000000
    4096          0.0030000000
    8192          0.0000000000
   16384          0.0010000000
   32768          0.0010000000
   65536          0.0030000000
  131072          0.0040000000
  262144          0.0090000000
  524288          0.0190000000
 1048576          0.0470000000
 2097152          0.0900000000
請按任意鍵繼續. . .

//=============================================

ooura_fft  測試:使用fftsg_h.c

#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
/* Maximum value that can be returned by the rand function. */
#ifndef RAND_MAX
#define RAND_MAX 0x7fff
#endif

#ifdef __cplusplus
extern "C" {
#endif
void cdft(int n, int isgn, double *a);
#ifdef __cplusplus
}
#endif

void  initTestData(double  *data,int len)
{
 int i;
 for (i=0;i<len;i++)
 {
  data[2*i]=(double)(rand() % RAND_MAX);
  data[2*i+1]=(double)(rand() % RAND_MAX);
 }

}

void testSpeed_oouraFFT(int maxLen)
{
 int  len,c;
 double k,t,tmp,t0;
 double *data=NULL;
 data =(double *)malloc( (maxLen*2+1)*sizeof(double) );
 if (data==NULL)
  return ;

 printf("    len  /tfft time /n");
 for (len=1024;len<=maxLen;len*=2)
 {
  
  initTestData(data,len);
  t0=clock();
        cdft(len*2,1,data);  
        printf("%8.d  %20.10f       /n",len,(clock()-t0)/CLOCKS_PER_SEC);
 }
    if (data!=NULL)
  free(data);

}
int main()
{
 testSpeed_oouraFFT(2*1048576);
 system("pause");
 return 0;
}

 

make命令:

@echo off
rem call "D:/Microsoft Visual Studio 10.0/VC/bin/VCVARS32.BAT"
call "C:/Program Files/Intel/Parallel Studio 2011/ips-vars.cmd"
icl /c /o3 fftsg_h.c test_speedFFT.c

xilink /subsystem:console test_speedFFT.obj fftsg_h.obj

rem icl /help

del *.obj

pause

 

結果:

    n                   time(s)
    1024          0.0010000000
    2048          0.0000000000
    4096          0.0000000000
    8192          0.0000000000
   16384          0.0000000000
   32768          0.0010000000
   65536          0.0010000000
  131072          0.0060000000
  262144          0.0110000000
  524288          0.0200000000
 1048576          0.0560000000
 2097152          0.1080000000
請按任意鍵繼續. . .

 

 

 

 

 

 

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.