pub struct Library {
    pub config: Config,
    pub include_dir: PathBuf,
    pub library_dir: PathBuf,
    pub iomp5_static_dir: Option<PathBuf>,
    pub iomp5_dynamic_dir: Option<PathBuf>,
}
Expand description

Found MKL library

use std::str::FromStr;
use intel_mkl_tool::{Config, Library};

let cfg = Config::from_str("mkl-static-lp64-iomp").unwrap();
if let Ok(lib) = Library::new(cfg) {
    lib.print_cargo_metadata().unwrap();
}

Fields

config: Configinclude_dir: PathBuf

Directory where mkl.h and mkl_version.h exists

library_dir: PathBuf

Directory where libmkl_core.a or libmkl_core.so exists

iomp5_static_dir: Option<PathBuf>

Directory where libiomp5.a or corresponding file exists

  • They are not required for mkl-*-*-seq and mkl-dynamic-*-iomp cases, and then this is None.
  • Both static and dynamic dir can be Some when openmp-strict-link-type feature is OFF.
iomp5_dynamic_dir: Option<PathBuf>

Directory where libiomp5.so or corresponding file exists

  • They are not required for mkl-*-*-seq cases and mkl-static-*-iomp, and then this is None.
  • Both static and dynamic dir can be Some when openmp-strict-link-type feature is OFF.

Implementations

Find MKL using pkg-config

This only use the installed prefix obtained by pkg-config --variable=prefix

$ pkg-config --variable=prefix mkl-static-lp64-seq
/opt/intel/mkl

Then pass it to Self::seek_directory.

Limitation

This will not work for mkl-*-*-iomp configure since libiomp5.{a,so} will not be found under the prefix directory of MKL. Please use $MKLROOT environment variable for this case, see Self::new for detail.

Seek MKL libraries in the given directory.

  • This will seek the directory recursively until finding MKL libraries, but do not follow symbolic links.
  • This will not seek directory named ia32*
  • Retuns Ok(None) if libiomp5.{a,so} is not found with mkl-*-*-iomp configure even if MKL binaries are found.

Seek MKL in system

This try to find installed MKL in following order:

  • Ask to pkg-config
  • Seek the directory specified by $MKLROOT environment variable
  • Seek well-known directory
    • /opt/intel for Linux
    • C:/Program Files (x86)/IntelSWTools/ and C:/Program Files (x86)/Intel/oneAPI/ for Windows

Found MKL version parsed from mkl_version.h

mkl_version.h will define

#define __INTEL_MKL__ 2020
#define __INTEL_MKL_MINOR__ 0
#define __INTEL_MKL_UPDATE__ 1

and this corresponds to (2020, 0, 1)

Print cargo:rustc-link-* metadata to stdout

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.