Configuring Intel® Fortran in Microsoft* Visual Studio* to build Intel® MKL Applications

You can use Intel® Visual Fortran Compiler within Microsoft* Visual Studio* Integrated Development Environment (IDE) to develop Fortran applications. The following provides the information for linking your program with Intel® MKL from the Microsoft* Visual Studio* 2012 and Intel® Fortran Compiler.

This article was mainly for the user who transfered from Compaq Visual Fortran to Intel Visual Fortran Compiler.  Some related articles are :

How to build an Intel® MKL application with Intel® Visual FORTRAN Compiler
Compiling and Linking MKL with Microsoft* Visual C/C++*

First, please install Intel® Fortran Compiler for Windows. By default, it will be integrated within one version of Microsoft* Visual Studio* IDE on your machine. Take Microsoft Visual Studio* 2012 and Intel® Visual Fortran Compiler for windows*  as example.

In Microsoft* Visual Studio* environment, compiling and linking Intel® MKL with Intel® Fortan Compiler can be completed quickly by the below steps:

  • Create an Intel FORTRAN Project based on Intel® Math Kernel Library (Intel® MKL).   
    Note: If you open one existing fortran project or original "Compaq Visual Fortran project" in the Visual Studio IDE environment, it can be converted to Intel Fortran project automatically by a prompted window. 

          Here is a Fortran sample project based on Intel® MKL FFT :Package iconDownload

  • From the Visual Studio* IDE main toolbar, select View » Solution Explorer, and make sure this window is active.
  • Select the Project in the Solution Explorer window, and then right-click the mouse and select Properties from the menu.
  • In Properties Pages Windows, select Configuration Properties» Fortran » Libraries , In Use Intel Math Kernal Library item to choose Parallel (/Qmkl:parallel) or Sequential (/Qmkl:sequentail) or Cluster (/Qmkl:cluster).
     

    Then click OK and build the project. In most of case, the setting should be enough for building a Fortran application based on Intel® MKL.

The below steps are optional, which are doing above configuration manually. You should switch off the quick option /Qmkl:xxx if go with the below steps.

  • In Configuration Properties, select Fortran » General, and then in the Additional Include Directories item, add the Intel® MKL header files path as shown in the figure

  • In Configuration Properties, select Linker » General, and then in the Additional Library Directories item, add the Intel® MKL Library path as shown below
  •  
  • Select Linker » Input, and then in Additional Dependencies add the Intel® MKL libraries as shown below(e.g. mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib). Please refer to section Linking Your Application with Intel MKL to find which Intel® MKL libraries are needed in your application.

Note: For Intel® Fortran compiler default setting, the mkl_intel_c[_dll].lib is appropriate library to link. For  Compaq Visual Fortran compiler, mkl_intel_s[_dll].lib is right library to link.

Please read more details from Intel MKL User Guide  =>Using the cdecl and stdcall Interfaces

mkl_intel_s[_dll].lib

Call a routine with the following statement:

extern __stdcall name( <prototype variable1>, <prototype variable2>, .. );

where stdcall is actually the CVF compiler default compilation, which differs from the regular stdcall compilation in the way how strings are passed to the routine. Because the default CVF format is not identical with stdcall, you must specially handle strings in the calling sequence. See how to do it in sections on interfaces in the CVF documentation. 

 
For more complete information about compiler optimizations, see our Optimization Notice.

10 comments

Top
Ying H. (Intel)'s picture

Hi JRBarbosa

The symbol _MOVETO and _LINETO is not from MKL library. You may need to check if some defaut library (looks like a gui support library) from Compaq Visual Fortran or from Intel visual fortran include them, then link the corresponding library into your new project.

Best Regards,
Ying

anonymous's picture

Dear sirs
My programs run fine under Compaq Visual Fortran. Now I am migrating them to Intel Visual Fortran, but the
graphs subroutines, althoug compiled without error, cause link problems like the following:

1>------ Build started: Project: 2012_09_10, Configuration: Debug Win32 ------
1>Linking...
1>drawings.obj : error LNK2019: unresolved external symbol _MOVETO referenced in function _DRAW_CUTAWAY
1>drawings.obj : error LNK2019: unresolved external symbol _LINETO referenced in function _DRAW_CUTAWAY
1>Debug\2012_09_10.exe : fatal error LNK1120: 2 unresolved externals
1>
1>Build log written to "file://J:\Pesquisa\Compressores\Axial\JRB\AxialComp_DP_sigleshaft\otimizacao\geracao_ini_dat\2012_09_10\Debug\BuildLog.htm"
1>2012_09_10 - 3 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I implemented the suggestions given in this sama page, but the errors persist.
Please let me know how to get rid of them.
Many thanks
JRBarbosa

anonymous's picture

Dear sirs
Trying to use Fortran routines, which run fine under Compaq Fortran, I come across with messages like

1>------ Build started: Project: 2012_09_10, Configuration: Debug Win32 ------
1>Linking...
1>drawings.obj : error LNK2019: unresolved external symbol _MOVETO referenced in function _DRAW_CUTAWAY
1>drawings.obj : error LNK2019: unresolved external symbol _LINETO referenced in function _DRAW_CUTAWAY
1>Debug\2012_09_10.exe : fatal error LNK1120: 2 unresolved externals
1>
1>Build log written to "file://J:\Pesquisa\Compressores\Axial\JRB\AxialComp_DP_sigleshaft\otimizacao\geracao_ini_dat\2012_09_10\Debug\BuildLog.htm"
1>2012_09_10 - 3 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I tryed to implement what is suggested in this page, but no success.
Please advise me on how to get rid of this (I hope: simple) problem.
Thanks
JRBarbosa

Naveen Gv (Intel)'s picture

Hi,
Refer to updated article,
Developing an Intel® MKL based application in Microsoft Visual Studio*- a Beginner’s Guide - software.intel.com/file/39725/

pe_rasouliyahoo.com's picture

I am using Intel(R) Visual Fortran Compiler Professional Edition 11.0.066 for Windows* witth visual studio 2008. I try to use ERFC function from MKL library. I did the above steps.

My code is:

------------------------------------
subroutine Gelhar
external vserfc
integer n
real*8 a,y
n = 5
a = 1.5
call vserfc( n, a, y )
return
end
------------------------------------

And I get the following error:

Error 1 error #11017: Cannot open mkl_intel_c.lib;mkl_intel_thread.lib;mkl_core.lib;libiomp5md.lib ipo
Warning 2 warning #11020: unresolved _VSERFC ipo
Warning 3 warning #11020: unresolved _MAIN__ ipo
Error 4 fatal error LNK1181: cannot open input file 'mkl_intel_c.lib;mkl_intel_thread.lib;mkl_core.lib;libiomp5md.lib' LINK

In particular, I used the following libraries to link (ia32):

mkl_intel_c.lib;mkl_intel_thread.lib;mkl_core.lib;libiomp5md.lib

Just to mention thatthe option "Use Intel Math Kernel Library" aslo does not appear in my Property Pages.

Any helps and clue is highly appreciated,

Thanks,
Pejman

anonymous's picture

I am a student

anonymous's picture

this link contains more up-to-date info
(look at chapter 4 and 5)

http://software.intel.com/sites/products/documentation/hpc/mkl/userguides/mkl_userguide_win.pdf

In particular, I used the following libraries to link (ia32):

mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib

good luck ...

Kevin

anonymous's picture

THank you its very discriptive,

but how to check
"First, please make sure that Intel® Fortran Compiler is integrated within the Microsoft* Visual Studio* correctly."

If i am able to run any FORTRAN code in this studio is that conforms the above point ?

Please clarify !!

Thanks in Advance,
Vinayender.

evgeny.shapirogmail.com's picture

Not working for the 11.1 compiler on Vista, with all the directories changed into what is there now. Could you please update!

anonymous's picture

Very instructively!
Thank you!

Add a Comment

Have a technical question? Visit our forums. Have site or software product issues? Contact support.