Skip to content

Commit

Permalink
Merge branch 'rust-ndarray:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
benkay86 authored Oct 24, 2024
2 parents 3373ea9 + 492b274 commit 3161ffe
Show file tree
Hide file tree
Showing 172 changed files with 8,954 additions and 5,135 deletions.
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# rustfmt codebase (gh-1375)
d07f5f33800e5240e7edb02bdbc4815ab30ef37e
164 changes: 164 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
on:
pull_request:
merge_group:
push:
branches:
- master

name: Continuous integration

env:
CARGO_TERM_COLOR: always
HOST: x86_64-unknown-linux-gnu
FEATURES: "test docs"
RUSTFLAGS: "-D warnings"

jobs:
clippy:
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
name: clippy/${{ matrix.rust }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
components: clippy
- uses: Swatinem/rust-cache@v2
- run: cargo clippy --features docs

format:
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- nightly
name: format/${{ matrix.rust }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
components: rustfmt
- run: cargo fmt --all --check

nostd:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
include:
- rust: stable
experimental: false
target: thumbv6m-none-eabi

name: nostd/${{ matrix.target }}/${{ matrix.rust }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
targets: ${{ matrix.target }}
- name: Tests
run: |
cargo rustc "--target=${{ matrix.target }}" --no-default-features --features portable-atomic-critical-section
tests:
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
- beta
- nightly
- 1.64.0 # MSRV

name: tests/${{ matrix.rust }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- uses: rui314/setup-mold@v1
- uses: Swatinem/rust-cache@v2
- name: Install openblas
run: sudo apt-get install libopenblas-dev gfortran
- run: ./scripts/all-tests.sh "$FEATURES" ${{ matrix.rust }}

cross_test:
#if: ${{ github.event_name == 'merge_group' }}
runs-on: ubuntu-latest
strategy:
matrix:
include:
- rust: stable
target: s390x-unknown-linux-gnu
- rust: stable
target: i686-unknown-linux-gnu

name: cross_test/${{ matrix.target }}/${{ matrix.rust }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
targets: ${{ matrix.target }}
- uses: rui314/setup-mold@v1
- uses: Swatinem/rust-cache@v2
- name: Install cross
run: cargo install cross
- run: ./scripts/cross-tests.sh "docs" ${{ matrix.rust }} ${{ matrix.target }}

cargo-careful:
#if: ${{ github.event_name == 'merge_group' }}
runs-on: ubuntu-latest
name: cargo-careful
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
- uses: Swatinem/rust-cache@v2
- name: Install cargo-careful
run: cargo install cargo-careful
- run: cargo careful test -Zcareful-sanitizer --features="$FEATURES"

docs:
#if: ${{ github.event_name == 'merge_group' }}
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
name: docs/${{ matrix.rust }}
env:
RUSTDOCFLAGS: "-Dwarnings"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- run: cargo doc --no-deps --all-features

conclusion:
needs:
- clippy
- format # should format be required?
- nostd
- tests
- cross_test
- cargo-careful
- docs
if: always()
runs-on: ubuntu-latest
steps:
- name: Result
run: |
jq -C <<< "${needs}"
# Check if all needs were successful or skipped.
"$(jq -r 'all(.result as $result | (["success", "skipped"] | contains([$result])))' <<< "${needs}")"
env:
needs: ${{ toJson(needs) }}
79 changes: 0 additions & 79 deletions .github/workflows/ci.yml

This file was deleted.

5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
# Rust items
Cargo.lock
target/

# Editor settings
.vscode
.idea
82 changes: 59 additions & 23 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[package]

name = "ndarray"
version = "0.15.6"
version = "0.16.1"
edition = "2018"
rust-version = "1.51"
rust-version = "1.64"
authors = [
"Ulrik Sverdrup \"bluss\"",
"Jim Turner"
Expand All @@ -20,25 +20,23 @@ keywords = ["array", "data-structure", "multidimensional", "matrix", "blas"]
categories = ["data-structures", "science"]

exclude = ["docgen/images/*"]
resolver = "2"

[lib]
name = "ndarray"
bench = false
test = true

[dependencies]
num-integer = { version = "0.1.39", default-features = false }
num-traits = { version = "0.2", default-features = false }
num-complex = { version = "0.4", default-features = false }
num-integer = { workspace = true }
num-traits = { workspace = true }
num-complex = { workspace = true }

# Use via the `rayon` crate feature!
rayon_ = { version = "1.0.3", optional = true, package = "rayon" }
approx = { workspace = true, optional = true }
rayon = { version = "1.10.0", optional = true }

approx = { version = "0.4", optional = true , default-features = false }
approx-0_5 = { package = "approx", version = "0.5", optional = true , default-features = false }

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

matrixmultiply = { version = "0.3.2", default-features = false, features=["cgemm"] }
Expand All @@ -48,38 +46,76 @@ rawpointer = { version = "0.2" }

[dev-dependencies]
defmac = "0.2"
quickcheck = { version = "1.0", default-features = false }
approx = "0.4"
itertools = { version = "0.10.0", default-features = false, features = ["use_std"] }
quickcheck = { workspace = true }
approx = { workspace = true, default-features = true }
itertools = { workspace = true }
ndarray-gen = { workspace = true }

[features]
default = ["std"]

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

serde = ["dep:serde"]
# Old name for the serde feature
serde-1 = ["serde"]
serde-1 = ["dep:serde"]

# These features are used for testing
test = []

# This feature is used for docs
docs = ["approx", "approx-0_5", "serde", "rayon"]
docs = ["approx", "serde", "rayon"]

std = ["num-traits/std", "matrixmultiply/std"]
rayon = ["rayon_", "std"]
rayon = ["dep:rayon", "std"]

matrixmultiply-threading = ["matrixmultiply/threading"]

[profile.release]
portable-atomic-critical-section = ["portable-atomic/critical-section"]


[target.'cfg(not(target_has_atomic = "ptr"))'.dependencies]
portable-atomic = { version = "1.6.0" }
portable-atomic-util = { version = "0.2.0", features = [ "alloc" ] }

[workspace]
members = [
"ndarray-rand",
"crates/*",
]
default-members = [
".",
"ndarray-rand",
"crates/ndarray-gen",
"crates/numeric-tests",
"crates/serialization-tests",
# exclude blas-tests and blas-mock-tests that activate "blas" feature
]

[workspace.dependencies]
ndarray = { version = "0.16", path = ".", default-features = false }
ndarray-rand = { path = "ndarray-rand" }
ndarray-gen = { path = "crates/ndarray-gen" }

num-integer = { version = "0.1.39", default-features = false }
num-traits = { version = "0.2", default-features = false }
num-complex = { version = "0.4", default-features = false }
approx = { version = "0.5", default-features = false }
quickcheck = { version = "1.0", default-features = false }
rand = { version = "0.8.0", features = ["small_rng"] }
rand_distr = { version = "0.4.0" }
itertools = { version = "0.13.0", default-features = false, features = ["use_std"] }
cblas-sys = { version = "0.1.4", default-features = false }

[profile.bench]
debug = true

[workspace]
members = ["ndarray-rand", "xtest-serialization", "xtest-blas"]
exclude = ["xtest-numeric"]
[profile.test.package.numeric-tests]
opt-level = 2
[profile.test.package.blas-tests]
opt-level = 2

[package.metadata.release]
no-dev-version = true
Expand Down
Loading

0 comments on commit 3161ffe

Please sign in to comment.