Hi all,
I get serve DftiCreateDescriptorDM initialization error in fortran version Cluster FFT functions (while I have no problem with c version compiling with similar code), could someone help me find what's going wrong?
The following code 'test.f90' is simplified after following the cdftf examples.
INCLUDE 'mkl_cdft.f90' program main LOGICAL :: FAILURE integer, parameter :: N=2 complex*16 :: psi(N,N) data ((psi(i, j), i=1,2), j=1,2) /1, 2, 3, 4/ open (unit=15,file='psi.dat') do i = 1, N write (15,*)psi(:,i) end do call fft2D(psi, N, FAILURE) if (FAILURE) then write(*,*)"fft cal fail" STOP 1 else write(*,*)"call success" end if do i = 1, N write (15,*)psi(:,i) end do !pause end program subroutine fft2D(psi_in, N0, FAILURE) USE MKL_CDFT USE MPI !!!!!!MODIFY CORRESPONDINGLY!!!!!! integer, intent(in) :: N0 complex*16, intent(inout) :: psi_in(N0,N0) LOGICAL, intent(out) :: FAILURE !MPI RELATED VARIABLES INTEGER ROOTRANK INTEGER MPI_ERR INTEGER MPI_NPROC INTEGER MPI_RANK INTEGER COMM INTEGER MKL_COMM !pointer to descriptor TYPE(DFTI_DESCRIPTOR_DM), POINTER :: DESC INTEGER STATUS INTEGER LENGTHS(2) FAILURE = .FALSE. write(*,*)"N0=",N0 !!Initiate MPI by calling MPI_Init (Perform MPI initialization) call MPI_INIT ( MPI_ERR ) write(*,*)"MPI INIT SUCCEED" COMM = MPI_COMM_WORLD MKL_COMM = MPI_COMM_WORLD CALL MPI_COMM_SIZE(COMM, MPI_NPROC, MPI_ERR) CALL MPI_COMM_RANK(COMM, MPI_RANK, MPI_ERR) IF (MPI_RANK .EQ. 0) THEN PRINT '(" Program is running on ",I2," processes"/)',MPI_NPROC END IF LENGTHS(1)=N0 LENGTHS(2)=N0 !! Allocate memory for the descriptor by calling DftiCreateDescriptorDM STATUS = DftiCreateDescriptorDM ( COMM, DESC, DFTI_DOUBLE, DFTI_COMPLEX, 2, LENGTHS ) IF (STATUS .NE. DFTI_NO_ERROR) THEN IF (MPI_RANK .EQ. 0) THEN PRINT *, 'TEST FAILED 2' END IF FAILURE = .TRUE. RETURN END IF !! Release memory allocated for a descriptor: Free DftiDM descriptor STATUS = DftiFreeDescriptorDM(DESC) !Finalize MPI CALL MPI_FINALIZE(MPI_ERR) return end subroutine
The Makefile is given below:
#***********MAKEFILE FOR FFT BASED-CALCULATION************* # # Yingda Chen.2018.2.3 # #********************************************************** IFC= /opt/intel/impi/4.1.1.036/intel64/bin/mpiifort OBJECTS= test.o LIBES= -lmkl_cdft_core -lmkl_intel_ilp64 -lmkl_intel_thread \ -lmkl_core -lmkl_blacs_intelmpi_ilp64 -lmkl_lapack95_ilp64 -openmp -lpthread OPTIMIZE= -O3 INCLUDEPATH= -I/opt/intel/composer_xe_2011_sp1.11.339/mkl/include/intel64/lp64 \ -I/opt/intel/composer_xe_2011_sp1.11.339/compiler/include \ -I/opt/intel/composer_xe_2011_sp1.11.339/mkl/include \ -I/opt/intel/impi/4.1.1.036/intel64/include LIBPATH= -L/opt/intel/composer_xe_2011_sp1.11.339/mkl/lib/intel64 \ -L/opt/intel/composer_xe_2011_sp1.11.339/compiler/lib/intel64 \ -L/opt/intel/impi/4.1.1.036/intel64/lib test : $(OBJECTS) $(IFC) $^ -o $@ $(INCLUDEPATH) $(LIBPATH) $(LIBES) $(OPTIMIZE) test.o : test.f90 $(IFC) -c $^ $(INCLUDEPATH) $(OPTIMIZE) .PHONY : clean cleanobj cleanmod clean : cleanobj cleanmod $(RM) test cleanobj : $(RM) *.o cleanmod : $(RM) *.mod
The results turn out to be: (using mpirun with 2 cores)
N0= 2 N0= 2 MPI INIT SUCCEED MPI INIT SUCCEED Program is running on 2 processes fft cal fail TEST FAILED 2 fft cal fail
I further check the variable STATUS, it returns 1, indicating some allocation error, however STILL CAN'T FIGURE OUT why this appears since this initialization only involve with some official declarations such as MPI_COMM_WORLD, DM type pointer as well as dimension info.
I have spent a couple of days dealing with this Cluster version of FFT functions, just hope to speed up the FFT calling (while the sequential version is working all right), so MANY MANY THANKS FOR HELPING ME DEALING WITH THIS ISSUE.