This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

How to use MKL with cygwin.


When I attempted to link my cygwin compiled binary with MKL, Intel Math
Kernel Library, dlls,
I could not find any information from the Internet.
It might be, but I just couldn't. If someone knows the place of
proper instruction. Please let me know.
This time, I just post this for the others convenience.

This is what I did to link cygwin compiled binary with MKL dlls.
I'm not sure all of the functions MKL provided work well in this way. I just
tested a few functions I needed to use.

You need DUMPBIN.EXE and the other programs and dlls called by DUMPBIN.
These are parts of MS Visual Studio.

The following instruction will make the import library for mkl_p3.dll.
You will need to make mkl_lapack32.a and mkl_lapack64.a to use LAPACK
functions.

1. Obtain the list of exported symbols
  DUMPBIN /EXPORTS mkl_p3.dll > mkl_p3.def

2. Edit the def as proper .def.
  Input "EXPORTS" at the top.
  remove all word except mkl_funcname.
  like this.

--------------
EXPORTS

mkl_caxpy
mkl_caxpyi
mkl_ccopy
....
--------------

3. Create the import library
  dlltool --def mkl_p3.def --dllname mkl_p3.dll --output-lib mkl_p3.a

At this point, you can call mkl_funcname functions form your c program.
To link with FORTRAN, you have to make wrapper programs like this.

void sgemm_(char *transa,char *transb,int *m,int *n,int *k,float
*alpha,float *a,int *lda,float *b,int *ldb,float *beta,float *c,int *ldc) {
  mkl_sgemm(transa,transb,m,n,k,alpha,a,lda,b,ldb,beta,c,ldc);
}

Because FORTRAN needs trailed '_' and mkl provides headed 'mkl_' for
symbols.

To replace libf77blas.a or liblapack.a.
Something more should be done.
I myself have not done it.
If someone successfully made the replaceable library.
Please let me know. Thank you.

References
Intel Math Kernel Library 5.1 User Notes
MSDN Knowledge Base: HOWTO:Create 32-bit Import Libraries Without .OBJs or
Source
Cygwin User's Guide: Building and Using DLLs



Takashi


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]