Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change ndarray-linalg backend to intel-mkl #369

Merged
merged 7 commits into from
Jan 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 25 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
push:
branches:
- main
- win-netlib-fix

env:
CARGO_TERM_COLOR: always
Expand Down Expand Up @@ -85,32 +86,32 @@ jobs:
- name: argmin-math (ndarray_v0_13-nolinalg)
run: cargo test -p argmin-math --no-default-features --features "ndarray_v0_13-nolinalg"
# ndarray with linalg, without serde
- name: argmin-math (ndarray_latest,_dev_linalg_latest)
run: cargo test -p argmin-math --no-default-features --features "ndarray_latest,_dev_linalg_latest"
- name: argmin-math (ndarray_v0_15,_dev_linalg_0_16)
run: cargo test -p argmin-math --no-default-features --features "ndarray_v0_15,_dev_linalg_0_16"
- name: argmin-math (ndarray_v0_14,_dev_linalg_0_13)
run: cargo test -p argmin-math --no-default-features --features "ndarray_v0_14,_dev_linalg_0_13"
- name: argmin-math (ndarray_v0_13,_dev_linalg_0_12)
run: cargo test -p argmin-math --no-default-features --features "ndarray_v0_13,_dev_linalg_0_12"
- name: argmin-math (ndarray_latest)
run: cargo test --manifest-path ./argmin-math/ndarray-linalg-tests/ndarray_latest/Cargo.toml
- name: argmin-math (ndarray_v0_15)
run: cargo test --manifest-path ./argmin-math/ndarray-linalg-tests/ndarray_0_15/Cargo.toml
- name: argmin-math (ndarray_v0_14)
run: cargo test --manifest-path ./argmin-math/ndarray-linalg-tests/ndarray_0_14/Cargo.toml
- name: argmin-math (ndarray_v0_13)
run: cargo test --manifest-path ./argmin-math/ndarray-linalg-tests/ndarray_0_13/Cargo.toml
# ndarray without linalg, with serde
- name: argmin-math (ndarray_latest-serde,_dev_linalg_latest)
run: cargo test -p argmin-math --no-default-features --features "ndarray_latest-serde,_dev_linalg_latest"
- name: argmin-math (ndarray_v0_15-serde,_dev_linalg_0_16)
run: cargo test -p argmin-math --no-default-features --features "ndarray_v0_15-serde,_dev_linalg_0_16"
- name: argmin-math (ndarray_v0_14-serde,_dev_linalg_0_13)
run: cargo test -p argmin-math --no-default-features --features "ndarray_v0_14-serde,_dev_linalg_0_13"
- name: argmin-math (ndarray_v0_13-serde,_dev_linalg_0_12)
run: cargo test -p argmin-math --no-default-features --features "ndarray_v0_13-serde,_dev_linalg_0_12"
- name: argmin-math (ndarray_latest-nolinalg-serde)
run: cargo test -p argmin-math --no-default-features --features "ndarray_latest-nolinalg-serde"
- name: argmin-math (ndarray_v0_15-serde)
run: cargo test -p argmin-math --no-default-features --features "ndarray_v0_15-nolinalg-serde"
- name: argmin-math (ndarray_v0_14-serde)
run: cargo test -p argmin-math --no-default-features --features "ndarray_v0_14-nolinalg-serde"
- name: argmin-math (ndarray_v0_13-serde)
run: cargo test -p argmin-math --no-default-features --features "ndarray_v0_13-nolinalg-serde"
# ndarray with linalg, with serde
- name: argmin-math (ndarray_latest-serde,_dev_linalg_latest)
run: cargo test -p argmin-math --no-default-features --features "ndarray_latest-serde,_dev_linalg_latest"
- name: argmin-math (ndarray_v0_15-serde,_dev_linalg_0_16)
run: cargo test -p argmin-math --no-default-features --features "ndarray_v0_15-serde,_dev_linalg_0_16"
- name: argmin-math (ndarray_v0_14-serde,_dev_linalg_0_13)
run: cargo test -p argmin-math --no-default-features --features "ndarray_v0_14-serde,_dev_linalg_0_13"
- name: argmin-math (ndarray_v0_13-serde,_dev_linalg_0_12)
run: cargo test -p argmin-math --no-default-features --features "ndarray_v0_13-serde,_dev_linalg_0_12"
- name: argmin-math (ndarray_latest-serde)
run: cargo test --manifest-path ./argmin-math/ndarray-linalg-tests/ndarray_latest/Cargo.toml --features serde
- name: argmin-math (ndarray_v0_15)
run: cargo test --manifest-path ./argmin-math/ndarray-linalg-tests/ndarray_0_15/Cargo.toml --features serde
- name: argmin-math (ndarray_v0_14)
run: cargo test --manifest-path ./argmin-math/ndarray-linalg-tests/ndarray_0_14/Cargo.toml --features serde
- name: argmin-math (ndarray_v0_13)
run: cargo test --manifest-path ./argmin-math/ndarray-linalg-tests/ndarray_0_13/Cargo.toml --features serde
# nalgebra without serde
- name: argmin-math (nalgebra_latest)
run: cargo test -p argmin-math --no-default-features --features "nalgebra_latest"
Expand Down
13 changes: 0 additions & 13 deletions argmin-math/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,6 @@ ndarray_v0_14-nolinalg-serde = ["ndarray_v0_14-nolinalg", "ndarray_0_14/serde-1"
ndarray_v0_13-nolinalg = ["ndarray_0_13", "num-complex_0_2", "ndarray_all"]
ndarray_v0_13-nolinalg-serde = ["ndarray_v0_13-nolinalg", "ndarray_0_13/serde-1"]

# For development and running the tests a backend for `ndarray-linalg` must be chosen. Normally
# one would add those as dev dependencies (the features would then be unified with the regular
# dependencies). However, linking somehow fails when the non-dev `ndarra-linalg` dependency is
# missing (which is the case for the `*-nolinalg*` features of the ndarray backend). To fix that,
# the `_dev_linalg_*` features were introduced. When testing and developing with one of the
# ndarray features with linalg support on, the appropriate `_dev_linalg_*` feature must be turned
# on as well. Note that the version number in `_dev_linalg_*` is always one below the `ndarray`
# version. For instance, for ndarray 0.15, one would use the `_dev_linalg_0_14` feature.
_dev_linalg_latest = ["_dev_linalg_0_16"]
_dev_linalg_0_16 = ["ndarray-linalg_0_16/netlib-static"]
_dev_linalg_0_13 = ["ndarray-linalg_0_13/netlib-static"]
_dev_linalg_0_12 = ["ndarray-linalg_0_12/netlib"]

[badges]
maintenance = { status = "actively-developed" }

Expand Down
3 changes: 3 additions & 0 deletions argmin-math/ndarray-linalg-tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This folder contains tests for the argmin-math crate.
Separate projects are needed to test against multiple versions of dependencies because of the required additivity of features, which is not possible for multiple separate versions of dependencies when they specify the `links` attribute with the same name but different versions. This additivity with regard to the `links` attribute is necessary even when all but one of the concerned dependencies are disabled behind a feature. This is necessary for the backend dependency of ndarray-linalg.
Read more here: https://github.com/argmin-rs/argmin/issues/368#issue-1929115127
26 changes: 26 additions & 0 deletions argmin-math/ndarray-linalg-tests/ndarray_0_13/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[package]
name = "ndarray_0_13"
version = "0.0.0"
edition = "2021"
publish = false

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dev-dependencies]
argmin-math = { path = "../../", version = "0.3", features = [
"ndarray_v0_13",
] }
ndarray = { version = "0.13", default-features = false }
ndarray-linalg = { version = "0.12", default-features = false, features = ["intel-mkl"] }
num-complex = { version = "0.2", default-features = false }
num-traits = { version = "0.2", default-features = false }
num-integer = { version = "0.1", default-features = false }
paste = "1"
approx = "0.5.0"
rand = "*" # Should unify with whatever is currently used in argmin itself

[features]
serde = ["argmin-math/ndarray_v0_13-serde"]

# To make it explicit that this package is not part of the overall argmin workspace for the purpose of dependency unification
[workspace]
51 changes: 51 additions & 0 deletions argmin-math/ndarray-linalg-tests/ndarray_0_13/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
mod add {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/add.rs"));
}
mod conj {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/conj.rs"));
}
mod div {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/div.rs"));
}
mod dot {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/dot.rs"));
}
mod eye {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/eye.rs"));
}
mod inv {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/inv.rs"));
}
mod l1norm {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/l1norm.rs"));
}
mod l2norm {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/l2norm.rs"));
}
mod minmax {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/minmax.rs"));
}
mod mul {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/mul.rs"));
}
mod random {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/random.rs"));
}
mod scaledadd {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/scaledadd.rs"));
}
mod scaledsub {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/scaledsub.rs"));
}
mod signum {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/signum.rs"));
}
mod sub {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/sub.rs"));
}
mod transpose {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/transpose.rs"));
}
mod zero {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/zero.rs"));
}
28 changes: 28 additions & 0 deletions argmin-math/ndarray-linalg-tests/ndarray_0_14/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[package]
name = "ndarray_0_14"
version = "0.0.0"
edition = "2021"
publish = false

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dev-dependencies]
argmin-math = { path = "../../", version = "0.3", default-features=false, features = [
"ndarray_v0_14",
] }
ndarray = { version = "0.14", default-features = false }
ndarray-linalg = { version = "0.13", features = ["intel-mkl-static"] }
num-complex = { version = "0.3", default-features = false, features = ["std"] }
num-traits = { version = "0.2" }
num-integer = { version = "0.1" }
# Higher versions break intel-mkl-tool: https://github.com/rust-math/intel-mkl-src/issues/68#issue-1065394662
anyhow = { version = "<=1.0.48" }
paste = "1"
approx = "0.5.0"
rand = "*" # Should unify with whatever is currently used in argmin itself

[features]
serde = ["argmin-math/ndarray_v0_14-serde"]

# To make it explicit that this package is not part of the overall argmin workspace for the purpose of dependency unification
[workspace]
51 changes: 51 additions & 0 deletions argmin-math/ndarray-linalg-tests/ndarray_0_14/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
mod add {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/add.rs"));
}
mod conj {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/conj.rs"));
}
mod div {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/div.rs"));
}
mod dot {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/dot.rs"));
}
mod eye {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/eye.rs"));
}
mod inv {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/inv.rs"));
}
mod l1norm {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/l1norm.rs"));
}
mod l2norm {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/l2norm.rs"));
}
mod minmax {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/minmax.rs"));
}
mod mul {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/mul.rs"));
}
mod random {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/random.rs"));
}
mod scaledadd {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/scaledadd.rs"));
}
mod scaledsub {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/scaledsub.rs"));
}
mod signum {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/signum.rs"));
}
mod sub {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/sub.rs"));
}
mod transpose {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/transpose.rs"));
}
mod zero {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/zero.rs"));
}
26 changes: 26 additions & 0 deletions argmin-math/ndarray-linalg-tests/ndarray_0_15/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[package]
name = "ndarray_0_15"
version = "0.0.0"
edition = "2021"
publish = false

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dev-dependencies]
argmin-math = { path = "../../", version = "0.3", features = [
"ndarray_v0_15",
] }
ndarray = { version = "0.15", default-features = false }
ndarray-linalg = { version = "0.16", default-features = false, features = ["intel-mkl-static"] }
num-complex = { version = "0.4", default-features = false }
num-traits = { version = "0.2", default-features = false }
num-integer = { version = "0.1", default-features = false }
paste = "1"
approx = "0.5.0"
rand = "*" # Should unify with whatever is currently used in argmin itself

[features]
serde = ["argmin-math/ndarray_v0_15-serde"]

# To make it explicit that this package is not part of the overall argmin workspace for the purpose of dependency unification
[workspace]
51 changes: 51 additions & 0 deletions argmin-math/ndarray-linalg-tests/ndarray_0_15/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
mod add {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/add.rs"));
}
mod conj {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/conj.rs"));
}
mod div {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/div.rs"));
}
mod dot {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/dot.rs"));
}
mod eye {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/eye.rs"));
}
mod inv {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/inv.rs"));
}
mod l1norm {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/l1norm.rs"));
}
mod l2norm {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/l2norm.rs"));
}
mod minmax {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/minmax.rs"));
}
mod mul {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/mul.rs"));
}
mod random {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/random.rs"));
}
mod scaledadd {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/scaledadd.rs"));
}
mod scaledsub {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/scaledsub.rs"));
}
mod signum {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/signum.rs"));
}
mod sub {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/sub.rs"));
}
mod transpose {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/transpose.rs"));
}
mod zero {
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../ndarray-tests-src/zero.rs"));
}
26 changes: 26 additions & 0 deletions argmin-math/ndarray-linalg-tests/ndarray_latest/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[package]
name = "ndarray_latest"
version = "0.0.0"
edition = "2021"
publish = false

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dev-dependencies]
argmin-math = { path = "../../", version = "0.3", features = [
"ndarray_latest",
] }
ndarray = { version = "0.15", default-features = false }
ndarray-linalg = { version = "0.16", default-features = false, features = ["intel-mkl-static"] }
num-complex = { version = "0.4", default-features = false }
num-traits = { version = "0.2", default-features = false }
num-integer = { version = "0.1", default-features = false }
paste = "1"
approx = "0.5.0"
rand = "*" # Should unify with whatever is currently used in argmin itself

[features]
serde = ["argmin-math/ndarray_latest-serde"]

# To make it explicit that this package is not part of the overall argmin workspace for the purpose of dependency unification
[workspace]
Loading
Loading