Using Intel® MKL with IMSL* Fortran numerical library

Overview
This application note illustrates steps to use the latest version of Intel® MKL with Intel® Visual Fortran Composer XE 2011 for Windows with IMSL Fortran Numerical Libraries 6.0* on Intel® architecture systems under Microsoft Windows* systems.  It applies only to IMSL as supplied with the product Intel Visual Fortran Composer XE 2011 for Windows with IMSL 6.0.  It does not apply to IMSL obtained in any other way.

The IMSL* Fortran Numerical Libraries from Rogue Wave Software* 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 web page and Intel's IMSL* Fortran Library web page for further information.

Intel MKL is included in Intel® Visual Fortran Composer XE 2011 for Windows* with IMSL*. Some IMSL routines can take advantage of Intel MKL to improve run-time performance. You choose, when you build your application, whether you wish to use the version of IMSL that calls MKL or the version that does not call MKL. 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.

Obtaining the software

Intel Visual Fortran Composer XE 2011 is available in two editions, with IMSL and without IMSL.  Both editions include the latest version of Intel MKL.  Intel does not offer an "upgrade" to add IMSL to an already-purchased product.  For product and "where to buy" information, see the Intel® Composer XE product page.

You can choose to buy the product on DVD (two DVDs are provided), or as an electronic download. Be sure to register your purchase at the Intel® Software Development Products Registration Center to receive notifications of product updates.

Licensing

As of the version included with Intel Visual Fortran Composer XE 2011 for Windows with IMSL 6.0, IMSL has a new End User Licensing Agreement (EULA) which has changed from previous IMSL EULAs.  Separate deployment licenses are now required for any application that uses IMSL.  For more information, read the IMSL FNL 6.0 End User Licensing Agreement and IMSL Licensing Frequently Asked Questions.

Installation

Please see Installing and Using the IMSL* Libraries for instructions on installing IMSL and configuring Visual Studio for IMSL use.

Configuration and Building

There are two ways to specify the set of libraries to link against. One is to use a predefined environment variable on the command line that links the application. The other is to add an INCLUDE line in one of your Fortran sources.  The INCLUDE line method is more convenient and works in both the command line and Visual Studio environments, but you are free to choose whichever method works best for you.

To use the INCLUDE line method, add one of the following two lines to any of your Fortran source files.  The main program is usually the most convenient place.  The line can be added anywhere in a Fortran program unit, but immediately after the PROGRAM, SUBROUTINE or FUNCTION statement is recommended.

INCLUDE 'link_fnl_hpc.h'

or

INCLUDE 'link_fnl_shared_hpc.h'

The line with 'link_fnl_hpc.h' causes the static library form of IMSL and MKL to be linked in.  The line with 'link_fnl_shared_hpc.h' causes the dynamic link library (DLL) form of IMSL and MKL to be linked in.

The environment variable method differs depending on whether you are building from Visual Studio or from the command line.  Both are described below.

Building from Microsoft Visual Studio

First, you must configure the IMSL include and library folders in Visual Studio.  Instructions for doing this are in Installing and Using the IMSL* Libraries.

Once you have configured Visual Studio for IMSL and added the appro[priate INCLUDE line to specify the libraries, you can build normally.

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.

Go to a command prompt window in Intel® Visual Fortran Compiler by selecting:Start » All Programs » Intel Parallel Studio XE 2011 » Command Prompt» Parallel Studio XE with Intel Compiler v12.1 » IA-32 Visual Studio xxxx Mode (or Intel 64 Visual Studio xxxx Mode). This will establish the correct command-line environment for building applications that use IMSL and MKL.
    If you have added an INCLUDE line to select the IMSL libraries, you can build normally with the ifort command. If you wish to use the environment variable method, add one of the two following strings to the end of the command used to link the application:

    %LINK_FNL_HPC%

    or

    %LINK_FNL_SHARED_HPC%

    %LINK_FNL_HPC% will link to the static form of the libraries, %LINK_FNL_SHARED_HPC% will link to the DLL form of the libraries.

    For example:

    ifort myprog.f90 %LINK_FNL_SHARED_HPC%

    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 MKL 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 C - References

    Operating System:

    Windows*

    Optimization Notice

    The Intel® Math Kernel Library (Intel® MKL) contains functions that are more highly optimized for Intel microprocessors than for other microprocessors. While the functions in Intel® MKL offer optimizations for both Intel and Intel-compatible microprocessors, depending on your code and other factors, you will likely get extra performance on Intel microprocessors.

    While the paragraph above describes the basic optimization approach for Intel® MKL as a whole, the library may or may not be optimized to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include Intel® Streaming SIMD Extensions 2 (Intel® SSE2), Intel® Streaming SIMD Extensions 3 (Intel® SSE3), and Supplemental Streaming SIMD Extensions 3 (Intel® SSSE3) instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors.

    Intel recommends that you evaluate other library products to determine which best meets your requirements.

    Per informazioni più dettagliate sulle ottimizzazioni basate su compilatore, vedere il nostro Avviso sull'ottimizzazione.