From 44980b5e7b276769a1eb6bf7c16374cedf1e47c5 Mon Sep 17 00:00:00 2001 From: Adam Kern Date: Fri, 29 Nov 2024 17:23:18 -0500 Subject: [PATCH 01/11] Changes to BLIS for testing MSRV, since openblas is currently MSRV 1.67 and incompatible with ndarray's MSRV of 1.64 --- .github/workflows/ci.yaml | 2 +- README.rst | 8 ++++++++ crates/numeric-tests/Cargo.toml | 6 ++++-- scripts/all-tests.sh | 12 ++++++++++-- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0f517fac9..600f8ec96 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -85,7 +85,7 @@ jobs: - uses: rui314/setup-mold@v1 - uses: Swatinem/rust-cache@v2 - name: Install openblas - run: sudo apt-get install libopenblas-dev gfortran + run: sudo apt-get install libopenblas-dev gfortran libblis-dev - run: ./scripts/all-tests.sh "$FEATURES" ${{ matrix.rust }} miri: diff --git a/README.rst b/README.rst index abac4c18e..ef6577f13 100644 --- a/README.rst +++ b/README.rst @@ -156,6 +156,14 @@ there is no tight coupling to the ``blas-src`` version, so version selection is 0.13 0.2.0 0.6.0 =========== ============ ================ ============== +------------ +BLAS on MSRV +------------ + +Although ``ndarray`` currently maintains an MSRV of 1.64.0, this is separate from the MSRV (either stated or real) of the various BLAS providers. +As of the time of writing, ``openblas`` currently supports MSRV of 1.67.0. +So, while ``ndarray`` and ``openblas-src`` are compatible, they can only work together with toolchains 1.67.0 or above. + Recent Changes -------------- diff --git a/crates/numeric-tests/Cargo.toml b/crates/numeric-tests/Cargo.toml index 214612258..70774fb9b 100644 --- a/crates/numeric-tests/Cargo.toml +++ b/crates/numeric-tests/Cargo.toml @@ -18,12 +18,14 @@ approx = { workspace = true } rand = { workspace = true } rand_distr = { workspace = true } -blas-src = { optional = true, version = "0.10", default-features = false, features = ["openblas"] } +blas-src = { optional = true, version = "0.10", default-features = false, features = ["blis", "openblas"] } openblas-src = { optional = true, version = "0.10", default-features = false, features = ["cblas", "system"] } +blis-src = { optional = true, version = "0.2.2", features = ["system"] } [dev-dependencies] num-traits = { workspace = true } num-complex = { workspace = true } [features] -test_blas = ["ndarray/blas", "blas-src", "openblas-src"] +test_openblas = ["ndarray/blas", "blas-src", "openblas-src"] +test_blis = ["ndarray/blas", "blas-src", "blis-src"] diff --git a/scripts/all-tests.sh b/scripts/all-tests.sh index b9af6b65a..e425bb7c4 100755 --- a/scripts/all-tests.sh +++ b/scripts/all-tests.sh @@ -23,8 +23,16 @@ cargo test -v -p ndarray -p ndarray-rand --release --features "$FEATURES" $QC_FE # BLAS tests cargo test -p ndarray --lib -v --features blas cargo test -p blas-mock-tests -v -cargo test -p blas-tests -v --features blas-tests/openblas-system -cargo test -p numeric-tests -v --features numeric-tests/test_blas +if [ "$CHANNEL" == "1.64.0" ]; then + cargo test -p blas-tests -v --features blas-tests/blis-system +else + cargo test -p blas-tests -v --features blas-tests/openblas-system +fi +if [ "$CHANNEL" == "1.64.0" ]; then + cargo test -p numeric-tests -v --features numeric-tests/test_blis +else + cargo test -p numeric-tests -v --features numeric-tests/test_blas +fi # Examples cargo test --examples From 2eeda951f97e93fcd27da0904a0b356b57283c54 Mon Sep 17 00:00:00 2001 From: Adam Kern Date: Fri, 29 Nov 2024 17:29:04 -0500 Subject: [PATCH 02/11] Adds enabling blas under blis for numeric-tests --- crates/numeric-tests/Cargo.toml | 2 +- crates/numeric-tests/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/numeric-tests/Cargo.toml b/crates/numeric-tests/Cargo.toml index 70774fb9b..cb8044209 100644 --- a/crates/numeric-tests/Cargo.toml +++ b/crates/numeric-tests/Cargo.toml @@ -27,5 +27,5 @@ num-traits = { workspace = true } num-complex = { workspace = true } [features] -test_openblas = ["ndarray/blas", "blas-src", "openblas-src"] +test_blas = ["ndarray/blas", "blas-src", "openblas-src"] test_blis = ["ndarray/blas", "blas-src", "blis-src"] diff --git a/crates/numeric-tests/src/lib.rs b/crates/numeric-tests/src/lib.rs index 79ffc274e..e057bb1ff 100644 --- a/crates/numeric-tests/src/lib.rs +++ b/crates/numeric-tests/src/lib.rs @@ -1,2 +1,2 @@ -#[cfg(feature = "test_blas")] +#[cfg(any(feature = "test_blas", feature = "test_blis"))] extern crate blas_src; From 7ed6a1383538202960a52cea3f955d8efbf8502f Mon Sep 17 00:00:00 2001 From: Adam Kern Date: Fri, 29 Nov 2024 17:36:15 -0500 Subject: [PATCH 03/11] Fixes conditional comparison in shell script --- scripts/all-tests.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/all-tests.sh b/scripts/all-tests.sh index e425bb7c4..f60a4d7a1 100755 --- a/scripts/all-tests.sh +++ b/scripts/all-tests.sh @@ -23,12 +23,12 @@ cargo test -v -p ndarray -p ndarray-rand --release --features "$FEATURES" $QC_FE # BLAS tests cargo test -p ndarray --lib -v --features blas cargo test -p blas-mock-tests -v -if [ "$CHANNEL" == "1.64.0" ]; then +if [ "$CHANNEL" = "1.64.0" ]; then cargo test -p blas-tests -v --features blas-tests/blis-system else cargo test -p blas-tests -v --features blas-tests/openblas-system fi -if [ "$CHANNEL" == "1.64.0" ]; then +if [ "$CHANNEL" = "1.64.0" ]; then cargo test -p numeric-tests -v --features numeric-tests/test_blis else cargo test -p numeric-tests -v --features numeric-tests/test_blas From aac2283aaf3c0ee98159e06086b23a3732cbc251 Mon Sep 17 00:00:00 2001 From: Adam Kern Date: Fri, 29 Nov 2024 17:44:57 -0500 Subject: [PATCH 04/11] How about a simpler solution? --- crates/numeric-tests/Cargo.toml | 2 -- crates/numeric-tests/src/lib.rs | 2 +- scripts/all-tests.sh | 8 ++------ 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/crates/numeric-tests/Cargo.toml b/crates/numeric-tests/Cargo.toml index cb8044209..b98ca5f29 100644 --- a/crates/numeric-tests/Cargo.toml +++ b/crates/numeric-tests/Cargo.toml @@ -20,7 +20,6 @@ rand_distr = { workspace = true } blas-src = { optional = true, version = "0.10", default-features = false, features = ["blis", "openblas"] } openblas-src = { optional = true, version = "0.10", default-features = false, features = ["cblas", "system"] } -blis-src = { optional = true, version = "0.2.2", features = ["system"] } [dev-dependencies] num-traits = { workspace = true } @@ -28,4 +27,3 @@ num-complex = { workspace = true } [features] test_blas = ["ndarray/blas", "blas-src", "openblas-src"] -test_blis = ["ndarray/blas", "blas-src", "blis-src"] diff --git a/crates/numeric-tests/src/lib.rs b/crates/numeric-tests/src/lib.rs index e057bb1ff..79ffc274e 100644 --- a/crates/numeric-tests/src/lib.rs +++ b/crates/numeric-tests/src/lib.rs @@ -1,2 +1,2 @@ -#[cfg(any(feature = "test_blas", feature = "test_blis"))] +#[cfg(feature = "test_blas")] extern crate blas_src; diff --git a/scripts/all-tests.sh b/scripts/all-tests.sh index f60a4d7a1..5c9f20515 100755 --- a/scripts/all-tests.sh +++ b/scripts/all-tests.sh @@ -24,14 +24,10 @@ cargo test -v -p ndarray -p ndarray-rand --release --features "$FEATURES" $QC_FE cargo test -p ndarray --lib -v --features blas cargo test -p blas-mock-tests -v if [ "$CHANNEL" = "1.64.0" ]; then - cargo test -p blas-tests -v --features blas-tests/blis-system -else - cargo test -p blas-tests -v --features blas-tests/openblas-system + cargo +1.67.0 test -p blas-tests -v --features blas-tests/openblas-system fi if [ "$CHANNEL" = "1.64.0" ]; then - cargo test -p numeric-tests -v --features numeric-tests/test_blis -else - cargo test -p numeric-tests -v --features numeric-tests/test_blas + cargo +1.67.0 test -p numeric-tests -v --features numeric-tests/test_blas fi # Examples From 677a9931b35413ad4d2b41dc1ccb60ff72c81328 Mon Sep 17 00:00:00 2001 From: Adam Kern Date: Fri, 29 Nov 2024 18:15:26 -0500 Subject: [PATCH 05/11] Refactoring to test BLAS MSRV separately --- .github/workflows/ci.yaml | 15 ++++++++++++++- scripts/all-tests.sh | 7 ++----- scripts/blas-integ-tests.sh | 11 +++++++++++ 3 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 scripts/blas-integ-tests.sh diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 600f8ec96..e573f58dc 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -85,9 +85,22 @@ jobs: - uses: rui314/setup-mold@v1 - uses: Swatinem/rust-cache@v2 - name: Install openblas - run: sudo apt-get install libopenblas-dev gfortran libblis-dev + run: sudo apt-get install libopenblas-dev gfortran - run: ./scripts/all-tests.sh "$FEATURES" ${{ matrix.rust }} + test-blas-msrv: + name: tests/blas-msrv + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@master + with: + toolchain: 1.67.0 # BLAS MSRV + - uses: rui314/setup-mold@v1 + - uses: Swatinem/rust-cache@v2 + - name: Install openblas + run: sudo apt-get install libopenblas-dev gfortran + - run: ./scripts/blas-integ-tests.sh "$FEATURES" 1.67.0 + miri: runs-on: ubuntu-latest name: miri diff --git a/scripts/all-tests.sh b/scripts/all-tests.sh index 5c9f20515..e15c57983 100755 --- a/scripts/all-tests.sh +++ b/scripts/all-tests.sh @@ -23,11 +23,8 @@ cargo test -v -p ndarray -p ndarray-rand --release --features "$FEATURES" $QC_FE # BLAS tests cargo test -p ndarray --lib -v --features blas cargo test -p blas-mock-tests -v -if [ "$CHANNEL" = "1.64.0" ]; then - cargo +1.67.0 test -p blas-tests -v --features blas-tests/openblas-system -fi -if [ "$CHANNEL" = "1.64.0" ]; then - cargo +1.67.0 test -p numeric-tests -v --features numeric-tests/test_blas +if [ "$CHANNEL" != "1.64.0" ]; then + ./blas-integ-tests "$FEATURES" $CHANNEL fi # Examples diff --git a/scripts/blas-integ-tests.sh b/scripts/blas-integ-tests.sh new file mode 100644 index 000000000..5192d67e3 --- /dev/null +++ b/scripts/blas-integ-tests.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +set -x +set -e + +FEATURES=$1 +CHANNEL=$2 + +# BLAS tests +cargo test -p blas-tests -v --features blas-tests/openblas-system +cargo test -p numeric-tests -v --features numeric-tests/test_blas From 78d339635499a3ef2b8e57708c9a383e2058aa8b Mon Sep 17 00:00:00 2001 From: Adam Kern Date: Fri, 29 Nov 2024 18:32:51 -0500 Subject: [PATCH 06/11] Changes name of the blas-msrv test --- .github/workflows/ci.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e573f58dc..47f3dc122 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -88,8 +88,8 @@ jobs: run: sudo apt-get install libopenblas-dev gfortran - run: ./scripts/all-tests.sh "$FEATURES" ${{ matrix.rust }} - test-blas-msrv: - name: tests/blas-msrv + blas-msrv: + name: blas-msrv steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master From a55abc5d5c469a199cfa8edb5b71bc371cb8c366 Mon Sep 17 00:00:00 2001 From: Adam Kern Date: Fri, 29 Nov 2024 18:34:34 -0500 Subject: [PATCH 07/11] Forgot the runs-on for blas-msrv? --- .github/workflows/ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 47f3dc122..c910b32e0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -89,6 +89,7 @@ jobs: - run: ./scripts/all-tests.sh "$FEATURES" ${{ matrix.rust }} blas-msrv: + runs-on: ubuntu-latest name: blas-msrv steps: - uses: actions/checkout@v4 From e1db4d5a0383bd311d4b2b07f26f5ca8b02b1689 Mon Sep 17 00:00:00 2001 From: Adam Kern Date: Fri, 29 Nov 2024 18:45:21 -0500 Subject: [PATCH 08/11] Adds executable permissions to blas-integ --- scripts/blas-integ-tests.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/blas-integ-tests.sh diff --git a/scripts/blas-integ-tests.sh b/scripts/blas-integ-tests.sh old mode 100644 new mode 100755 From 7d0f4bc8aa670f29a910a4a5d2ca32bf4583b40e Mon Sep 17 00:00:00 2001 From: Adam Kern Date: Fri, 29 Nov 2024 22:23:49 -0500 Subject: [PATCH 09/11] Removes extra, now-unecessary blis feature --- crates/numeric-tests/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/numeric-tests/Cargo.toml b/crates/numeric-tests/Cargo.toml index b98ca5f29..214612258 100644 --- a/crates/numeric-tests/Cargo.toml +++ b/crates/numeric-tests/Cargo.toml @@ -18,7 +18,7 @@ approx = { workspace = true } rand = { workspace = true } rand_distr = { workspace = true } -blas-src = { optional = true, version = "0.10", default-features = false, features = ["blis", "openblas"] } +blas-src = { optional = true, version = "0.10", default-features = false, features = ["openblas"] } openblas-src = { optional = true, version = "0.10", default-features = false, features = ["cblas", "system"] } [dev-dependencies] From 2dcf280f5d4daa5f9e37da5398d2f103ea61cc91 Mon Sep 17 00:00:00 2001 From: Adam Kern Date: Fri, 29 Nov 2024 23:47:19 -0500 Subject: [PATCH 10/11] Missing .sh extension --- scripts/all-tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/all-tests.sh b/scripts/all-tests.sh index e15c57983..343083c07 100755 --- a/scripts/all-tests.sh +++ b/scripts/all-tests.sh @@ -24,7 +24,7 @@ cargo test -v -p ndarray -p ndarray-rand --release --features "$FEATURES" $QC_FE cargo test -p ndarray --lib -v --features blas cargo test -p blas-mock-tests -v if [ "$CHANNEL" != "1.64.0" ]; then - ./blas-integ-tests "$FEATURES" $CHANNEL + ./blas-integ-tests.sh "$FEATURES" $CHANNEL fi # Examples From df2c6dc00fcc274afbb02500103735f806dbb852 Mon Sep 17 00:00:00 2001 From: Adam Kern Date: Sat, 30 Nov 2024 00:17:08 -0500 Subject: [PATCH 11/11] Path relative to repo root --- scripts/all-tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/all-tests.sh b/scripts/all-tests.sh index 343083c07..e98b90df1 100755 --- a/scripts/all-tests.sh +++ b/scripts/all-tests.sh @@ -24,7 +24,7 @@ cargo test -v -p ndarray -p ndarray-rand --release --features "$FEATURES" $QC_FE cargo test -p ndarray --lib -v --features blas cargo test -p blas-mock-tests -v if [ "$CHANNEL" != "1.64.0" ]; then - ./blas-integ-tests.sh "$FEATURES" $CHANNEL + ./scripts/blas-integ-tests.sh "$FEATURES" $CHANNEL fi # Examples