From a58d311f4a51e0df439e55ba1ac4133cfc34e287 Mon Sep 17 00:00:00 2001 From: geo-ant <54497890+geo-ant@users.noreply.github.com> Date: Wed, 17 Sep 2025 08:20:05 +0200 Subject: [PATCH 1/9] expose granular mkl features, change which mkl is linked by default --- Cargo.toml | 21 ++++++++++++++++++--- README.md | 7 +++++++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6c777b6..5e14484 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lapack-src" -version = "0.11.0" +version = "0.12.0" edition = "2021" license = "Apache-2.0 OR MIT" authors = [ @@ -23,10 +23,23 @@ keywords = ["linear-algebra"] changelog = "CHANGELOG.md" [features] +# apple accelerate accelerate = ["accelerate-src"] -intel-mkl = ["intel-mkl-src"] +# intel mkl with different configurations +intel-mkl = ["intel-mkl-static-lp64-seq"] +intel-mkl-static-lp64-iomp = ["intel-mkl-src/mkl-static-lp64-iomp"] +intel-mkl-static-lp64-seq = ["intel-mkl-src/mkl-static-lp64-seq"] +intel-mkl-static-ilp64-iomp = ["intel-mkl-src/mkl-static-ilp64-iomp"] +intel-mkl-static-ilp64-seq = ["intel-mkl-src/mkl-static-ilp64-seq"] +intel-mkl-dynamic-lp64-iomp = ["intel-mkl-src/mkl-dynamic-lp64-iomp"] +intel-mkl-dynamic-lp64-seq = ["intel-mkl-src/mkl-dynamic-lp64-seq"] +intel-mkl-dynamic-ilp64-iomp = ["intel-mkl-src/mkl-dynamic-ilp64-iomp"] +intel-mkl-dynamic-ilp64-seq = ["intel-mkl-src/mkl-dynamic-ilp64-seq"] +# netlib netlib = ["netlib-src"] +# openblas openblas = ["openblas-src"] +# R r = ["r-src"] [dependencies.accelerate-src] @@ -36,6 +49,8 @@ optional = true [dependencies.intel-mkl-src] version = "0.8" optional = true +default-features = false + [dependencies.netlib-src] version = "0.8" @@ -47,4 +62,4 @@ optional = true [dependencies.r-src] version = "0.2.1" -optional = true \ No newline at end of file +optional = true diff --git a/README.md b/README.md index 3a6596f..6eb9b23 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,13 @@ lapack-src = { version = "0.11", features = ["openblas"] } lapack-src = { version = "0.11", features = ["r"] } ``` +### Intel MKL Configuration + +The `intel-mkl` feature will *statically* link the *sequential LP64* version of +the MKL library. To link other versions of the library, check the `intel-mkl-*-*-*` +features inside this crate, which are analogous to the feature flags of +the [`intel-mkl-src` crate] (https://crates.io/crates/intel-mkl-src). + ## Contribution Your contribution is highly appreciated. Do not hesitate to open an issue or a From abe5ad2b01918dfa8b8de6ed71163a2fac352933 Mon Sep 17 00:00:00 2001 From: geo-ant <54497890+geo-ant@users.noreply.github.com> Date: Wed, 17 Sep 2025 08:49:18 +0200 Subject: [PATCH 2/9] expose mkl for all features --- src/lib.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 9cbc486..bab0e6a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -37,7 +37,17 @@ #[cfg(feature = "accelerate")] extern crate accelerate_src as raw; -#[cfg(feature = "intel-mkl")] +#[cfg(any( + feature = "intel-mkl", + feature = "intel-mkl-static-lp64-iomp", + feature = "intel-mkl-static-lp64-seq", + feature = "intel-mkl-static-ilp64-iomp", + feature = "intel-mkl-static-ilp64-seq", + feature = "intel-mkl-dynamic-lp64-iomp", + feature = "intel-mkl-dynamic-lp64-seq", + feature = "intel-mkl-dynamic-ilp64-iomp", + feature = "intel-mkl-dynamic-ilp64-seq" +))] extern crate intel_mkl_src as raw; #[cfg(feature = "netlib")] From 6b621c32c7dd0553fafbdbbfd3f241d39a59ccfb Mon Sep 17 00:00:00 2001 From: geo-ant <54497890+geo-ant@users.noreply.github.com> Date: Wed, 24 Sep 2025 19:40:26 +0200 Subject: [PATCH 3/9] simplify mkl linkage options --- Cargo.toml | 15 +++++---------- src/lib.rs | 31 +++++++++++++++---------------- 2 files changed, 20 insertions(+), 26 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5e14484..8a33e2b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,16 +25,11 @@ changelog = "CHANGELOG.md" [features] # apple accelerate accelerate = ["accelerate-src"] -# intel mkl with different configurations -intel-mkl = ["intel-mkl-static-lp64-seq"] -intel-mkl-static-lp64-iomp = ["intel-mkl-src/mkl-static-lp64-iomp"] -intel-mkl-static-lp64-seq = ["intel-mkl-src/mkl-static-lp64-seq"] -intel-mkl-static-ilp64-iomp = ["intel-mkl-src/mkl-static-ilp64-iomp"] -intel-mkl-static-ilp64-seq = ["intel-mkl-src/mkl-static-ilp64-seq"] -intel-mkl-dynamic-lp64-iomp = ["intel-mkl-src/mkl-dynamic-lp64-iomp"] -intel-mkl-dynamic-lp64-seq = ["intel-mkl-src/mkl-dynamic-lp64-seq"] -intel-mkl-dynamic-ilp64-iomp = ["intel-mkl-src/mkl-dynamic-ilp64-iomp"] -intel-mkl-dynamic-ilp64-seq = ["intel-mkl-src/mkl-dynamic-ilp64-seq"] +# parallel LP64 version of MKL +intel-mkl = ["intel-mkl-src/mkl-static-lp64-iomp"] +# sequential LP64 version of MKL +intel-mkl-seq = ["intel-mkl-src/mkl-static-lp64-seq"] + # netlib netlib = ["netlib-src"] # openblas diff --git a/src/lib.rs b/src/lib.rs index bab0e6a..c2eb3d0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -16,12 +16,21 @@ //! //! ```toml //! [dependencies] -//! lapack-src = { version = "0.11", features = ["accelerate"] } -//! lapack-src = { version = "0.11", features = ["intel-mkl"] } -//! lapack-src = { version = "0.11", features = ["netlib"] } -//! lapack-src = { version = "0.11", features = ["openblas"] } -//! lapack-src = { version = "0.11", features = ["r"] } +//! lapack-src = { version = "0.12", features = ["accelerate"] } +//! lapack-src = { version = "0.12", features = ["intel-mkl"] } +//! lapack-src = { version = "0.12", features = ["netlib"] } +//! lapack-src = { version = "0.12", features = ["openblas"] } +//! lapack-src = { version = "0.12", features = ["r"] } //! ``` +//! ### Configuring MKL +//! +//! When the `intel-mkl` feature is selected, then the parallel version of +//! MKL using OpenMP is _statically_ linked. To link the sequential version +//! use the `intel-mkl-seq` feature. In both cases, the +//! [LP64 interface](https://www.intel.com/content/www/us/en/docs/onemkl/developer-guide-linux/2023-0/using-the-ilp64-interface-vs-lp64-interface.html) +//! is linked. If other linkage options for MKL are desired, omit `lapack-src` +//! as a dependency and use the [`intel-mkl-src`](https://crates.io/crates/intel-mkl-src) +//! crate directly with the appropriate feature flags. //! //! [architecture]: https://blas-lapack-rs.github.io/architecture //! [lapack]: https://en.wikipedia.org/wiki/LAPACK @@ -37,17 +46,7 @@ #[cfg(feature = "accelerate")] extern crate accelerate_src as raw; -#[cfg(any( - feature = "intel-mkl", - feature = "intel-mkl-static-lp64-iomp", - feature = "intel-mkl-static-lp64-seq", - feature = "intel-mkl-static-ilp64-iomp", - feature = "intel-mkl-static-ilp64-seq", - feature = "intel-mkl-dynamic-lp64-iomp", - feature = "intel-mkl-dynamic-lp64-seq", - feature = "intel-mkl-dynamic-ilp64-iomp", - feature = "intel-mkl-dynamic-ilp64-seq" -))] +#[cfg(any(feature = "intel-mkl", feature = "intel-mkl-seq",))] extern crate intel_mkl_src as raw; #[cfg(feature = "netlib")] From 8b8d9a4f87a1dde7bdbe73e032afbdec0581001b Mon Sep 17 00:00:00 2001 From: geo-ant <54497890+geo-ant@users.noreply.github.com> Date: Wed, 24 Sep 2025 19:49:34 +0200 Subject: [PATCH 4/9] Update netlib-src --- CHANGELOG.md | 4 ++++ Cargo.toml | 4 ++-- README.md | 10 +++++----- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a2e056..5ed1107 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Version 0.12.0 (September 23, 2025) + +* `netlib-src` updated to version 0.9.0. + ## Version 0.11.0 (February 8, 2025) * `r-src` updated to version 0.2.1. diff --git a/Cargo.toml b/Cargo.toml index 8a33e2b..2f96cfb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "lapack-src" version = "0.12.0" -edition = "2021" +edition = "2024" license = "Apache-2.0 OR MIT" authors = [ "Balasubramanian Narasimhan ", @@ -48,7 +48,7 @@ default-features = false [dependencies.netlib-src] -version = "0.8" +version = "0.9" optional = true [dependencies.openblas-src] diff --git a/README.md b/README.md index 6eb9b23..d60aeb4 100644 --- a/README.md +++ b/README.md @@ -19,11 +19,11 @@ An implementation can be chosen as follows: ```toml [dependencies] -lapack-src = { version = "0.11", features = ["accelerate"] } -lapack-src = { version = "0.11", features = ["intel-mkl"] } -lapack-src = { version = "0.11", features = ["netlib"] } -lapack-src = { version = "0.11", features = ["openblas"] } -lapack-src = { version = "0.11", features = ["r"] } +lapack-src = { version = "0.12", features = ["accelerate"] } +lapack-src = { version = "0.12", features = ["intel-mkl"] } +lapack-src = { version = "0.12", features = ["netlib"] } +lapack-src = { version = "0.12", features = ["openblas"] } +lapack-src = { version = "0.12", features = ["r"] } ``` ### Intel MKL Configuration From e3a3cb97441bcdd88d99a5daec3419e17f1e4f17 Mon Sep 17 00:00:00 2001 From: geo-ant <54497890+geo-ant@users.noreply.github.com> Date: Thu, 2 Oct 2025 08:15:19 +0200 Subject: [PATCH 5/9] expose granular mkl features, change which mkl is linked by default --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 2f96cfb..93a4ed1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "lapack-src" version = "0.12.0" -edition = "2024" +edition = "2021" license = "Apache-2.0 OR MIT" authors = [ "Balasubramanian Narasimhan ", From b4e40e637588c382e6684feb018d1791846bb8a6 Mon Sep 17 00:00:00 2001 From: geo-ant <54497890+geo-ant@users.noreply.github.com> Date: Wed, 24 Sep 2025 19:49:34 +0200 Subject: [PATCH 6/9] Update netlib-src --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 93a4ed1..2f96cfb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "lapack-src" version = "0.12.0" -edition = "2021" +edition = "2024" license = "Apache-2.0 OR MIT" authors = [ "Balasubramanian Narasimhan ", From 8c616079e3719356a88845e4fda8f8e469b83588 Mon Sep 17 00:00:00 2001 From: geo-ant <54497890+geo-ant@users.noreply.github.com> Date: Thu, 2 Oct 2025 08:24:53 +0200 Subject: [PATCH 7/9] fix extra comma --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index c2eb3d0..fac7996 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -46,7 +46,7 @@ #[cfg(feature = "accelerate")] extern crate accelerate_src as raw; -#[cfg(any(feature = "intel-mkl", feature = "intel-mkl-seq",))] +#[cfg(any(feature = "intel-mkl", feature = "intel-mkl-seq"))] extern crate intel_mkl_src as raw; #[cfg(feature = "netlib")] From a41fc3188268df39ff89b4e5032929e128bda42c Mon Sep 17 00:00:00 2001 From: geo-ant <54497890+geo-ant@users.noreply.github.com> Date: Thu, 2 Oct 2025 08:26:21 +0200 Subject: [PATCH 8/9] address review comments --- Cargo.toml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2f96cfb..42f9e04 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,18 +23,11 @@ keywords = ["linear-algebra"] changelog = "CHANGELOG.md" [features] -# apple accelerate accelerate = ["accelerate-src"] -# parallel LP64 version of MKL intel-mkl = ["intel-mkl-src/mkl-static-lp64-iomp"] -# sequential LP64 version of MKL intel-mkl-seq = ["intel-mkl-src/mkl-static-lp64-seq"] - -# netlib netlib = ["netlib-src"] -# openblas openblas = ["openblas-src"] -# R r = ["r-src"] [dependencies.accelerate-src] @@ -44,8 +37,6 @@ optional = true [dependencies.intel-mkl-src] version = "0.8" optional = true -default-features = false - [dependencies.netlib-src] version = "0.9" From 52720d848eddfba951b9d3848730d0064d6e7803 Mon Sep 17 00:00:00 2001 From: geo-ant <54497890+geo-ant@users.noreply.github.com> Date: Mon, 6 Oct 2025 07:19:36 +0200 Subject: [PATCH 9/9] bump version, expose 2x2 feature matrix for mkl linkage --- Cargo.toml | 8 +++++--- src/lib.rs | 22 +++++++++++----------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 42f9e04..921367d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lapack-src" -version = "0.12.0" +version = "0.13.0" edition = "2024" license = "Apache-2.0 OR MIT" authors = [ @@ -24,8 +24,10 @@ changelog = "CHANGELOG.md" [features] accelerate = ["accelerate-src"] -intel-mkl = ["intel-mkl-src/mkl-static-lp64-iomp"] -intel-mkl-seq = ["intel-mkl-src/mkl-static-lp64-seq"] +intel-mkl-dynamic-parallel = ["intel-mkl-src/mkl-dynamic-lp64-iomp"] +intel-mkl-dynamic-sequential = ["intel-mkl-src/mkl-dynamic-lp64-seq"] +intel-mkl-static-parallel = ["intel-mkl-src/mkl-static-lp64-iomp"] +intel-mkl-static-sequential = ["intel-mkl-src/mkl-static-lp64-seq"] netlib = ["netlib-src"] openblas = ["openblas-src"] r = ["r-src"] diff --git a/src/lib.rs b/src/lib.rs index fac7996..e8a34d3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,7 +7,11 @@ //! The following implementations are available: //! //! * `accelerate`, which is the one in the [Accelerate] framework (macOS only), -//! * `intel-mkl`, which is the one in [Intel MKL], +//! * `intel-mkl-*`, which is the one in [Intel MKL], where +//! * `intel-mkl-dynamic-parallel` dynamically links the parallel backend of MKL +//! * `intel-mkl-dynamic-sequential` dynamically links the sequential backend of MKL +//! * `intel-mkl-static-parallel` statically links the parallel backend of MKL +//! * `intel-mkl-static-sequential` statically links the sequential backend of MKL //! * `netlib`, which is the reference one by [Netlib], //! * `openblas`, which is the one in [OpenBLAS], and //! * `r`, which is the one in [R]. @@ -22,15 +26,6 @@ //! lapack-src = { version = "0.12", features = ["openblas"] } //! lapack-src = { version = "0.12", features = ["r"] } //! ``` -//! ### Configuring MKL -//! -//! When the `intel-mkl` feature is selected, then the parallel version of -//! MKL using OpenMP is _statically_ linked. To link the sequential version -//! use the `intel-mkl-seq` feature. In both cases, the -//! [LP64 interface](https://www.intel.com/content/www/us/en/docs/onemkl/developer-guide-linux/2023-0/using-the-ilp64-interface-vs-lp64-interface.html) -//! is linked. If other linkage options for MKL are desired, omit `lapack-src` -//! as a dependency and use the [`intel-mkl-src`](https://crates.io/crates/intel-mkl-src) -//! crate directly with the appropriate feature flags. //! //! [architecture]: https://blas-lapack-rs.github.io/architecture //! [lapack]: https://en.wikipedia.org/wiki/LAPACK @@ -46,7 +41,12 @@ #[cfg(feature = "accelerate")] extern crate accelerate_src as raw; -#[cfg(any(feature = "intel-mkl", feature = "intel-mkl-seq"))] +#[cfg(any( + feature = "intel-mkl-dynamic-parallel", + feature = "intel-mkl-dynamic-sequential", + feature = "intel-mkl-static-parallel", + feature = "intel-mkl-static-sequential", +))] extern crate intel_mkl_src as raw; #[cfg(feature = "netlib")]