Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29279 ディスカッション

Can not use f2003 interface for FFTW3

drraug
ビギナー
819件の閲覧回数
Is it possible to use the modern f2003 interface for FFTW3 in Intel Fortran Composer?
The program example is the following
[fortran]program test_fftw3 use,intrinsic :: iso_c_binding implicit none include 'fftw3.f03' integer :: n type(c_ptr) :: fw,bk,ptr,ptc double precision,pointer :: fftr(:) double complex,pointer :: fftc(:) n=2**20 ptr=fftw_alloc_real(int(2*n,C_SIZE_T)); call c_f_pointer(ptr,fftr,[2*n]) ptc=fftw_alloc_complex(int(n+1,C_SIZE_T)); call c_f_pointer(ptc,fftc,[n+1]) fw=fftw_plan_dft_r2c_1d(2*n,fftr,fftc,FFTW_ESTIMATE) bk=fftw_plan_dft_c2r_1d(2*n,fftc,fftr,FFTW_ESTIMATE) do i=1,n fftr(i)=1.d0/dble(i) end do do i=n+1,2*n fftr(i)=0.d0 end do call fftw_execute_dft_r2c(fw,fftr,fftc) call fftw_destroy_plan(fw) call fftw_destroy_plan(bk) call fftw_free(ptr) call fftw_free(ptc) end program[/fortran]
The compilation gives
[bash]draug@fujik:~/work$ uname -a Linux fujik 3.0.0-16-generic #28-Ubuntu SMP Fri Jan 27 17:44:39 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux draug@fujik:~/work$ ifort -V Intel Fortran Intel 64 Compiler XE for applications running on Intel 64, Version 12.1.3.293 Build 20120212 Copyright (C) 1985-2012 Intel Corporation. All rights reserved. FOR NON-COMMERCIAL USE ONLY draug@fujik:~/work$ ifort fftw.f90 fftw.f90(4): error #5102: Cannot open include file 'fftw3.f03' include 'fftw3.f03' ---------^ [/bash]
0 件の賞賛
2 返答(返信)
mecej4
名誉コントリビューター III
819件の閲覧回数
It is certainly possible, but FFTW is a third party package. Intel compilers and MKL come with FFTW-compatible wrappers and interfaces to MKL routines, but you may want to obtain and install the full FFTW, especially if you want to use F9X/F2003 style interfaces. You can build FFTW from source (some posts in these Intel forums have reported doing that) or you may try to obtain a package for your Linux distribution.
Steven_L_Intel1
従業員
819件の閲覧回数
I will comment that the error you saw is that there is no file named fftw.f03 in the include path. You'll need to provide that in order to make any progress. Perhaps you need to use -I to add the path to where this file can be found.
返信