Using Intel® MKL with IMSL* Fortran numerical library

Submit New Article

Last Modified On :   March 19, 2009 4:25 AM PDT
Rate
 


Overview
This application note illustrates steps to use the latest version of Intel® MKL with IMSL* Fortran Numerical Library Version 6.0.0 on Intel® architecture systems under Microsoft Windows* systems.

The IMSL libraries are a comprehensive set of mathematical and statistical functions that programmers can embed into the software applications. Intel® Math Kernel Library (Intel® MKL) offers highly optimized, extensively threaded math routines for scientific, engineering, and financial applications that require maximum performance. Please refer to Intel MKL website and Visual Numerics IMSL* Fortran Library website for further information.

Intel MKL is included in Intel® Visual Fortran Compiler for Windows* Professional Edition with IMSL*. At the compile time the user can choose to build with a version of the IMSL Library that is linked with Intel MKL in order to gain performance in the areas where Intel MKL has core coverage. For example, once linked, a call to an IMSL Library linear algebra routine will call the Intel MKL linear algebra function, thus benefiting from Intel MKL optimizations for Intel-based hardware.

Downloading
Users can obtain IMSL library or the latest version of Intel MKL in the following ways:

  1. Intel® Visual Fortran Compiler for Windows* Professional Edition with IMSL*
    Intel offers a package that bundles the Intel Visual Fortran Compiler with VNI IMSL. This product can be obtained at: http://www.intel.com/cd/software/products/asmo-na/eng/307757.htm.
  2. Intel Math Kernel Library
    To purchase or download a 30-day evaluation of Intel MKL go to
    http://www.intel.com/cd/software/products/asmo-na/eng/307757.htm.
  3. VNI IMSL(R) Fortran Numerical Library
    http://www.vni.com/products/imsl/fortran/overview.php

This link will take you off of the Intel Web site. Intel does not control the content of the destination Web Site.


This application note applies to the following hardware and software configurations: < ul>
  • Hardware: The hardware need meet the system requirements for both IMSL 6.0 and Intel MKL 10.1. This note has been tested on Intel® Core®2 Duo processors.
  • Software: IMSL* 6.0 and Intel MKL 10.1.

  • Configuration and building

    When building applications with Intel® MKL and IMSL* Fortran numerical libraries, users can choose either from a Fortran Command Prompt Window or in Microsoft* Visual Studio* .Net* Environment. The steps below provide separate instructions for each building choice.

    Building from a Fortran Command Prompt Window
    Users can use the following steps to build their applications with Intel® MKL and IMSL* Fortran Numerical Library in Fortran Command Prompt Window.

    1. Go to a command prompt window in Intel® Visual Fortran Compiler by selecting: Start » All Programs » Intel(R) Software Development Tools » Intel(R) Fortran Compiler 10.0 » Fortran Build Environment for IA-32 (or Intel(R) 64 for 64 bit application)
    2. Set environment for Intel MKL: go to MKL \tool\ environment folder (By default, it is C:\Program files\Intel\MKL\10.1.x.xxx\tools\environment), execute the bash file mklvars32.bat (or mklvarsem64t.bat for Intel 64 application)
    3. Add IMSL library and Intel MKL BLAS functions into linking command by editing file \imsl\fnl600\IA32\bin\IA32.bat for IA-32 application(or \imsl\fnl600\Intel64 \bin\Intel64.bat for Intel 64 bit application) according to your requirement.

      • To link statically for IA-32 application:

        Change:
        SET LINK_FNL_STATIC=imsl.lib imslsuperlu.lib imslscalar.lib imslblas.lib imsls_err.lib imslmpistub.lib
        To:
        SET LINK_FNL_STATIC=imsl.lib imslsuperlu.lib imslscalar.lib mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib imsls_err.lib imslmpistub.lib /link /force:multiple
        Change:
        SET LINK_FNL=%LINK_FNL_SHARED%
        To:
        SET LINK_FNL=% LINK_FNL_STATIC %
      • To link dynamically for IA-32 application:

        Change:
        SET LINK_FNL_SHARED = imslmkl_dll.lib /libs:dll
        To:
        SET LINK_FNL_SHARED = imslmkl_dll.lib mkl_intel_c_dll.lib mkl_intel_thread_dll.lib mkl_core_dll.lib libiomp5md.lib /libs:dll /link /force:multiple
      • To link statically for Intel 64 bit application:

        Change:
        SET LINK_FNL_STATIC=imsl.lib imslsuperlu.lib imslscalar.lib imslblas.lib imsls_err.lib imslmpistub.lib
        To:
        SET LINK_FNL_STATIC=imsl.lib imslsuperlu.lib imslscalar.lib mkl_intel_lp64.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib imsls_err.lib imslmpistub.lib /link /force:multiple
        Change:
        SET LINK_FNL=%LINK_FNL_SHARED%
        To:
        SET LINK_FNL=% LINK_FNL_STATIC %
      • To link dynamically for Intel 64 bit application:

        Change:
        SET LINK_FNL_SHARED = imsl_dll.lib /libs:dll
        To:
        SET LINK_FNL_SHARED = imslmkl_dll.lib mkl_intel_lp64_dll.lib mkl_intel_thread_dll.lib mkl_core_dll.lib libiomp5md.lib /libs:dll /link /force:multiple
    4. Set up the IMSL Fortran Numerical Library environment. Run fnlsetup.bat from a Fortran command prompt window:
      <VNI_DIR>\imsl\fnl600\<ENV>\bin\fnlsetup.bat
    5. Compile and link Fortran applications. The following command will compile and link an application program:
      %F90% %F90FLAGS% <main> %LINK_FNL%

    Building with Microsoft* Visual Stud io .NET 2003 or Microsoft* Visual Studio 2005

    1. Select View » Solution Explorer (and make sure this window is active).
    2. Select Tools » Options » Intel® Fortran » General.
    3. Select Include Files, and then type in the directory for the IMSL* include path (e.g. C:\Program Files\VNI\imsl\fnl600\IA32\include\STATIC) and MKL include path (e.g. C:\Program Files\Intel\MKL\10.1.1.022\include)
    4. Select Library Files, and then type in the directory for the IMSL* library files (e.g. C:\Program Files\VNI\imsl\fnl600\IA32\lib) and MKL library path (e.g. C:\Program Files\Intel\MKL\10.1.1.022\ia32\lib)
    5. Select Executable Files, and then type in the directory for the IMSL* library executable files (e.g. C:\Program Files\VNI\imsl\fnl600\IA32\lib) and MKL path for DLL files (e.g. C:\Program Files\Intel\MKL\10.1.1.022\ia32\bin)

    6. On the main toolbar select Project » Properties » Configuration Properties » Linker » Input and in the " Additional Dependencies" line, add the following IMSL* libraries and Intel MKL library according to your requirement:
      Static link for 32 bit application: imsl.lib imslsuperlu.lib imslhpc_l.lib imsls_err.lib imslmpistub.lib mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib
      Dynamic link for 32 bit application: imslmkl_dll.lib mkl_intel_c_dll.lib mkl_intel_thread_dll.lib mkl_core_dll.lib libiomp5md.lib libguide40.lib
      Static link Intel 64 bit application: imsl.lib imslsuperlu.lib imslscalar.lib mkl_intel_lp64.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib imsls_err.lib imslmpistub.lib
      Dynamic link Intel 64 bit application: imslmkl_dll.lib mkl_intel_lp64_dll.lib mkl_intel_thread_dll.lib mkl_core_dll.lib libiomp5md.lib
    7. On Linker » Command Line, select Additional Options line, add /force:multiple into linking command line options to make linker ignore multiple symbol definition in IMSL and MKL libraries.

    Running the Application
    You can run your applications as you normally would and the applications will use Intel MKL optimized code for your processor.

    A number of functions in Intel MLK are threaded to take advantage of multi-core processors. In order to enabling internal threading within Intel MKL functions, your can set the environment variable OMP_NUM_THREADS to the number of CPUs you want to use at the runtime.

    For further information on MKL threading, please refer to Intel MKL website: Using Intel® MKL with Threaded Applications


    Appendix A - Known Issues and Limitations

    Please refer to “ Known Problems, Limitations, and Differences” part in IMSL* Readme file and “ Known Limitations” part in Intel MKL release notes.

    Appendix B - Verifying Correctness

    IMSL* Fortran Numerical Library provide an example code, which can be used to test the IMSL. The example is located at \examples\validate
    > cd \examples\validate > ifort %F90FLAGS% imslmp.f90 %LINK_FNL% > imslmp.exe

    Please refer to the Readme.txt file at the example directory for further information.


    Appendix C - References

    Operating System:

    Windows* XP Professional x64 Edition, Windows Vista*, Windows Vista* 32, Windows* XP 64-Bit Edition, Windows* XP Professional




    This article applies to: Intel® Math Kernel Library Knowledge Base,   Software Products General