-
-
Save appleparan/be9eb47be87f5440c8008118492b4f10 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
program FFTWFAIL_IFORT | |
use ISO_C_BINDING | |
implicit None | |
include 'fftw3.f03' | |
integer, parameter :: nxp = 128, nyp = 128, nzp = 128 | |
real(kind=4), dimension(:,:,:), allocatable, target :: test | |
integer :: i, j, k | |
complex(C_DOUBLE_COMPLEX), pointer :: ffttest_c(:, :, :) | |
real(C_DOUBLE), pointer :: ffttest(:, :, :) | |
type(C_PTR) :: p_ffttest_c, p_ffttest | |
integer :: seed | |
integer(8) :: plan_c2r_ffttest | |
real :: rand1, rand2 | |
p_ffttest_c = fftw_alloc_complex(int((nxp/2+1)*nyp*nzp, C_SIZE_T)) | |
p_ffttest = fftw_alloc_real(int(nxp*nyp*nzp, C_SIZE_T)) | |
call c_f_pointer(p_ffttest_c, ffttest_c, [nxp/2+1, nyp, nzp]) | |
call c_f_pointer(p_ffttest, ffttest, [nxp, nyp, nzp]) | |
call system_clock(seed) | |
call srand(seed) | |
do i = 1, nxp | |
do j = 1, nyp | |
do k = 1, nzp | |
call random_number(rand1) | |
call random_number(rand2) | |
ffttest_c(i, j, k) = cmplx(rand1, rand2) | |
end do | |
end do | |
end do | |
call dfftw_plan_dft_c2r_3d(plan_c2r_ffttest, nzp, nyp, nxp, ffttest_c, ffttest, FFTW_ESTIMATE) | |
call dfftw_execute_dft_c2r(plan_c2r_ffttest, ffttest_c, ffttest) | |
call dfftw_destroy_plan(plan_c2r_ffttest) | |
deallocate(ffttest_c) | |
deallocate(ffttest) | |
print *, "fftw alloc success" | |
allocate(test(nxp, nyp, nzp)) | |
deallocate(test) | |
print *, "alloc success" | |
end program |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment