Skip to content

Commit ec080c8

Browse files
committed
Use new packages
1 parent b29ad95 commit ec080c8

File tree

2 files changed

+27
-15
lines changed

2 files changed

+27
-15
lines changed

intel-mkl-tool/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ curl = "0.4.25"
1313
failure = "0.1.6"
1414
pkg-config = "0.3.17"
1515
tar = "0.4.26"
16-
xz2 = "0.1.6"
1716
log = "0.4.8"
1817
dirs = "2.0.2"
1918
glob = "0.3.0"

intel-mkl-tool/src/lib.rs

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,40 @@ use std::{
1010

1111
const S3_ADDR: &'static str = "https://s3-ap-northeast-1.amazonaws.com/rust-intel-mkl";
1212

13-
#[cfg(target_os = "linux")]
13+
#[cfg(all(target_os = "linux", target_arch = "x86_64"))]
1414
mod mkl {
15-
pub const ARCHIVE_NAME: &'static str = "mkl_linux64";
16-
pub const ARCHIVE: &'static str = "mkl_linux.tar.xz";
15+
pub const ARCHIVE: &'static str = "mkl_linux64";
1716
pub const EXT: &'static str = "so";
1817
pub const PREFIX: &'static str = "lib";
18+
pub const VERSION_YEAR: u32 = 2019;
19+
pub const VERSION_UPDATE: u32 = 5;
1920
}
2021

21-
#[cfg(target_os = "macos")]
22+
#[cfg(all(target_os = "macos", target_arch = "x86_64"))]
2223
mod mkl {
23-
pub const ARCHIVE_NAME: &'static str = "mkl_osx";
24-
pub const ARCHIVE: &'static str = "mkl_osx.tar.xz";
24+
pub const ARCHIVE: &'static str = "mkl_macos64";
2525
pub const EXT: &'static str = "dylib";
2626
pub const PREFIX: &'static str = "lib";
27+
pub const VERSION_YEAR: u32 = 2019;
28+
pub const VERSION_UPDATE: u32 = 3;
2729
}
2830

29-
#[cfg(target_os = "windows")]
31+
#[cfg(all(target_os = "windows", target_arch = "x86_64"))]
3032
mod mkl {
31-
pub const ARCHIVE_NAME: &'static str = "mkl_windows64";
32-
pub const ARCHIVE: &'static str = "mkl_windows64.tar.xz";
33+
pub const ARCHIVE: &'static str = "mkl_windows64";
3334
pub const EXT: &'static str = "lib";
3435
pub const PREFIX: &'static str = "";
36+
pub const VERSION_YEAR: u32 = 2019;
37+
pub const VERSION_UPDATE: u32 = 5;
38+
}
39+
40+
pub fn archive_filename() -> String {
41+
format!(
42+
"{}_{}_{}.tar.zst",
43+
mkl::ARCHIVE,
44+
mkl::VERSION_YEAR,
45+
mkl::VERSION_UPDATE
46+
)
3547
}
3648

3749
pub fn home_library_path() -> PathBuf {
@@ -65,13 +77,14 @@ pub fn download(out_dir: &Path) -> Fallible<()> {
6577
bail!("Not a directory: {}", out_dir.display());
6678
}
6779

68-
let archive = out_dir.join(mkl::ARCHIVE);
80+
let archive = out_dir.join(archive_filename());
6981
if !archive.exists() {
70-
info!("Download archive from AWS S3: {}/{}", S3_ADDR, mkl::ARCHIVE);
82+
let url = format!("{}/{}", S3_ADDR, archive_filename());
83+
info!("Download archive from AWS S3: {}", url);
7184
let f = fs::File::create(&archive)?;
7285
let mut buf = io::BufWriter::new(f);
7386
let mut easy = Easy::new();
74-
easy.url(&format!("{}/{}", S3_ADDR, mkl::ARCHIVE))?;
87+
easy.url(&url)?;
7588
easy.write_function(move |data| Ok(buf.write(data).unwrap()))?;
7689
easy.perform()?;
7790
assert!(archive.exists());
@@ -82,7 +95,7 @@ pub fn download(out_dir: &Path) -> Fallible<()> {
8295
let core = out_dir.join(format!("{}mkl_core.{}", mkl::PREFIX, mkl::EXT));
8396
if !core.exists() {
8497
let f = fs::File::open(&archive)?;
85-
let de = xz2::read::XzDecoder::new(f);
98+
let de = zstd::stream::read::Decoder::new(f)?;
8699
let mut arc = tar::Archive::new(de);
87100
arc.unpack(&out_dir)?;
88101
assert!(core.exists());
@@ -126,7 +139,7 @@ pub fn package(mkl_path: &Path) -> Fallible<PathBuf> {
126139
}
127140
let (year, update) = get_mkl_version(&mkl_path.join("include/mkl_version.h"))?;
128141
info!("Intel MKL version: {}.{}", year, update);
129-
let out = PathBuf::from(format!("{}_{}_{}.tar.zst", mkl::ARCHIVE_NAME, year, update));
142+
let out = PathBuf::from(archive_filename());
130143
info!("Create archive: {}", out.display());
131144

132145
let shared_libs: Vec<_> = glob(

0 commit comments

Comments
 (0)