- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've the following fortran code:
PROGRAM test
Use MKL_DFTI
IMPLICIT NONE
INTEGER, PARAMETER :: ngp=512
COMPLEX(16) A(ngp)
INTEGER i
DO i=1, ngp
A(i)=i
ENDDO
DO i=1,100
CALL transform(A,ngp)
ENDDO
END
!=============================================================================
SUBROUTINE transform(A, ngp)
Use MKL_DFTI
IMPLICIT NONE
INTEGER :: ngp
COMPLEX*16 A(ngp)
type(DFTI_DESCRIPTOR), POINTER :: punt
INTEGER status
status=DftiCreateDescriptor(punt,DFTI_DOUBLE,DFTI_COMPLEX,1,ngp)
status=DftiCommitDescriptor(punt)
status=DftiComputeForward(punt,A)
status=DftiComputeBackward(punt,A)
A=A/ngp
status = DftiFreeDescriptor(punt)
END
If instead of doing this I create and commit the descriptor in the main program, and then I pass the pointer "punt" to the subroutine I get a Segmentation Fault. Is there any way to create the descriptor just once in the program and use it every time I call the subroutine? or is this the only way to do it?
PROGRAM test
Use MKL_DFTI
IMPLICIT NONE
INTEGER, PARAMETER :: ngp=512
COMPLEX(16) A(ngp)
INTEGER i
DO i=1, ngp
A(i)=i
ENDDO
DO i=1,100
CALL transform(A,ngp)
ENDDO
END
!=============================================================================
SUBROUTINE transform(A, ngp)
Use MKL_DFTI
IMPLICIT NONE
INTEGER :: ngp
COMPLEX*16 A(ngp)
type(DFTI_DESCRIPTOR), POINTER :: punt
INTEGER status
status=DftiCreateDescriptor(punt,DFTI_DOUBLE,DFTI_COMPLEX,1,ngp)
status=DftiCommitDescriptor(punt)
status=DftiComputeForward(punt,A)
status=DftiComputeBackward(punt,A)
A=A/ngp
status = DftiFreeDescriptor(punt)
END
If instead of doing this I create and commit the descriptor in the main program, and then I pass the pointer "punt" to the subroutine I get a Segmentation Fault. Is there any way to create the descriptor just once in the program and use it every time I call the subroutine? or is this the only way to do it?
Link Copied
0 Replies

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page