diff --git a/.github/workflows/intel-mkl-sys.yml b/.github/workflows/intel-mkl-sys.yml index dba38b69..c49d4f0c 100644 --- a/.github/workflows/intel-mkl-sys.yml +++ b/.github/workflows/intel-mkl-sys.yml @@ -22,7 +22,7 @@ jobs: - mkl-dynamic-ilp64-seq runs-on: ubuntu-22.04 container: - image: ghcr.io/rust-math/intel-mkl-src/mkl-rust:1.56.0 + image: ghcr.io/rust-math/intel-mkl-src/mkl-rust:1.56.0-1 steps: - uses: actions/checkout@v1 - uses: actions-rs/cargo@v1 diff --git a/.github/workflows/intel-mkl-tool.yml b/.github/workflows/intel-mkl-tool.yml index b5cfa278..ada75202 100644 --- a/.github/workflows/intel-mkl-tool.yml +++ b/.github/workflows/intel-mkl-tool.yml @@ -12,8 +12,8 @@ jobs: fail-fast: false matrix: os: - - windows-2019 - - macos-10.15 + - windows-2022 + - macos-11 - ubuntu-22.04 runs-on: ${{ matrix.os }} steps: @@ -37,23 +37,25 @@ jobs: --manifest-path=intel-mkl-tool/Cargo.toml --no-default-features - seek: + test_pkg_config: strategy: fail-fast: false matrix: image: - mkl-rust - mkl-ubuntu - - mkl-centos runs-on: ubuntu-22.04 container: - image: ghcr.io/rust-math/intel-mkl-src/${{ matrix.image }}:1.56.0 + image: ghcr.io/rust-math/intel-mkl-src/${{ matrix.image }}:1.56.0-1 steps: - uses: actions/checkout@v1 - - name: cargo run -- seek - uses: actions-rs/cargo@v1 + - uses: actions-rs/cargo@v1 + name: Seek /opt/intel with: - command: run + command: test args: > --manifest-path=intel-mkl-tool/Cargo.toml - -- seek + pkg_config + -- + --ignored + --show-output diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 6c6e8235..9a269abe 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -10,7 +10,7 @@ jobs: check-format: runs-on: ubuntu-22.04 container: - image: ghcr.io/rust-math/intel-mkl-src/mkl-rust:1.56.0 + image: ghcr.io/rust-math/intel-mkl-src/mkl-rust:1.56.0-1 steps: - uses: actions/checkout@v1 - uses: actions-rs/cargo@v1 @@ -21,7 +21,7 @@ jobs: clippy: runs-on: ubuntu-22.04 container: - image: ghcr.io/rust-math/intel-mkl-src/mkl-rust:1.56.0 + image: ghcr.io/rust-math/intel-mkl-src/mkl-rust:1.56.0-1 steps: - uses: actions/checkout@v1 - uses: actions-rs/cargo@v1 diff --git a/intel-mkl-src/build.rs b/intel-mkl-src/build.rs index eb6ede2f..f4fc8f35 100644 --- a/intel-mkl-src/build.rs +++ b/intel-mkl-src/build.rs @@ -24,7 +24,7 @@ use anyhow::{bail, Result}; use intel_mkl_tool::*; -use std::{env, path::PathBuf, str::FromStr}; +use std::str::FromStr; #[cfg(feature = "mkl-static-lp64-iomp")] const MKL_CONFIG: &str = "mkl-static-lp64-iomp"; @@ -45,26 +45,9 @@ const MKL_CONFIG: &str = "mkl-dynamic-ilp64-seq"; fn main() -> Result<()> { let cfg = Config::from_str(MKL_CONFIG).unwrap(); - - // already exists on system - if let Ok(entry) = Entry::from_config(cfg) { - entry.print_cargo_metadata(); + if let Ok(lib) = Library::new(cfg) { + lib.print_cargo_metadata()?; return Ok(()); } - - // download if not found - #[cfg(feature = "download")] - { - let path = PathBuf::from(env::var("OUT_DIR").unwrap()); - println!( - r#"cargo:warning="Download Intel MKL archive into {}""#, - path.display() - ); - cfg.download(path)?; - let entry = Entry::from_config(cfg).unwrap(); // must found - entry.print_cargo_metadata(); - return Ok(()); - } - - bail!("No MKL found, and download flag is off."); + bail!("No MKL found"); } diff --git a/intel-mkl-tool/Cargo.toml b/intel-mkl-tool/Cargo.toml index 788c40be..6ca8cd25 100644 --- a/intel-mkl-tool/Cargo.toml +++ b/intel-mkl-tool/Cargo.toml @@ -7,27 +7,12 @@ rust-version = "1.56.0" # MSRV is introduced description = "CLI utility for redistributiing Intel(R) MKL" repository = "https://github.com/rust-math/intel-mkl-src" -keywords = ["cli"] +keywords = [] license = "MIT" -[features] -default = ["cli"] -cli = ["structopt"] - [dependencies] anyhow = "1.0.58" -derive_more = "0.99.17" -dirs = "4.0.0" -glob = "0.3.0" -pkg-config = "0.3.25" - -# CLI -structopt = { version = "0.3.26", optional = true } +walkdir = "2.3.2" [dev-dependencies] paste = "1.0.7" - -[[bin]] -name = "intel-mkl-tool" -path = "src/cli.rs" -required-features = ["cli"] diff --git a/intel-mkl-tool/src/cli.rs b/intel-mkl-tool/src/cli.rs deleted file mode 100644 index ea9cb6c4..00000000 --- a/intel-mkl-tool/src/cli.rs +++ /dev/null @@ -1,34 +0,0 @@ -use anyhow::{bail, Result}; -use intel_mkl_tool::*; -use structopt::StructOpt; - -/// CLI tool for intel-mkl crate -#[derive(Debug, StructOpt)] -enum Opt { - /// Seek Intel-MKL library - Seek {}, -} - -fn main() -> Result<()> { - let opt = Opt::from_args(); - - match opt { - Opt::Seek {} => { - let available = Entry::available(); - if available.is_empty() { - bail!("No MKL found"); - } - for lib in Entry::available() { - if let Ok(version) = lib.version() { - println!("{:<22}: {}.{}", lib.name(), version.0, version.1); - } else { - println!("{:<22}", lib.name()); - } - for (path, name) in &lib.found_files() { - println!(" {:<25} at {}", name, path.display()); - } - } - } - } - Ok(()) -} diff --git a/intel-mkl-tool/src/entry.rs b/intel-mkl-tool/src/entry.rs index 8ef12560..00234e00 100644 --- a/intel-mkl-tool/src/entry.rs +++ b/intel-mkl-tool/src/entry.rs @@ -1,229 +1,286 @@ -use crate::{mkl, Config, LinkType, VALID_CONFIGS}; -use anyhow::{bail, Result}; -use derive_more::Deref; +use crate::{Config, LinkType, Threading}; +use anyhow::{bail, ensure, Context, Result}; use std::{ - collections::{HashMap, HashSet}, fs, io::{self, BufRead}, path::{Path, PathBuf}, - str::FromStr, + process::Command, }; -#[derive(Debug, Deref)] -struct Targets(HashMap>); - -impl Targets { - fn new(config: Config) -> Self { - let mut targets: HashMap> = HashMap::new(); - for name in config - .libs() - .into_iter() - .chain(config.additional_libs().into_iter()) - { - let target = match config.link { - LinkType::Static => format!("{}{}.{}", mkl::PREFIX, name, mkl::EXTENSION_STATIC), - LinkType::Dynamic => format!("{}{}.{}", mkl::PREFIX, name, mkl::EXTENSION_SHARED), - }; - targets.insert(target, None); - } - Self(targets) - } - - fn found_files(&self) -> Vec<(PathBuf, String)> { - self.iter() - .flat_map(|(name, path)| Some((path.as_ref()?.clone(), name.clone()))) - .collect() - } - - fn found_any(&self) -> bool { - self.0.iter().any(|(_key, value)| value.is_some()) - } - - fn seek>(&mut self, dir: P) { - let dir = dir.as_ref(); - for (key, value) in &mut self.0 { - if dir.join(key).exists() { - value.get_or_insert(dir.canonicalize().unwrap()); - } - } - } -} - -#[derive(Debug)] -enum EntryTarget { - Manual(Targets), - PkgConfig, -} +/// Lacked definition of [std::env::consts] +pub const STATIC_EXTENSION: &str = if cfg!(any(target_os = "linux", target_os = "macos")) { + "a" +} else { + "lib" +}; -/// Handler for found library -#[derive(Debug)] -pub struct Entry { - config: Config, - target: EntryTarget, +/// Found MKL library +/// +/// ```no_run +/// 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(); +/// } +/// ``` +#[derive(Debug, Clone)] +pub struct Library { + pub config: Config, + /// Directory where `mkl.h` and `mkl_version.h` exists + pub include_dir: PathBuf, + /// Directory where `libmkl_core.a` or `libmkl_core.so` exists + pub library_dir: PathBuf, + /// Directory where `libiomp5.a` or `libiomp5.so` exists + /// + /// They are not required for `mkl-*-*-seq` cases, + /// and then this is `None`. + pub iomp5_dir: Option, } -impl Entry { - /// Get the directory where the library exists +impl Library { + /// Find MKL using `pkg-config` /// - /// This will seek followings in this order: + /// This only use the installed prefix obtained by `pkg-config --variable=prefix` /// - /// - `$OUT_DIR` - /// - Only for build.rs - /// - This exists only when the previous build downloads archive here - /// - pkg-config `${name}` - /// - Installed by package manager or official downloader + /// ```text + /// $ pkg-config --variable=prefix mkl-static-lp64-seq + /// /opt/intel/mkl + /// ``` /// - /// Returns error if no library found + /// Then pass it to [Self::seek_directory]. /// - pub fn from_config(config: Config) -> Result { - let mut targets = Targets::new(config); - - // OUT_DIR - if let Ok(dir) = std::env::var("OUT_DIR") { - let out_dir = PathBuf::from(dir); - targets.seek(&out_dir); - } - - // pkg-config - if let Ok(_) = pkg_config::Config::new() - .cargo_metadata(false) - .probe(&config.to_string()) + /// 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. + /// + pub fn pkg_config(config: Config) -> Result> { + if let Ok(out) = Command::new("pkg-config") + .arg("--variable=prefix") + .arg(config.to_string()) + .output() { - return Ok(Self { - config, - target: EntryTarget::PkgConfig, - }); - } - - // $MKLROOT - let mkl_root = std::env::var("MKLROOT").map(PathBuf::from); - if let Ok(path) = mkl_root { - if path.exists() { - targets.seek(path.join("lib/intel64")); + if out.status.success() { + let path = String::from_utf8(out.stdout).context("Non-UTF8 MKL prefix")?; + let prefix = Path::new(path.trim()); + Self::seek_directory(config, prefix) + } else { + // pkg-config does not find MKL + Ok(None) } + } else { + // pkg-config is not found + Ok(None) } + } - // /opt/intel - let opt_mkl = PathBuf::from("/opt/intel"); - if opt_mkl.exists() { - targets.seek(opt_mkl.join("lib/intel64")); - targets.seek(opt_mkl.join("mkl/lib/intel64")); + /// 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. + /// + pub fn seek_directory(config: Config, root_dir: impl AsRef) -> Result> { + let root_dir = root_dir.as_ref(); + if !root_dir.is_dir() { + return Ok(None); } + let mut library_dir = None; + let mut include_dir = None; + let mut iomp5_dir = None; + for entry in walkdir::WalkDir::new(root_dir) { + let entry = entry.unwrap(); + if entry.path_is_symlink() { + continue; + } + let path = entry.into_path(); + if path.is_dir() { + continue; + } + let (stem, ext) = match (path.file_stem(), path.extension()) { + (Some(stem), Some(ext)) => ( + stem.to_str().context("Non UTF8 filename")?, + ext.to_str().context("Non UTF8 filename")?, + ), + _ => continue, + }; + // Skip directory for ia32 + if path.components().any(|c| { + if let std::path::Component::Normal(c) = c { + if let Some(c) = c.to_str() { + if c.starts_with("ia32") { + return true; + } + } + } + false + }) { + continue; + } - // Default setting for Windows installer - let windows_mkl = - PathBuf::from("C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows"); - if windows_mkl.exists() { - targets.seek(windows_mkl.join("mkl/lib/intel64")); - targets.seek(windows_mkl.join("compiler/lib/intel64")); + let dir = path + .parent() + .expect("parent must exist here since this is under `root_dir`") + .to_owned(); + if stem == "mkl" && ext == "h" { + include_dir = Some(dir); + continue; + } + let name = if let Some(name) = stem.strip_prefix(std::env::consts::DLL_PREFIX) { + name + } else { + continue; + }; + match (config.link, ext) { + (LinkType::Static, STATIC_EXTENSION) => match name { + "mkl_core" => { + ensure!( + library_dir.replace(dir).is_none(), + "Two or more MKL found in {}", + root_dir.display() + ) + } + "iomp5" => { + ensure!( + iomp5_dir.replace(dir).is_none(), + "Two or more MKL found in {}", + root_dir.display() + ) + } + _ => {} + }, + (LinkType::Dynamic, std::env::consts::DLL_EXTENSION) => match name { + "mkl_core" => { + ensure!( + library_dir.replace(dir).is_none(), + "Two or more MKL found in {}", + root_dir.display() + ) + } + "iomp5" => { + ensure!( + iomp5_dir.replace(dir).is_none(), + "Two or more MKL found in {}", + root_dir.display() + ) + } + _ => {} + }, + _ => {} + } } - - if targets.found_any() { - Ok(Self { - config, - target: EntryTarget::Manual(targets), - }) - } else { - // None found - bail!("No library found for {}", config); + if config.parallel == Threading::OpenMP && iomp5_dir.is_none() { + return Ok(None); } + Ok(match (library_dir, include_dir) { + (Some(library_dir), Some(include_dir)) => Some(Library { + config, + include_dir, + library_dir, + iomp5_dir, + }), + _ => None, + }) } - pub fn name(&self) -> String { - self.config.to_string() - } - - pub fn found_files(&self) -> Vec<(PathBuf, String)> { - if let EntryTarget::Manual(m) = &self.target { - m.found_files() - } else { - vec![] + /// 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/` for Windows + /// + pub fn new(config: Config) -> Result { + if let Some(lib) = Self::pkg_config(config)? { + return Ok(lib); + } + if let Ok(mklroot) = std::env::var("MKLROOT") { + if let Some(lib) = Self::seek_directory(config, mklroot)? { + return Ok(lib); + } } + for path in ["/opt/intel", "C:/Program Files (x86)/IntelSWTools/"] { + let path = Path::new(path); + if let Some(lib) = Self::seek_directory(config, path)? { + return Ok(lib); + } + } + bail!("Intel MKL not found in system"); } pub fn available() -> Vec { - VALID_CONFIGS - .iter() - .flat_map(|name| Self::from_config(Config::from_str(name).unwrap())) + Config::possibles() + .into_iter() + .flat_map(|cfg| Self::new(cfg).ok()) .collect() } - /// Get MKL version info from its C header + /// Found MKL version parsed from `mkl_version.h` /// - /// - This will not work for OUT_DIR, or Pkgconfig entry, - /// and returns Error in these cases - pub fn version(&self) -> Result<(u32, u32)> { - for (path, _) in &self.found_files() { - // assumes following directory structure: - // - // - mkl - // - include - // - lib/intel64 <- this is cached in targets - // - let version_header = path.join("../../include/mkl_version.h"); - if !version_header.exists() { - continue; - } + /// `mkl_version.h` will define + /// + /// ```c + /// #define __INTEL_MKL__ 2020 + /// #define __INTEL_MKL_MINOR__ 0 + /// #define __INTEL_MKL_UPDATE__ 1 + /// ``` + /// + /// and this corresponds to `(2020, 0, 1)` + /// + pub fn version(&self) -> Result<(u32, u32, u32)> { + let version_h = self.include_dir.join("mkl_version.h"); - // Extract version info from C header - // - // ``` - // #define __INTEL_MKL__ 2020 - // #define __INTEL_MKL_MINOR__ 0 - // #define __INTEL_MKL_UPDATE__ 1 - // ``` - let f = fs::File::open(version_header)?; - let f = io::BufReader::new(f); - let mut year = 0; - let mut update = 0; - for line in f.lines() { - if let Ok(line) = line { - if !line.starts_with("#define") { - continue; - } - let ss: Vec<&str> = line.split(' ').collect(); - match ss[1] { - "__INTEL_MKL__" => year = ss[2].parse()?, - "__INTEL_MKL_UPDATE__" => update = ss[2].parse()?, - _ => continue, - } - } + let f = fs::File::open(version_h).context("Failed to open mkl_version.h")?; + let f = io::BufReader::new(f); + let mut year = None; + let mut minor = None; + let mut update = None; + for line in f.lines().flatten() { + if !line.starts_with("#define") { + continue; } - if year > 0 && update > 0 { - return Ok((year, update)); + let ss: Vec<&str> = line.split(' ').collect(); + match ss[1] { + "__INTEL_MKL__" => year = Some(ss[2].parse()?), + "__INTEL_MKL_MINOR__" => minor = Some(ss[2].parse()?), + "__INTEL_MKL_UPDATE__" => update = Some(ss[2].parse()?), + _ => continue, } } - bail!("Cannot determine MKL versions"); + match (year, minor, update) { + (Some(year), Some(minor), Some(update)) => Ok((year, minor, update)), + _ => bail!("Invalid mkl_version.h"), + } } - pub fn print_cargo_metadata(&self) { - match &self.target { - EntryTarget::Manual(_target) => { - let paths: HashSet = self - .found_files() - .into_iter() - .map(|(path, _name)| path) - .collect(); // must be redundant - for path in paths { - println!("cargo:rustc-link-search={}", path.display()); + /// Print `cargo:rustc-link-*` metadata to stdout + pub fn print_cargo_metadata(&self) -> Result<()> { + println!("cargo:rustc-link-search={}", self.library_dir.display()); + if let Some(iomp5_dir) = &self.iomp5_dir { + if iomp5_dir != &self.library_dir { + println!("cargo:rustc-link-search={}", iomp5_dir.display()); + } + } + for lib in self.config.libs() { + match self.config.link { + LinkType::Static => { + println!("cargo:rustc-link-lib=static={}", lib); } - for lib in self.config.libs() { - match self.config.link { - LinkType::Static => { - println!("cargo:rustc-link-lib=static={}", lib); - } - LinkType::Dynamic => { - println!("cargo:rustc-link-lib=dylib={}", lib); - } - } + LinkType::Dynamic => { + println!("cargo:rustc-link-lib=dylib={}", lib); } } - EntryTarget::PkgConfig => { - pkg_config::Config::new() - .probe(&self.config.to_string()) - .unwrap(); - } } + Ok(()) } } @@ -231,10 +288,26 @@ impl Entry { mod tests { use super::*; - /// Test all available MKL are detected + /// Seek /opt/intel in Linux system #[ignore] #[test] - fn with_mkl_availables() { - assert_eq!(Entry::available().len(), 8); + fn seek_opt_intel() { + for cfg in Config::possibles() { + let lib = Library::seek_directory(cfg, "/opt/intel").unwrap().unwrap(); + dbg!(lib.version().unwrap()); + } + } + + #[ignore] + #[test] + fn pkg_config() { + for cfg in Config::possibles() { + // pkg-config will not work for `mkl-*-*-iomp` cases + if cfg.parallel == Threading::OpenMP { + continue; + } + let lib = Library::pkg_config(cfg).unwrap().unwrap(); + dbg!(lib.version().unwrap()); + } } } diff --git a/intel-mkl-tool/src/lib.rs b/intel-mkl-tool/src/lib.rs index 2ce4de97..c1701e03 100644 --- a/intel-mkl-tool/src/lib.rs +++ b/intel-mkl-tool/src/lib.rs @@ -1,128 +1,5 @@ -//! Library files in Intel MKL 2020.1 for Linux -//! -------------------------------------------- -//! -//! ### MKL Core -//! -//! | | shared | static | -//! |:-----------------------|:-------------------------------|:------------------------------| -//! |mkl_core | libmkl_core.so| libmkl_core.a| -//! |mkl_def | libmkl_def.so| - | -//! |mkl_rt | libmkl_rt.so| - | -//! |mkl_avx | libmkl_avx.so| - | -//! |mkl_avx2 | libmkl_avx2.so| - | -//! |mkl_avx512 | libmkl_avx512.so| - | -//! |mkl_avx512_mic | libmkl_avx512_mic.so| - | -//! |mkl_mc | libmkl_mc.so| - | -//! |mkl_mc3 | libmkl_mc3.so| - | -//! -//! ### Vector Math library -//! -//! | | shared | static | -//! |:-----------------------|:-------------------------------|:------------------------------| -//! |mkl_vml_def | libmkl_vml_def.so| - | -//! |mkl_vml_avx | libmkl_vml_avx.so| - | -//! |mkl_vml_avx2 | libmkl_vml_avx2.so| - | -//! |mkl_vml_avx512 | libmkl_vml_avx512.so| - | -//! |mkl_vml_avx512_mic | libmkl_vml_avx512_mic.so| - | -//! |mkl_vml_mc | libmkl_vml_mc.so| - | -//! |mkl_vml_mc2 | libmkl_vml_mc2.so| - | -//! |mkl_vml_mc3 | libmkl_vml_mc3.so| - | -//! |mkl_vml_cmpt | libmkl_vml_cmpt.so| - | -//! -//! ### Intel OpenMP -//! -//! | | shared | static | -//! |:-----------------------|:-------------------------------|:------------------------------| -//! |iomp5 | libiomp5.so| libiomp5.a| -//! |iomp5_db | libiomp5_db.so| - | -//! |iompstubs5 | libiompstubs5.so| libiompstubs5.a| -//! -//! ### Threading switch -//! -//! | | shared | static | -//! |:-----------------------|:-------------------------------|:------------------------------| -//! |mkl_sequential | libmkl_sequential.so| libmkl_sequential.a| -//! |mkl_gnu_thread | libmkl_gnu_thread.so| libmkl_gnu_thread.a| -//! |mkl_intel_thread | libmkl_intel_thread.so| libmkl_intel_thread.a| -//! |mkl_pgi_thread | libmkl_pgi_thread.so| libmkl_pgi_thread.a| -//! |mkl_tbb_thread | libmkl_tbb_thread.so| libmkl_tbb_thread.a| -//! -//! ### LP64/ILP64 switch for Intel and GCC Fortran compilers -//! -//! | | shared | static | -//! |:-----------------------|:-------------------------------|:------------------------------| -//! |mkl_intel_ilp64 | libmkl_intel_ilp64.so| libmkl_intel_ilp64.a| -//! |mkl_intel_lp64 | libmkl_intel_lp64.so| libmkl_intel_lp64.a| -//! |mkl_gf_ilp64 | libmkl_gf_ilp64.so| libmkl_gf_ilp64.a| -//! |mkl_gf_lp64 | libmkl_gf_lp64.so| libmkl_gf_lp64.a| -//! -//! ### Fortran 95 interface -//! -//! | | shared | static | -//! |:-----------------------|:-------------------------------|:------------------------------| -//! |mkl_blas95_ilp64 | - | libmkl_blas95_ilp64.a| -//! |mkl_blas95_lp64 | - | libmkl_blas95_lp64.a| -//! |mkl_lapack95_ilp64 | - | libmkl_lapack95_ilp64.a| -//! |mkl_lapack95_lp64 | - | libmkl_lapack95_lp64.a| -//! -//! ### ScaLAPACK -//! -//! | | shared | static | -//! |:-----------------------|:-------------------------------|:------------------------------| -//! |mkl_scalapack_ilp64 | libmkl_scalapack_ilp64.so| libmkl_scalapack_ilp64.a| -//! |mkl_scalapack_lp64 | libmkl_scalapack_lp64.so| libmkl_scalapack_lp64.a| -//! -//! ### BLACS -//! -//! | | shared | static | -//! |:-----------------------|:-------------------------------|:------------------------------| -//! |mkl_blacs_intelmpi_ilp64| libmkl_blacs_intelmpi_ilp64.so| libmkl_blacs_intelmpi_ilp64.a| -//! |mkl_blacs_intelmpi_lp64 | libmkl_blacs_intelmpi_lp64.so| libmkl_blacs_intelmpi_lp64.a| -//! |mkl_blacs_openmpi_ilp64 | libmkl_blacs_openmpi_ilp64.so| libmkl_blacs_openmpi_ilp64.a| -//! |mkl_blacs_openmpi_lp64 | libmkl_blacs_openmpi_lp64.so| libmkl_blacs_openmpi_lp64.a| -//! |mkl_blacs_sgimpt_ilp64 | libmkl_blacs_sgimpt_ilp64.so| libmkl_blacs_sgimpt_ilp64.a| -//! |mkl_blacs_sgimpt_lp64 | libmkl_blacs_sgimpt_lp64.so| libmkl_blacs_sgimpt_lp64.a| -//! -//! ### FFT -//! -//! | | shared | static | -//! |:-----------------------|:-------------------------------|:------------------------------| -//! |mkl_cdft_core | libmkl_cdft_core.so| libmkl_cdft_core.a| -//! - -#![cfg_attr(not(feature = "archive"), allow(dead_code))] - mod config; mod entry; pub use config::*; pub use entry::*; - -#[cfg(all(target_os = "linux", target_arch = "x86_64"))] -mod mkl { - pub const EXTENSION_STATIC: &str = "a"; - pub const EXTENSION_SHARED: &str = "so"; - pub const PREFIX: &str = "lib"; - pub const VERSION_YEAR: u32 = 2020; - pub const VERSION_UPDATE: u32 = 1; -} - -#[cfg(all(target_os = "macos", target_arch = "x86_64"))] -mod mkl { - pub const OS: &str = "macos"; - pub const EXTENSION_STATIC: &'static str = "a"; - pub const EXTENSION_SHARED: &'static str = "dylib"; - pub const PREFIX: &'static str = "lib"; - pub const VERSION_YEAR: u32 = 2019; - pub const VERSION_UPDATE: u32 = 3; -} - -#[cfg(all(target_os = "windows", target_arch = "x86_64"))] -mod mkl { - pub const OS: &str = "windows"; - pub const EXTENSION_STATIC: &'static str = "lib"; - pub const EXTENSION_SHARED: &'static str = "lib"; - pub const PREFIX: &'static str = ""; - pub const VERSION_YEAR: u32 = 2020; - pub const VERSION_UPDATE: u32 = 1; -}