Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

cxml/dfft2d

frodemar
Beginner
732 Views
Hi,

I get a run-time error when using either dfft2d/dfft_2d. The error appears when I deallocate the (in or) out matrix. E.g. status=0 when exiting from dfft2d. However, when I comment out the dfft2d-call deallocate works fine.

here is my setup:
n1 = 64; n2 = 128 ! n1=512,n2=1024 gives ACCESS VIOLATION inside dfft2d!!??
real, allocatable :: y(:,:) ! Physical field
complex, allocatable :: x(:,:) ! Fourier amplitudes
allocate(y(0:n1+1,0:n2-1))
allocate(x(0:n1/2,0:n2-1))
! Are the dimensions of x and y correct??? rows in x are not 2^n
status=dfft_2d('C','R','B',x,y,n1,n2,n1+2,1,1)
deallocate(y) ! Fails even if x=0 all over

The debugger stops with:
HEAP[mkensemble.exe]: Heap block at 03838588 modified at 038409C0 past requested size of 8430
While CTRL+F5 gives access violation.

I got a feeling that dfft2d doesn't like the sizes of x and y? (Array bounds checking is turned on).

The code is downloaded from the net, and has been working on DEC/dxml previously (some years ago I believe?)

Any hints are most welcome!!! The cxml-manual gives no clues for me(?).
Kind regards,
Frode
0 Kudos
2 Replies
frodemar
Beginner
732 Views
Here is a simpler case that I cannot run either (stops with access violation in call to dfft_apply_2d.

Could it be that my compiler has problems with dfft_apply_2d being a function and not a subroutine? Hmm..

program testfft
INCLUDE 'CXML_INCLUDE.F90'
!INCLUDE 'DXMLDEF.FOR'
integer n1,n2
integer status
record /dxml_d_fft_structure_2d/ fft_struct
real, allocatable :: y(:,:) ! Physical field
complex, allocatable :: x(:,:) ! Fourier amplitudes
n1 = 64
n2 = 128
allocate(y(n1,n2))
allocate(x(n1,n2))
! Initialize FFT
status = dfft_init_2d(n1,n2,fft_struct,.true.)
if (status /= 0) print *,'_WIN32 : Error in FFT_INIT, status=',status
x = 0.0
y = 0.0
! Do inverse FFT
status=dfft_apply_2d('C','R','B',x,y,n1+2,fft_struct,1,1)
! status=dfft_2d('C','R','B',x,y,n1,n2,n1+2,1,1)
if (status /= 0 ) print *,'_WIN32 : Error in dfft_apply_2d, status=',status
deallocate(x)
deallocate(y)
end program testfft
0 Kudos
frodemar
Beginner
732 Views
Problem solved : Inconsistent data types. Changed all calls from dfft... to sfft...

Frode
0 Kudos
Reply