forked from Trombach/argmin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Factored out argmin-math tests into separate package
Due to the additivity requirement on cargo features even for features that are not enabled simultaneously, together with the requirement that only one crate in the dependency tree specifies any `links` attribute, it was not possible to test multiple backend versions for ndarray-linalg by features: argmin-rs#368 (comment) Previously this approach worked for different versions of ndarray-linalg insofar as the used backend `netlib` just coincidentally remained the same for all tested ndarray-linalg versions. This is not the case for the intel-mkl backend, which is desirable to use as the default because it works on all three major platforms. To enable the change of the backend as well as make the testing more robust against future changes in ndarray-linalg backend versions, the tests were factored out into their own crates. This works because the strict additivity requirement for inactive features is not enforced for dependencies: rust-lang/cargo#5969 (comment)
- Loading branch information
1 parent
1aadc56
commit e99cc5c
Showing
48 changed files
with
2,927 additions
and
2,324 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,5 @@ members = [ | |
|
||
exclude = [ | ||
"media/book/tests", | ||
"argmin-math-ndarray-linalg-tests", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 even when they are not active and because only one crate can specify a `links` flag in a given dependency graph. This is mainly necessary for the backend dependency of ndarray-linalg. | ||
Read more here: https://github.com/argmin-rs/argmin/issues/368#issue-1929115127 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[package] | ||
name = "ndarray_0_13" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dev-dependencies] | ||
argmin-math = { path = "../../argmin-math", 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" | ||
|
||
[features] | ||
serde = ["argmin-math/ndarray_v0_13-serde"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
mod add { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/add.rs")); | ||
} | ||
mod conj { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/conj.rs")); | ||
} | ||
mod div { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/div.rs")); | ||
} | ||
mod dot { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/dot.rs")); | ||
} | ||
mod eye { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/eye.rs")); | ||
} | ||
mod inv { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/inv.rs")); | ||
} | ||
mod l1norm { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/l1norm.rs")); | ||
} | ||
mod l2norm { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/l2norm.rs")); | ||
} | ||
mod minmax { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/minmax.rs")); | ||
} | ||
mod mul { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/mul.rs")); | ||
} | ||
mod random { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/random.rs")); | ||
} | ||
mod scaledadd { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/scaledadd.rs")); | ||
} | ||
mod scaledsub { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/scaledsub.rs")); | ||
} | ||
mod signum { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/signum.rs")); | ||
} | ||
mod sub { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/sub.rs")); | ||
} | ||
mod transpose { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/transpose.rs")); | ||
} | ||
mod zero { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/zero.rs")); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
[package] | ||
name = "ndarray_0_14" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dev-dependencies] | ||
argmin-math = { path = "../../argmin-math", 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"] } | ||
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" | ||
|
||
[features] | ||
serde = ["argmin-math/ndarray_v0_14-serde"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
mod add { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/add.rs")); | ||
} | ||
mod conj { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/conj.rs")); | ||
} | ||
mod div { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/div.rs")); | ||
} | ||
mod dot { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/dot.rs")); | ||
} | ||
mod eye { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/eye.rs")); | ||
} | ||
mod inv { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/inv.rs")); | ||
} | ||
mod l1norm { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/l1norm.rs")); | ||
} | ||
mod l2norm { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/l2norm.rs")); | ||
} | ||
mod minmax { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/minmax.rs")); | ||
} | ||
mod mul { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/mul.rs")); | ||
} | ||
mod random { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/random.rs")); | ||
} | ||
mod scaledadd { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/scaledadd.rs")); | ||
} | ||
mod scaledsub { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/scaledsub.rs")); | ||
} | ||
mod signum { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/signum.rs")); | ||
} | ||
mod sub { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/sub.rs")); | ||
} | ||
mod transpose { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/transpose.rs")); | ||
} | ||
mod zero { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/zero.rs")); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[package] | ||
name = "ndarray_0_15" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dev-dependencies] | ||
argmin-math = { path = "../../argmin-math", 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"] } | ||
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" | ||
|
||
[features] | ||
serde = ["argmin-math/ndarray_v0_15-serde"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
mod add { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/add.rs")); | ||
} | ||
mod conj { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/conj.rs")); | ||
} | ||
mod div { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/div.rs")); | ||
} | ||
mod dot { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/dot.rs")); | ||
} | ||
mod eye { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/eye.rs")); | ||
} | ||
mod inv { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/inv.rs")); | ||
} | ||
mod l1norm { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/l1norm.rs")); | ||
} | ||
mod l2norm { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/l2norm.rs")); | ||
} | ||
mod minmax { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/minmax.rs")); | ||
} | ||
mod mul { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/mul.rs")); | ||
} | ||
mod random { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/random.rs")); | ||
} | ||
mod scaledadd { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/scaledadd.rs")); | ||
} | ||
mod scaledsub { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/scaledsub.rs")); | ||
} | ||
mod signum { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/signum.rs")); | ||
} | ||
mod sub { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/sub.rs")); | ||
} | ||
mod transpose { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/transpose.rs")); | ||
} | ||
mod zero { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/zero.rs")); | ||
} |
21 changes: 21 additions & 0 deletions
21
argmin-math-ndarray-linalg-tests/ndarray_latest/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[package] | ||
name = "ndarray_latest" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dev-dependencies] | ||
argmin-math = { path = "../../argmin-math", version = "0.3", features = [ | ||
"ndarray_latest", | ||
] } | ||
ndarray = { version = "0.15", default-features = false } | ||
ndarray-linalg = { version = "0.16", default-features = false, features = ["intel-mkl"] } | ||
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" | ||
|
||
[features] | ||
serde = ["argmin-math/ndarray_latest-serde"] |
51 changes: 51 additions & 0 deletions
51
argmin-math-ndarray-linalg-tests/ndarray_latest/src/lib.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
mod add { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/add.rs")); | ||
} | ||
mod conj { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/conj.rs")); | ||
} | ||
mod div { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/div.rs")); | ||
} | ||
mod dot { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/dot.rs")); | ||
} | ||
mod eye { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/eye.rs")); | ||
} | ||
mod inv { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/inv.rs")); | ||
} | ||
mod l1norm { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/l1norm.rs")); | ||
} | ||
mod l2norm { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/l2norm.rs")); | ||
} | ||
mod minmax { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/minmax.rs")); | ||
} | ||
mod mul { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/mul.rs")); | ||
} | ||
mod random { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/random.rs")); | ||
} | ||
mod scaledadd { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/scaledadd.rs")); | ||
} | ||
mod scaledsub { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/scaledsub.rs")); | ||
} | ||
mod signum { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/signum.rs")); | ||
} | ||
mod sub { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/sub.rs")); | ||
} | ||
mod transpose { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/transpose.rs")); | ||
} | ||
mod zero { | ||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/../src/zero.rs")); | ||
} |
Oops, something went wrong.