Forum Jump

Select Group :
Select Forum :
Sorted By :
Sort Order :
From The :
 
Thread Tools  Search this thread 
Ying H (Intel)
Total Points:
4,882
Status Points:
4,382
Brown Belt
June 29, 2009 12:22 AM PDT
How to use MKL in MSVC 2005(Intel Fortran)
Dear ALL,

I noticed some users have probelms when use MKL in MSVC 2005(Intel Fortran).  I upload a MSVC 2005 project (Intel fortran 11.0.0.074 IA32) for your reference.

Some notable things:

1) which kind of application: ia32, em64t or ia64 application.
you may  make sure which target machine you need your application run on?
ia32: 32 bit application. 
em64t: Intel 64 bit application
IA64:  Intel Itanium 64bit application.

For example, most of us may build ia32 or em64t application on a xeon machine with windows*. Then in MSVC environment, Check the project configuration manager=> active platform. 
They are "ia32" or "X64" (which is corresponding to em64t).

2. Which MKL library you need link into.

Here is FAQ about how to use MKL in MSVC . You may add the include path, library path as the article show.

But about library path, as above, you need enter rigth directory:
they
<MKL install dir>\ia32,  for ia32 application
<MKL install dir>\em64t, for X64 application
<MKL install dir>\em64t, for IA64 application
they can't be mixed

Aboub the library you need. There are many libraries under MKL lib directory. Which one you needs?

We have on-line KB article Intel® Math Kernel Library Link Line Advisor  After choose it, you can get which libraries you need to list. 

In general, mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib are enough for any ia32 windows application.

3. About CVF support, 
CVF and Intel Fortran compiler use different call convention by default:
CVF: stdcall
Intel Fortran,C Compiler:  cdecl (default interface of the Microsoft Visual C* application)

MKL support both of them on ia32 platform, but if you are porting from CVF to intel Fortran, you may take care the required library: mkl_intel_s or mkl_intel_c.lib

  • Using the CVF compiler
     the CVF compiler will link with mkl_intel_s[_dll].lib if routines are
    compiled with the default interface. However, if you compile with the option
    /iface=(cref,nomixed_str_len_arg), the compiler will link with
    mkl_intel_c[_dll].lib .

· Using the Intel® Fortran compiler

The Intel Fortran compiler will link with mkl_intel_c[_dll].lib by default. If the
/Gm option is used, call mkl_intel_s[_dll].lib (/Gm enables CVF and Powerstation
calling convention compatibility, so does /iface:cvf).

Additionally, if you are porting CVF application to X64 or IA64 platform with Intel Fortran compiler and MKL. Please note, MKL don't provide  em64t and IA64 CVF interface support. So you must to link mkl_intel_lp64|ilp64, mkl_intel_thread, mkl_core. and remove the compiler option  /Gm or /iface:cvf.

4. Regarding Lapack95, blas95 interface library usage, we may discuss it later if you have interest.

Best Regards,
Ying

 Attachments 
tim18
Total Points:
66,397
Status Points:
66,397
Black Belt
June 29, 2009 7:43 AM PDT
Rate
 
#1
You might point out, since Intel 11.0 compilers (and ifort 10 professional), there is an integrated MKL installation option.  This avoids the necessity for separate settings of MKL path, and ensures that the MKL architecture choice matches the compiler.  It implies also that MKL updates are distributed in compiler updates.


Ying H (Intel)
Total Points:
4,882
Status Points:
4,382
Brown Belt
June 30, 2009 8:44 PM PDT
Rate
 
#2 Reply to #1

Hi Tim,  

Thank you for the message. Right, the recent MKL version have provided a "build" menu in MSVC environment. Click one button, all of environment setting and required library are ready in your project. (as below image).

mkl_Integrated.JPG

mkl_setting.JPG

But unfortuntely, the feature is not avaiable in current Intel Fortran Compiler.  You may add/claim library path; add/claim header path manually.

For use LAPACK95, BLAS95 interface,   the new MKL version 10.2 (you can upgrade the latest intel compiler to see it also ) contains the precompiled interface libraries and the corresponding precompiled interface modules for BLAS95 and LAPACK95 precompiled interface modules for BLAS95 and LAPACK95 in install package.
See <http://software.intel.com/en-us/articles/blas-and-lapack-fortran95-mod-files/>
So we don't trouble to build them by ourselves.

Please note: as the interface libraries are not MKL standard library,  so the "one button" integration don't support it.  You may add them manually if you are using the interface,
in details,
1. <project name> > Properties > Configuration Properties > C++ > General Additional Include Directories property is appended with <mkl directory>\include
add C:\Program Files\Intel\MKL\10.2.0.014\include\ia32,
Please keep existing path, i.e: C:\Program Files\Intel\MKL\10.2.0.014\include

2. The <project name> > Properties > Configuration Properties > Linker >Input> Additional Dependencies
add mkl_lapack95.lib|mkl_blas95.lib 
Please keep existing library, i.e mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib mkl_solver.lib libiomp5md.lib 

Best Regards,
Ying



Intel Software Network Forums Statistics

8285 users have contributed to 31229 threads and 99107 posts to date.
In the past 24 hours, we have 11 new thread(s) 45 new posts(s), and 61 new user(s).

In the past 3 days, the most popular thread for everyone has been comparison cilk++, openmp, pthreads first results The most posts were made to comparison cilk++, openmp, pthreads first results The post with the most views is Very amusing...  Escalated as

Please welcome our newest member tvinni