Developer Reference

Intel® oneAPI Math Kernel Library LAPACK Examples

ID 766877
Date 3/22/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Compiling and Building Fortran Examples

If possible, compile the Fortran examples with the Fortran 90 compiler, because some examples contain Fortran 90 specific features like the ADVANCE specifier in the WRITE statement.

An LAPACK binary defines the appropriate entry point for the LAPACK routine, which is called from the example according to the default Fortran naming convention. For example, to define the dgesv routine on IA-32 architecture, use dgesv_ (lowercase, trailing underscore) on Linux* OS, or _DGESV (uppercase, leading underscore) on Windows* OS.

To compile and build an example:

  1. Run the mklvars script to set the required environment variables.
  2. Build the application using a Fortran 90 compiler as follows:

    <f90> <compiler options> <example.f> <link line>

    where <f90> is a Fortran 90 compiler, <example.f> is any of the oneMKL LAPACK Fortran examples, and <link line> contains linker options and arguments, including the LAPACK library files required for your application.

    See the following example lines for reference:

    • with Intel® Fortran Compiler, you can use

      ifort -mkl cgesv_ex.f on Linux* OS, or

      ifort /Qmkl cgesv_ex.f on Windows* OS.

      See the Linking Your Application with the Intel oneAPI Math Kernel Library section of the oneMKL Developer Guide for more information on linking with the oneMKL.

    • with third-party compilers, you can use

      gfortran -fopenmp -m64 -I${MKLROOT}/include cgesv_ex.f -Wl,--no-as-needed -L${MKLROOT}/lib/intel64 -lmkl_gf_lp64 -lmkl_core -lmkl_gnu_thread -lpthread -lm -ldl to compile with the GNU* Fortran compiler on Linux* OS.

      NOTE:
      The example above is linking dynamically against 64-bit oneMKL library files. To create a custom link line, use the oneMKL Link Line Advisor or refer to the oneMKL Developer Guide, section Linking Your Application with the Intel oneAPI Math Kernel Library.

See Also