注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

随机过程

http://superware.blog.163.com

 
 
 

日志

 
 

Simple example for DFT in intel MKL  

2013-04-24 05:17:23|  分类: 默认分类 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

program dofft
! Fortran example.
! Compile line:
! ifort -mkl /opt/intel/Compiler/11.1/080/mkl/include/mkl_dfti.f90  -O3 tfft.f90 -o tfft
! 1D complex to complex, and real to conjugate-even
Use MKL_DFTI
integer count0,count1,count2,count3,count4, COUNT_RATE, COUNT_MAX
! integer,parameter::mysize=32,mysize2=34
integer,parameter::mysize=13200000,mysize2=13200002
Complex :: X(mysize)
Real :: Y(mysize2)
Real :: rp,cp
integer ic
type(DFTI_DESCRIPTOR), POINTER :: My_Desc1_Handle, My_Desc2_Handle
Integer :: Status
!...put input data into X(1),...,X(mysize); Y(1),...,Y(mysize)
call SYSTEM_CLOCK(COUNT0, COUNT_RATE, COUNT_MAX)
do i = 1,mysize
  x(i) = i*i
  y(i) = i*i
end do

call SYSTEM_CLOCK(COUNT1)
! Perform a complex to complex transform
Status = DftiCreateDescriptor( My_Desc1_Handle, DFTI_SINGLE, DFTI_COMPLEX, 1, mysize )
Status = DftiCommitDescriptor( My_Desc1_Handle )
Status = DftiComputeForward( My_Desc1_Handle, X )
Status = DftiFreeDescriptor(My_Desc1_Handle)

call SYSTEM_CLOCK(COUNT2)
write(*,*) " ! result is given by {X(1),X(2),...,X(mysize)}",mysize
do i=1,32
  write(*,*)x(i)
end do
! Perform a real to complex conjugate-even transform

call SYSTEM_CLOCK(COUNT3)
Status = DftiCreateDescriptor(My_Desc2_Handle, DFTI_SINGLE, DFTI_REAL, 1, mysize)
Status = DftiCommitDescriptor(My_Desc2_Handle)
Status = DftiComputeForward(My_Desc2_Handle, Y)
Status = DftiFreeDescriptor(My_Desc2_Handle)
write(*,*) "! result is given in CCS format.",mysize

call SYSTEM_CLOCK(COUNT4)
ic = 0


do i = 1,34
  if(ic == 0)then
    rp = y(i)
    ic = 1
  else
    cp = y(i)
    write(*,*)rp,cp,sqrt(rp*rp+cp*cp)
    ic=0
  endif
enddo

write(*,*)
write(*,*)"create time      ",real(count1-count0)/real(count_rate)
write(*,*)"complex fft time ",real(count2-count1)/real(count_rate)
write(*,*)"real fft time    ",real(count4-count3)/real(count_rate)
write(*,*)COUNT0, COUNT_RATE, COUNT_MAX

end program


 
  评论这张
 
阅读(80)| 评论(0)
推荐

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018