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

Drop direct blas-src dependency, update docs for blas integration #951

Merged
merged 2 commits into from Mar 25, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions Cargo.toml
Expand Up @@ -39,7 +39,6 @@ approx = { version = "0.4", optional = true , default-features = false }

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

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

# Enable blas usage
# See README for more instructions
blas = ["cblas-sys", "blas-src", "libc"]
blas = ["cblas-sys", "libc"]

# Old name for the serde feature
serde-1 = ["serde"]
Expand Down
29 changes: 21 additions & 8 deletions README.rst
Expand Up @@ -96,21 +96,34 @@ How to use with cargo
::

[dependencies]
ndarray = "0.14.0"
ndarray = "0.15.0"

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

Blas integration is an optional add-on.

Depend and link to ``blas-src`` directly to pick a blas provider. Ndarray
presently requires a blas provider that provides the ``cblas-sys`` interface. If
further feature selection is needed then you might need to depend directly on
the backend crate's source too (for example ``openblas-src``, to select
``cblas``). The backend version **must** be the one that ``blas-src`` also
depends on.

An example configuration using system openblas is shown below. Note that only
end-user projects (not libraries) should select provider::

[dependencies]
ndarray = { version = "0.14.0", features = ["blas"] }
ndarray = { version = "0.15.0", features = ["blas"] }
blas-src = { version = "0.7.0", default-features = false, features = ["openblas"] }
openblas-src = { version = "0.9", default-features = false, features = ["cblas", "system"] }

For official releases of ``ndarray``, the versions are:
When this is done, your program must also link to ``blas_src`` by using it or
explicitly including it in your code::

extern crate blas_src;

For official releases of ``ndarray``, versions that have been verified to work are:

=========== ============ ================
``ndarray`` ``blas-src`` ``openblas-src``
Expand Down
2 changes: 0 additions & 2 deletions src/lib.rs
Expand Up @@ -124,8 +124,6 @@ extern crate std;
#[cfg(not(feature = "std"))]
extern crate core as std;

#[cfg(feature = "blas")]
extern crate blas_src;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the main feature in the old solution - when we don't link this, the end user has to.

#[cfg(feature = "blas")]
extern crate cblas_sys;

Expand Down
1 change: 0 additions & 1 deletion xtest-blas/src/lib.rs
@@ -1 +0,0 @@

1 change: 1 addition & 0 deletions xtest-blas/tests/oper.rs
Expand Up @@ -2,6 +2,7 @@ extern crate approx;
extern crate defmac;
extern crate ndarray;
extern crate num_traits;
extern crate blas_src;

use ndarray::linalg::general_mat_mul;
use ndarray::linalg::general_mat_vec_mul;
Expand Down