Skip to content

Update docs #130

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

Merged
merged 3 commits into from
Dec 7, 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
7 changes: 6 additions & 1 deletion .github/workflows/openblas-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ on:
push:
branches:
- master
pull_request: {}
paths:
- 'openblas-build/**'
- '.github/workflows/openblas-build.yml'
pull_request:
paths:
- 'openblas-build/**'
workflow_dispatch: {}

jobs:
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/openblas-src.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,17 @@ on:
push:
branches:
- master
pull_request: {}
paths:
- 'openblas-build/**'
- 'openblas-src/**'
- '.github/workflows/openblas-src.yml'
- '*.toml'
pull_request:
paths:
- 'openblas-build/**'
- 'openblas-src/**'
- '.github/workflows/openblas-src.yml'
- '*.toml'
workflow_dispatch: {}

jobs:
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ on:
push:
branches:
- master
pull_request: {}
pull_request:
paths:
- 'openblas-build/**'
- 'openblas-src/**'
- '.github/workflows/rust.yml'
- '*.toml'
workflow_dispatch: {}

jobs:
Expand Down
51 changes: 46 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,51 @@
These versions are based on [semantic versioning][semver], and corresponds to the version in [openblas-src/Cargo.toml](openblas-src/Cargo.toml).
# CHANGELOG

[semver]: https://semver.org/

Unreleased
[Unreleased](https://github.com/blas-lapack-rs/openblas-src/compare/openblas-src-v0.10.8...master)
-----------

### What's Changed

* Take proxy environment variables into account by @xoolive in https://github.com/blas-lapack-rs/openblas-src/pull/120
* rewrite CI by @gkobeaga and @Dirreke in https://github.com/blas-lapack-rs/openblas-src/pull/123
* Update OpenBLAS to version 0.3.28 by @Dirreke in https://github.com/blas-lapack-rs/openblas-src/pull/119
* Use pkg-config and fix build on doc.rs by @Fuuzetsu ,@j-baker and @HenrikJStromberg in https://github.com/blas-lapack-rs/openblas-src/pull/125
* Add cache for windows CI by @Dirreke in https://github.com/blas-lapack-rs/openblas-src/pull/128
Refactor code, Drop LAPACKE inspection, Drop FORTRAN check by @Dirreke in https://github.com/blas-lapack-rs/openblas-src/pull/127
* Detect TARGET, CC, HOSTCC, FC automically when cross-compiling by @Dirreke in https://github.com/blas-lapack-rs/openblas-src/pull/129
* Update README and CHANGELOGS by @Dirreke in https://github.com/blas-lapack-rs/openblas-src/pull/130

[0.10.9 - 2022-12-25](https://github.com/blas-lapack-rs/openblas-src/compare/openblas-src-v0.10.8...openblas-src-v0.10.9)
--------------------

### What's Changed

* Use ubuntu 22.04 image on CI by @termoshtt in https://github.com/blas-lapack-rs/openblas-src/pull/110
* OpenBLAS v0.3.25 & Extended Target Support & Build Fixes by @gkobeaga in https://github.com/blas-lapack-rs/openblas-src/pull/108
* add rerun-if flags by @Dirreke in https://github.com/blas-lapack-rs/openblas-src/pull/105
* respect OPENBLAS_{{CC, FC, HOSTCC}} env vars on linux by @mike-kfed in https://github.com/blas-lapack-rs/openblas-src/pull/102
* Use macos-14 instance for CI by @termoshtt in https://github.com/blas-lapack-rs/openblas-src/pull/112

[0.10.8 - 2022-12-25](https://github.com/blas-lapack-rs/openblas-src/compare/openblas-src-v0.10.7...openblas-src-v0.10.8)
--------------------

### What's Changed

* Use native-tls/native-certs features of ureq crate by @lazareviczoran in https://github.com/blas-lapack-rs/openblas-src/pull/98

[0.10.7 - 2022-12-25](https://github.com/blas-lapack-rs/openblas-src/compare/openblas-src-v0.10.5...openblas-src-v0.10.7)
--------------------

0.10.6 has been yanked

### What's Changed

* homebrew directory depends on architecture. Include libomp libs by @maparent in https://github.com/blas-lapack-rs/openblas-src/pull/89
* Use `brew --prefix` command to get library path by @termoshtt in https://github.com/blas-lapack-rs/openblas-src/pull/93
* Upgrade OpenBLAS to 0.3.21 by @termoshtt in https://github.com/blas-lapack-rs/openblas-src/pull/92
* Use tar.gz image of OpenBLAS by @termoshtt in https://github.com/blas-lapack-rs/openblas-src/pull/95
* Expand tar.gz on `OUT_DIR` by @termoshtt in https://github.com/blas-lapack-rs/openblas-src/pull/96
* Download OpenBLAS source code from GitHub Release in build.rs by @termoshtt in https://github.com/blas-lapack-rs/openblas-src/pull/97

0.10.5 - 2022-08-27
--------------------

Expand All @@ -15,7 +56,7 @@ From this release, `openblas-build` crate will have same version as `openblas-sr

### Changed
- OpenBLAS 0.3.20 https://github.com/blas-lapack-rs/openblas-src/pull/85
- OpenBLAS 0.3.17 https://github.com/blas-lapack-rs/openblas-src/pull/76
- OpenBLAS 0.3.17 https://github.com/blas-lapack-rs/openblas-src/pull/76
- Use dynamic CRT link for vcpkg https://github.com/blas-lapack-rs/openblas-src/pull/69 https://github.com/blas-lapack-rs/openblas-src/pull/71

### Internal
Expand Down
92 changes: 82 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,25 @@ The following Cargo features are supported:
* `cache` to build in a shared directory instead of `target` (see below),
* `cblas` to build CBLAS (enabled by default),
* `lapacke` to build LAPACKE (enabled by default),
* `static` to link to OpenBLAS statically, and
* `static` to link to OpenBLAS statically,
* `system` to skip building the bundled OpenBLAS.

Note: On Windows, OpenBLAS can not be built from source. The `system` feature is
supposed to be used.

## Dependencies

If you want to build OpenBLAS from source, you need to have the following dependencies
installed:

* HOSTCC compiler (e.g., `gcc`, `clang`, or `icc`),
* `make`,
* CC compiler of the target architecture (e.g., `aarch64-linux-gnu-gcc` for `aarch64`),
* Fortran compiler of the target architecture(e.g., `gfortran`, `flang`, or `ifort`),
if there is no Fortran compiler detected, the flag `NOFORTRAN` should be set to `1`
and `OpenBLAS` will only compile BLAS and f2c-converted LAPACK. For more information,
please refer to the [Use f2c translations of LAPACK when no Fortran compiler is available][f2c-translations].

## Caching

The `cache` feature allows the OpenBLAS build products to be reused between
Expand Down Expand Up @@ -45,31 +61,84 @@ To link OpenBLAS statically, install `openblas` for the `x64-windows-static-md`
vcpkg install openblas --triplet x64-windows-static-md
```

To link OpenBLAS and C Runtime (CRT) statically, install `openblas` for the `x64-windows-static` triplet:
To link OpenBLAS and C Runtime (CRT) statically, install `openblas` for the
`x64-windows-static` triplet:

```sh
vcpkg install openblas --triplet x64-windows-static
```

and build with `+crt-static` option

```
```sh
RUSTFLAGS='-C target-feature=+crt-static' cargo build --target x86_64-pc-windows-msvc
```

Please see the ["Static and dynamic C runtimes" in The Rust reference](https://doc.rust-lang.org/reference/linkage.html#static-and-dynamic-c-runtimes) for detail.
Please see the ["Static and dynamic C runtimes" in The Rust reference][crt-static] for detail.

## ENV variables

## Cross Compilation
### Proxy

The `openblas-src` crate will detect and use proxy settings from your environment
variables, such as `http_proxy` and `https_proxy` to download necessary dependencies.

### Build System through OpenBLAS

According to the [OpenbLAS build system], the variables used by OpenBLAS could be
passed through environment, such as `DYNAMIC_LIST`, `NUM_THREADS`.

**HOWEVER**, for some of the variables, the `openblas-src` crate rename them to
others to avoid conflicts with the existing envs. The following is the list of
the variables that are renamed:

| OpenBLAS variable | openblas-src variable |
| ----------------- | --------------------- |
| TARGET | OPENBLAS_TARGET |
| CC | OPENBLAS_CC |
| FC | OPENBLAS_FC |
| HOSTCC | OPENBLAS_HOSTCC |
| RANLIB | OPENBLAS_RANLIB |

## Cross-compile

Apart from providing the `--target` option to `cargo build`, one also has to
specify the [cross-compilation variables of OpenBLAS][openblas-cross-compile].
They can be set as environment variables for `cargo build` using the `OPENBLAS_`
prefix as follows: `OPENBLAS_CC`, `OPENBLAS_FC`, `OPENBLAS_HOSTCC`, and
`OPENBLAS_TARGET`.

## Proxy issues

The `openblas-src` crate will detect and use proxy settings from your environment variables, such as `http_proxy` and `https_proxy` to download necessary dependencies.
If you do not set these variables, the `openblas-build` will try to detect them.

For `OPENBLAS_TARGET`, the basic target that corresponds to the arch of `--target`
will be used.

| Rust target | OpenBLAS target |
| ----------- | --------------- |
| aarch64 | ARMV8 |
| arm | ARMV6 |
| armv5te | ARMV5 |
| armv6 | ARMV6 |
| armv7 | ARMV7 |
| loongarch64 | LOONGSONGENERIC |
| mips64 | MIPS64_GENERIC |
| mips64el | MIPS64_GENERIC |
| riscv64 | RISCV64_GENERIC |
| csky | CK860FV |
| sparc | SPARCV7 |

For `OPENBLAS_CC` and `OPENBLAS_HOSTCC`, the `cc` crate will be used to detect
the compiler. Please refer to the [cc documentation](https://docs.rs/cc/latest/cc/)
for more information.

For `OPENBLAS_FC`, `openblas-build` will try to detect the compiler through the
`OPENBLAS_CC` set above. It will replace the `gcc` with `gfortran`, `clang` with
`flang`, and `icc` with `ifort` and then test if the Fortran compiler exists.

Note: If there is no Fortran compiler detected, the build flag `NOFORTRAN` will
be set to `1` and `OpenBLAS` will only compile BLAS and f2c-converted LAPACK.
For more information, please refer to the
[Use f2c translations of LAPACK when no Fortran compiler is available][f2c-translations].

## Contribution

Expand All @@ -80,9 +149,12 @@ will be licensed according to the terms given in [LICENSE.md](LICENSE.md).
[architecture]: https://blas-lapack-rs.github.io/architecture
[blas]: https://en.wikipedia.org/wiki/BLAS
[lapack]: https://en.wikipedia.org/wiki/LAPACK
[openblas]: http://www.openblas.net/
[openblas-cross-compile]: https://github.com/xianyi/OpenBLAS#cross-compile
[OpenBLAS]: http://www.openmathlib.org/OpenBLAS/
[openblas-cross-compile]: http://www.openmathlib.org/OpenBLAS/docs/user_manual/#cross-compile
[OpenbLAS build system]: http://www.openmathlib.org/OpenBLAS/docs/build_system/
[vcpkg]: https://github.com/Microsoft/vcpkg
[f2c-translations]: https://github.com/OpenMathLib/OpenBLAS/pull/3539
[crt-static]: https://doc.rust-lang.org/reference/linkage.html#static-and-dynamic-c-runtimes

[build-img]: https://github.com/blas-lapack-rs/openblas-src/workflows/Rust/badge.svg
[build-url]: https://github.com/blas-lapack-rs/openblas-src/actions?query=workflow%3ARust
Expand Down
Loading