Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6957 Discussions

Problem with Fortran version Cluster Fast Fourier Transform Compiling

Chen__Yingda
Beginner
404 Views

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)

    call fft2D(psi_in, N, FAILURE)
    if (FAILURE) then
        write(*,*)"fft cal fail"
        STOP 1
    else
        write(*,*)"call success"
    end if

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.
    
    !!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
    
    write(*,*)"N0=",N0
    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
        write(*,*)"STATUS=",STATUS
        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_thread -lmkl_intel_ilp64 \
-lmkl_core -lmkl_blacs_intelmpi_ilp64 -openmp -lpthread
# -lmkl_lapack95_ilp64
OPTIMIZE= -O3
INCLUDEPATH= -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 \
#-I/opt/intel/composer_xe_2011_sp1.11.339/mkl/include/intel64/ilp64 \
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)

 MPI INIT SUCCEED
 Program is running on  2 processes

 N0=           2
 STATUS=           1
 fft cal fail
 MPI INIT SUCCEED
 N0=           2
 STATUS=           1
 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.

0 Kudos
1 Solution
Gennady_F_Intel
Moderator
404 Views

pls try to link with lp64 instead of ilp64 mkl's libs and check if the problem will exist. 

View solution in original post

0 Kudos
3 Replies
Gennady_F_Intel
Moderator
405 Views

pls try to link with lp64 instead of ilp64 mkl's libs and check if the problem will exist. 

0 Kudos
Chen__Yingda
Beginner
404 Views

Gennady F. (Intel) wrote:

pls try to link with lp64 instead of ilp64 mkl's libs and check if the problem will exist. 

Hi Gennady,

this works, lp64 lib works alright. many thx and sorry for replying late

0 Kudos
Chen__Yingda
Beginner
404 Views

Makefile altered as following to solve the issue:

#***********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_thread -lmkl_intel_lp64 \
-lmkl_core -lmkl_blacs_intelmpi_lp64 -openmp -lpthread
# -lmkl_lapack95_lp64
OPTIMIZE= -O3
INCLUDEPATH= -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 \
#-I/opt/intel/composer_xe_2011_sp1.11.339/mkl/include/intel64/lp64 \
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

 

0 Kudos
Reply