Community
cancel
Showing results for 
Search instead for 
Did you mean: 
John_Kornak
Beginner
214 Views

Problem linking to MKL libraries on Mac OS X Leopard

Jump to solution
Hello,

I would very much appreciate any help I can get with the following:

I am having trouble linking to the Math Kernel FFT routines. I am using ifort 11.1 with Mac OS X Leopard (recently downloaded as a trial version) on an Intel Duo processor MacBook Pro.

For testing purposes, I am initially trying to compile the 2D fft example in the Intel Math Kernel Refence Manual (July 2010): Example C-10 page 3396 on the command line. However, I am unable to link with the correct library (the F90 Code is at the end of this email). I also have

$MKLROOT = /opt/intel/Compiler/11.1/089/Frameworks/mkl
$MKLPATH = /opt/intel/Compiler/11.1/089/Frameworks/mkl/lib/em64t
$MKLINCLUDE = /opt/intel/Compiler/11.1/089/Frameworks/mkl/include

and these directories all appear to contain appropriate files. (MKLROOT was generated via:
/opt/intel/Compiler/11.1/089/bin/ifortvars.sh intel64)

I have tried various permutations of the following compile line but I always get the same error that it cannot find MKL_DFTI:

MathKernelTest> ifort fft.f90 -L$MKLPATH -I$MKLINCLUDE -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -openmp -lpthread
fft.f90(4): error #7002: Error in opening the compiled module file. Check INCLUDE paths. [MKL_DFTI]
Use MKL_DFTI
----^
fft.f90(13): error #6457: This derived type name has not been declared. [DFTI_DESCRIPTOR]
type(DFTI_DESCRIPTOR), POINTER :: My_Desc1_Handle, My_Desc2_Handle
-----^
---SNIP

I suspect that I may be missing something that would be obvious to the experts on this forum. I hope you can help.

Please let me know if you need any additional information.

Thanks

John

Here is the associated source file fft.f90:

[fortran]PROGRAM ft
! Fortran example.
! 2D complex to complex, and real to conjugate-even
USE MKL_DFTI
INCLUDE 
 ! .. Implicit None Statement ..
 IMPLICIT NONE
Complex :: X_2D(32,100)
Real :: Y_2D(34, 102)
Complex :: X(3200)
Real :: Y(3468)
Equivalence (X_2D, X)
Equivalence (Y_2D, Y)
type(DFTI_DESCRIPTOR), POINTER :: My_Desc1_Handle, My_Desc2_Handle
Integer :: Status, L(2)
!...put input data into X_2D(j,k), Y_2D(j,k), 1<=j=32,1<=k<=100
! Reading in data  
 OPEN(unit=12,file="X.dat",form='binary',status="old") 
  READ(unit=12) X
 CLOSE(unit=12)
 OPEN(unit=13,file="Y.dat",form='binary',status="old") 
  READ(unit=13) Y
 CLOSE(unit=13)
!...set L(1) = 32, L(2) = 100
L(1) = 32
L(2) = 100
!...the transform is a 32-by-100
! Perform a complex to complex transform
Status = DftiCreateDescriptor( My_Desc1_Handle, DFTI_SINGLE,&
DFTI_COMPLEX, 2, L)
Status = DftiCommitDescriptor( My_Desc1_Handle)
Status = DftiComputeForward( My_Desc1_Handle, X)
Status = DftiFreeDescriptor(My_Desc1_Handle)
! result is given by X_2D(j,k), 1<=j<=32, 1<=k<=100
OPEN(unit=1, file="Xft.dat",status="replace",form='binary')
 WRITE(unit=1) X_2D
 CLOSE(unit=1)

! Perform a real to complex conjugate-even transform
Status = DftiCreateDescriptor( My_Desc2_Handle, DFTI_SINGLE,&
DFTI_REAL, 2, L)
Status = DftiCommitDescriptor( My_Desc2_Handle)
Status = DftiComputeForward( My_Desc2_Handle, Y)
Status = DftiFreeDescriptor(My_Desc2_Handle)
! result is given by the complex value z(j,k) 1<=j<=32; 1<=k<=100
! and is stored in CCS format
OPEN(unit=2, file="Yft.dat",status="replace",form='binary')
 WRITE(unit=2) Y_2D
 CLOSE(unit=2)
DEALLOCATE(X_2D,Y_2D)
END PROGRAM ft
[/fortran]

0 Kudos
1 Solution
mecej4
Black Belt
214 Views
1. The compiler will try to

(a) read source, include, module and library files from various directories, and

(b) write module files (if created by the compilation) and objects.

These steps will work only if the user issuing the compile commands has the appropriate permissions. Either login as superuser just for creating the missing modules, or copy the source file into a working directory, create the modules and move them into the MKL directory.

2. The file mkl_dfti.f90 contains only interfaces, and declares two modules. The first module is USED in the second module. There is no point in trying to compile it to make an executable file. Do, after taking care of the file permissions as described in 1. above:

ifort -I$MKLINCLUDE -c mkl_dfti.f90

3. Copy the two modules produced by the previous step to the MKL include directory.

4. Build your application as usual.

View solution in original post

5 Replies
mecej4
Black Belt
214 Views
The source file for the missing/misplaced module files is in the MKL/include directory (on Linux, its name is mkl_dfti.f90). You can compile it, and put the resulting module files (there will be two of them) in the place(s) where the compiler searches for module files during compilation.

Alternatively, you may search for files mkl_dft_type.mod and mkl_dfti.mod, to cover the possibility that these files exist but have been located in an unexpected directory.
John_Kornak
Beginner
214 Views
Thanks for the response. Is there some special way to compile these files? I got errors that again could not find files (it is the same whether or not I add flags.) Sorry if I am just making dumb mistakes here.

include> ifort mkl_dfti.f90 -L$MKLPATH -I$MKLINCLUDE -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -openmp -lpthread
mkl_dfti.f90(25): error #7001: Error in creating the compiled module file. [MKL_DFT_TYPE]
MODULE MKL_DFT_TYPE
-------^
mkl_dfti.f90(226): error #7002: Error in opening the compiled module file. Check INCLUDE paths. [MKL_DFT_TYPE]
USE MKL_DFT_TYPE
------^
mkl_dfti.f90(231): error #7002: Error in opening the compiled module file. Check INCLUDE paths. [MKL_DFT_TYPE]
USE MKL_DFT_TYPE

mecej4
Black Belt
215 Views
1. The compiler will try to

(a) read source, include, module and library files from various directories, and

(b) write module files (if created by the compilation) and objects.

These steps will work only if the user issuing the compile commands has the appropriate permissions. Either login as superuser just for creating the missing modules, or copy the source file into a working directory, create the modules and move them into the MKL directory.

2. The file mkl_dfti.f90 contains only interfaces, and declares two modules. The first module is USED in the second module. There is no point in trying to compile it to make an executable file. Do, after taking care of the file permissions as described in 1. above:

ifort -I$MKLINCLUDE -c mkl_dfti.f90

3. Copy the two modules produced by the previous step to the MKL include directory.

4. Build your application as usual.

View solution in original post

John_Kornak
Beginner
214 Views
Thank you very much!

That worked great.

I really appreciate your help.
John_Kornak
Beginner
214 Views

Hi

I hope to get help on my (lage time-lag) follow up question below.

I upgraded to composer_xe_2013.5.192 and tried to repeat the steps in comment #4 from mecej4.

When I run the command

ifort -I$MKLINCLUDE -c mkl_dfti.f90

I get the following output which mentions undefined references

$ ifort -I$MKLINCLUDE -c mkl_dfti.f90
/opt/intel/composer_xe_2013.5.192/compiler/lib/intel64/for_main.o: In function `main':
/export/users/nbtester/efi2linux_nightly/branch-13_0gt/20130608_000000/libdev/frtl/src/libfor/for_main.c:(.text+0x38): undefined reference to `MAIN__'

When I subsequently try to compile my code I get the following:

I would appreciate if anyone can advise me as to what the problem is and what I should do to fix it?

Thanks, John

$ ifort CGoct3D.f90 -L$MKLPATH -I$MKLINCLUDE -lmkl_solver_lp64_sequential -Wl,--start-group -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -Wl,--end-group -lpthread -fast

ipo: warning #11021: unresolved mkl_dft_commit_node_d_c2c_md_omp
        Referenced in libmkl_core.a(_avx2_dfti_create_dcmd.o)
        Referenced in libmkl_core.a(_avx_dfti_create_dcmd.o).....

and more that I had to cut because the spam filter of the web site would not accept it.

Reply