intel_mkl_tool

Struct Library

Source
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: Config§include_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§

Source§

impl Library

Source

pub fn pkg_config(config: Config) -> Result<Option<Self>>

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.

Source

pub fn seek_directory( config: Config, root_dir: impl AsRef<Path>, ) -> Result<Option<Self>>

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.
Source

pub fn new(config: Config) -> Result<Self>

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
Source

pub fn available() -> Vec<Self>

Source

pub fn version(&self) -> Result<(u32, u32, u32)>

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)

Source

pub fn print_cargo_metadata(&self) -> Result<()>

Print cargo:rustc-link-* metadata to stdout

Trait Implementations§

Source§

impl Clone for Library

Source§

fn clone(&self) -> Library

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Library

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.