Math Kernel Library Developer Guide

Using the Command-line Link Tool

Use the command-line Link tool provided by Intel® oneAPI Math Kernel Library to simplify building your application with Intel® oneAPI Math Kernel Library.

The tool not only provides the options, libraries, and environment variables to use, but also performs compilation and building of your application.

The tool mkl_link_tool is installed in the <mkl_directory>/bin/<arch> directory, and supports the modes described in the following table.

Intel oneMKL Command-line Link Tool Modes
Mode Description Usage Example

Inquiry

The tool returns the compiler options, libraries, or environment variables necessary to build and execute the application.

Get Intel® oneAPI Math Kernel Library libraries

mkl_link_tool -libs [Intel oneMKL Link Tool options]

Get compilation options

mkl_link_tool -opts [Intel oneMKL Link Tool options]

Get environment variables for application executable

mkl_link_tool -env [Intel oneMKL Link Tool options]

Compilation

The Intel® oneAPI Math Kernel Library Link Tool builds the application.

mkl_link_tool [options] <compiler> [options2] file1 [file2 ...]

where:

  • options represents any number of Link Tool options
  • compiler represents the compiler name: ifort, icc (icpc, icl), cl, gcc (g++), gfortran, pgcc (pgcp), pgf77 (pgf90, pgf95, pgfortran), mpiic, mpiifort, mpic (mpic++), mpif77 (mpif90, mpif95), dpcpp
  • options2 represents any number of compiler options

Interactive

Allows you to go through all possible Intel® oneAPI Math Kernel Library Link Tool supported options. The output provides libraries, options, or environment variables as in the inquiry mode, or a built application as in the compilation mode (depending on what you specify).

mkl_link_tool -interactive

Use the -help option for full help with the Intel® oneAPI Math Kernel Library Link Tool and to show the defaults for the current system.