Skip to content

Commit f98e5c0

Browse files
committed
API: Drop direct blas-src dependency, update docs for blas integration
We can in theory unchain ourselves from the blas-src version and let the user be responsible for linking in blas in the final product. Update xtest-blas to test this configuration. Update instructions in readme for how to use it.
1 parent fdbc884 commit f98e5c0

File tree

5 files changed

+23
-13
lines changed

5 files changed

+23
-13
lines changed

Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ approx = { version = "0.4", optional = true , default-features = false }
3939

4040
# Use via the `blas` crate feature!
4141
cblas-sys = { version = "0.1.4", optional = true, default-features = false }
42-
blas-src = { version = "0.7.0", optional = true, default-features = false }
4342
libc = { version = "0.2.82", optional = true }
4443

4544
matrixmultiply = { version = "0.3.0", default-features = false}
@@ -58,7 +57,7 @@ default = ["std"]
5857

5958
# Enable blas usage
6059
# See README for more instructions
61-
blas = ["cblas-sys", "blas-src", "libc"]
60+
blas = ["cblas-sys", "libc"]
6261

6362
# Old name for the serde feature
6463
serde-1 = ["serde"]

README.rst

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,21 +96,34 @@ How to use with cargo
9696
::
9797

9898
[dependencies]
99-
ndarray = "0.14.0"
99+
ndarray = "0.15.0"
100100

101-
How to enable blas integration. Depend on ``blas-src`` directly to pick a blas
102-
provider. Depend on the same ``blas-src`` version as ``ndarray`` does, for the
103-
selection to work. An example configuration using system openblas is shown
104-
below. Note that only end-user projects (not libraries) should select
105-
provider::
101+
How to enable blas integration
102+
-----------------------------
106103

104+
Blas integration is an optional add-on.
105+
106+
Depend and link to ``blas-src`` directly to pick a blas provider. Ndarray
107+
presently requires a blas provider that provides the ``cblas-sys`` interface. If
108+
further feature selection is needed then you might need to depend directly on
109+
the backend crate's source too (for example ``openblas-src``, to select
110+
``cblas``). The backend version **must** be the one that ``blas-src`` also
111+
depends on.
112+
113+
An example configuration using system openblas is shown below. Note that only
114+
end-user projects (not libraries) should select provider::
107115

108116
[dependencies]
109-
ndarray = { version = "0.14.0", features = ["blas"] }
117+
ndarray = { version = "0.15.0", features = ["blas"] }
110118
blas-src = { version = "0.7.0", default-features = false, features = ["openblas"] }
111119
openblas-src = { version = "0.9", default-features = false, features = ["cblas", "system"] }
112120

113-
For official releases of ``ndarray``, the versions are:
121+
When this is done, your program must also link to ``blas_src`` by using it or
122+
explicitly including it in your code::
123+
124+
extern crate blas_src;
125+
126+
For official releases of ``ndarray``, versions that have been verified to work are:
114127

115128
=========== ============ ================
116129
``ndarray`` ``blas-src`` ``openblas-src``

src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,6 @@ extern crate std;
124124
#[cfg(not(feature = "std"))]
125125
extern crate core as std;
126126

127-
#[cfg(feature = "blas")]
128-
extern crate blas_src;
129127
#[cfg(feature = "blas")]
130128
extern crate cblas_sys;
131129

xtest-blas/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-

xtest-blas/tests/oper.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ extern crate approx;
22
extern crate defmac;
33
extern crate ndarray;
44
extern crate num_traits;
5+
extern crate blas_src;
56

67
use ndarray::linalg::general_mat_mul;
78
use ndarray::linalg::general_mat_vec_mul;

0 commit comments

Comments
 (0)