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

Linking Intel MKL libraries with VC++ applications

sudeesh_thatha
Beginner
670 Views
I am looking for information about the procedures, for using MKL libraries in my VC++ application (linking, sample code snippets etc). I would be very grateful, if someone could provide me pointers.
OS : Windows 2000
Processor : Pentium IV
Visual Studio Ver 6.0
Multithreaded application
Some places we use ATL-COM technology
0 Kudos
2 Replies
phil_flanner
Beginner
671 Views

There are any number of ways to link to / use the MKL.I chose to wrap all MKL calls withmy own classes and functions defined inside a single DLL, and static link MKL into that DLL, which has the advantages:

  • do not have to redistribute any Intel SW components
  • can easily switch (e.g., to NAG, IMSL, newer MKL) by substituting a new wrapper DLL
  • only link in the routines actually used

I use the Fortran-style MKL routines, but do not use the Intel supplied header files, instead creating my own header with modified versions of the prototypes I need, because Intel's:

  • are not const-correct
  • use MKL-specific complex type
  • are uncommented

For example, zgemm() is defined in Intel's mkl_blas.h as:

void zgemm(char *transa,char *transb,int *m,int *n,int *k,MKL_Complex16 *alpha,MKL_Complex16 *a,int *lda,MKL_Complex16 *b,int *ldb,MKL_Complex16 *beta,MKL_Complex16 *c,int *ldc);

In my header file, it is declared with const where applicable, and commented (see attached file)

An outline of the steps to link and use MKL is then:

1) Add prototypes of the required routines to my header, a skeleton of which looks like the attached MyMKL.h

2)Copy the MKL library files libguide.lib, mkl_c.lib, mkl_ia32.lib and mkl_lapack.lib, from ia32lib into my project Release (and Debug) directory

3) Add mkl_c.lib into the VC++6.0 Project Settings: Link: Object/library modules.

4) Write the wrapper functions that call the MKL routines (an example is appended to the attached file)

0 Kudos
Wendy_Doerner__Intel
Valued Contributor I
671 Views
We have a couple of resources that might help you when linking Intel MKL libraries with Microsoft* VC++ applications:
1) We have Technical User Notes in the MKL61docmkluse.htm file with your installation. There is a description of how to link Intel MKL and example link lines.
2) We have examples that ship with Intel MKL that show how to link and run with Intel MKL. They are in the MKL61examples directory organized by application area.
3) Another resource is our support site, at support.intel.com. One posting there of particular interest is this excerpt:
Intel MKL v6.0 with Microsoft* Visual C++* (v6.0)
In Project Settings, add the location (path) of Intel MKL sub-library in the link properties, for example, in Microsoft* Visual Studio* / Microsoft Visual C++ (v6.0):
  1. Select Project Settings.

  2. Select the Link tab.

  3. In the Category drop-down menu, select Input.

  4. In the Object/library modules section add mkl_c.lib or mkl_s.lib for static cdecl or CVF (respectively) interface libraries (mkl_c_dll, mkl_s_dll for dynamic interface libraries). The other libraries (LAPACK, BLAS, etc.) are identified as default libraries within the interface library and cause the linker to automatically link appropriately. The processor type is determined at runtime.

  5. You must also add the library path to the location of these libraries. In the Additional library path section, add the location of the Intel MKL sub-libraries. For example, on an IA32 system, you would add C:Program FilesintelMKL60ia32lib (for the default install location)

from the URL:

As always, if you are having difficulty please register and submit issues at premier.intel.com where I or one of my team members would be happy to help you.
0 Kudos
Reply