How do I use C with the MKL

How do I use C with the MKL

I am not sure if this is the appropriate place to ask this but I am tired to searching the net.

I want to program in C and use the MKL on a linux system. Would anyone mind telling me the "best" way of doing this. Links to code examples and compiling and installing notes would make me extremely happy.

I have been trying to get CLAPACK and MKL to work together cannot figure out how to do it.

thanks in advance,
Heath

5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

I forgot to mention that I want to use the MKL LAPACK and code in C.

Heath

I wonder if you check this.

http://support.intel.com/support/performancetools/libraries/mkl/win/sb/cs-017282.htm

Intel MKL v6.0 with Microsoft* Visual C++* .NET (v7.0)

  1. Select View >> Solution Explorer (and make sure this window is active).

  2. Select Tools >> Options >> Projects >> VC++ Directories.
  3. In the drop down menu titled Show directories for:, select Include Files, and then type in the directory for the Intel MKL include files (e.g. default: C:Program FilesIntelMKL60include).
  4. In the drop down menu titled Show directories for:, select Library Files, and then type in the directory for the Intel MKL library files (e.g. default: C:Program FilesIntelMKL60ia32lib).
  5. In the drop down menu titled Show directories for:, select Executable Files, and then type in the directory for the Intel MKL executable files (e.g. default: C:Program FilesIntelMKL60ia32in).
  6. On the main toolbar select Project >> Properties >> Linker >> Input and in the "Additional Dependencies" line, add the libraries you require (e.g. mkl_c.lib).

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).

Intel MKL v5.2 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) with Intel MKL V5.2:

  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, as well as mkl_def.lib, mkl_p3.lib, mkl_p4.lib or mkl_itp.lib for tar
    get processor default (Pentium, Pentium Pro, Pentium II), Intel Pentium III processor, Intel Pentium 4 processor, or Itanium processor.

    Note: If you need LAPACK support you must also add mkl_lapack library.

  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 FilesintelMKLia32lib (for the default install location).

I use Linux (with either the gcc or icc compilers) not windows.

Hello Heath,

LAPACK defines a Fortran interface so you have to pay attention to a few details when calling LAPACK functions from a C program:

  1. Fortran is call-by-reference, C is call-by-value
  2. Fortran uses column-major ordering, C is row-major
  3. For best performance,array datapassed to LAPACK must be contiguous in memory.

To compile and link,just include the mkl.h header in your program and link the following libraries:

-lmkl -lmkl_lapack -lvml -lguide -lpthread

Best regards,

Henry

Leave a Comment

Please sign in to add a comment. Not a member? Join today