diff --git a/.github/workflows/CI-nightly.yml b/.github/workflows/CI-nightly.yml index 2c3e94a..41fc943 100644 --- a/.github/workflows/CI-nightly.yml +++ b/.github/workflows/CI-nightly.yml @@ -2,10 +2,12 @@ name: CI (Julia nightly) on: push: branches: - - main - - workflow_dispatch - tags: ['*'] + - 'master' + - 'main' + - 'release-' + tags: '*' pull_request: + workflow_dispatch: concurrency: # Skip intermediate builds: always. # Cancel intermediate builds: only if it is a pull request build. @@ -28,7 +30,7 @@ jobs: - x64 steps: - uses: actions/checkout@v4 - - uses: julia-actions/setup-julia@v1 + - uses: julia-actions/setup-julia@v2 with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} @@ -38,7 +40,7 @@ jobs: env: JULIA_NUM_THREADS: 4 - uses: julia-actions/julia-processcoverage@v1 - - uses: codecov/codecov-action@v3 + - uses: codecov/codecov-action@v4 with: file: lcov.info \ No newline at end of file diff --git a/.github/workflows/Invalidations.yml b/.github/workflows/Invalidations.yml index 1775a9c..aa8dbf9 100644 --- a/.github/workflows/Invalidations.yml +++ b/.github/workflows/Invalidations.yml @@ -1,40 +1,33 @@ name: Invalidations - -on: - pull_request: - -concurrency: - # Skip intermediate builds: always. - # Cancel intermediate builds: always. - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true +on: pull_request jobs: evaluate: - # Only run on PRs to the default branch. - # In the PR trigger above branches can be specified only explicitly whereas this check should work for master, main, or any other default branch - if: github.base_ref == github.event.repository.default_branch runs-on: ubuntu-latest steps: - - uses: julia-actions/setup-julia@v1 + - uses: julia-actions/setup-julia@v2 with: - version: '1' + version: 'lts' - uses: actions/checkout@v4 - - uses: julia-actions/julia-buildpkg@v1 + - uses: julia-actions/julia-buildpkg@latest - uses: julia-actions/julia-invalidations@v1 id: invs_pr - uses: actions/checkout@v4 with: - ref: ${{ github.event.repository.default_branch }} - - uses: julia-actions/julia-buildpkg@v1 + ref: 'main' + - uses: julia-actions/julia-buildpkg@latest - uses: julia-actions/julia-invalidations@v1 - id: invs_default + id: invs_main - name: Report invalidation counts run: | - echo "Invalidations on default branch: ${{ steps.invs_default.outputs.total }} (${{ steps.invs_default.outputs.deps }} via deps)" >> $GITHUB_STEP_SUMMARY - echo "This branch: ${{ steps.invs_pr.outputs.total }} (${{ steps.invs_pr.outputs.deps }} via deps)" >> $GITHUB_STEP_SUMMARY - - name: Check if the PR does increase number of invalidations - if: steps.invs_pr.outputs.total > steps.invs_default.outputs.total - run: exit 1 \ No newline at end of file + echo "Invalidations on main: ${{ steps.invs_main.outputs.total }} (${{ steps.invs_main.outputs.deps }} via deps)" + echo "This branch: ${{ steps.invs_pr.outputs.total }} (${{ steps.invs_pr.outputs.deps }} via deps)" + shell: bash + - name: PR doesn't increase number of invalidations + run: | + if (( ${{ steps.invs_pr.outputs.total }} > ${{ steps.invs_main.outputs.total }} )); then + exit 1 + fi + shell: bash \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index db0f2b9..97bae8c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,10 +2,12 @@ name: CI on: push: branches: - - main - - workflow_dispatch - tags: ['*'] + - 'master' + - 'main' + - 'release-' + tags: '*' pull_request: + workflow_dispatch: concurrency: # Skip intermediate builds: always. # Cancel intermediate builds: only if it is a pull request build. @@ -19,8 +21,9 @@ jobs: fail-fast: false matrix: version: - - '1.6' - - '1' + - '1.6' # previous LTS release + - 'lts' # current LTS release + - '1' # current stable release os: - ubuntu-latest - macOS-latest @@ -29,7 +32,7 @@ jobs: - x64 steps: - uses: actions/checkout@v4 - - uses: julia-actions/setup-julia@v1 + - uses: julia-actions/setup-julia@v2 with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} @@ -39,7 +42,7 @@ jobs: env: JULIA_NUM_THREADS: 4 - uses: julia-actions/julia-processcoverage@v1 - - uses: codecov/codecov-action@v3 + - uses: codecov/codecov-action@v4 with: file: lcov.info \ No newline at end of file diff --git a/Project.toml b/Project.toml index 5445373..4437e6d 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Strided" uuid = "5e0ebb24-38b0-5f93-81fe-25c709ecae67" authors = ["Lukas Devos ", "Maarten Van Damme ", "Jutho Haegeman "] -version = "2.1.1" +version = "2.2" [deps] LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" @@ -12,9 +12,9 @@ TupleTools = "9d95972d-f1c8-5527-a6e0-b4b365fa01f6" Aqua = "0.8" LinearAlgebra = "1.6" Random = "1.6" -StridedViews = "0.1,0.2,0.3" +StridedViews = "0.3.2" Test = "1.6" -TupleTools = "1.1" +TupleTools = "1.6" julia = "1.6" [extras] diff --git a/src/convert.jl b/src/convert.jl index e42b36a..a8cc8cb 100644 --- a/src/convert.jl +++ b/src/convert.jl @@ -1,9 +1,16 @@ -function Base.convert(::Type{T}, a::StridedView) where {T<:Array} - b = T(undef, size(a)) +function Base.Array(a::StridedView) + b = Array{eltype(a)}(undef, size(a)) copyto!(StridedView(b), a) return b end -function Base.convert(::Type{Array}, a::StridedView{T}) where {T} + +function (Base.Array{T})(a::StridedView{S,N}) where {T,S,N} + b = Array{T}(undef, size(a)) + copyto!(StridedView(b), a) + return b +end + +function (Base.Array{T,N})(a::StridedView{S,N}) where {T,S,N} b = Array{T}(undef, size(a)) copyto!(StridedView(b), a) return b diff --git a/src/mapreduce.jl b/src/mapreduce.jl index 6b33274..f9eae7b 100644 --- a/src/mapreduce.jl +++ b/src/mapreduce.jl @@ -71,9 +71,9 @@ function _mapreduce(f, op, A::StridedView{T}, nt=nothing) where {T} return out[ParentIndex(1)] end -@inline function Base.mapreducedim!(f, op, b::StridedView{<:Any,N}, - a1::StridedView{<:Any,N}, - A::Vararg{StridedView{<:Any,N}}) where {N} +function Base.mapreducedim!(f, op, b::StridedView{<:Any,N}, + a1::StridedView{<:Any,N}, + A::Vararg{StridedView{<:Any,N}}) where {N} outdims = size(b) dims = map(max, outdims, map(max, map(size, (a1, A...))...)) @@ -176,7 +176,7 @@ function _mapreduce_block!((f), (op), (initop), _mapreduce_threaded!(f, op, initop, dims, blocks, strides, offsets, costs, arrays, get_num_threads(), 0, 1) end - return + return nothing end _init_reduction!(out, f, op::Union{typeof(+),typeof(Base.add_sum)}, a) = fill!(out, zero(a)) @@ -483,7 +483,7 @@ function _computeblocks(dims::NTuple{N,Int}, costs::NTuple{N,Int}, end if minimum(minimum.(bytestrides)) > blocksize - return ntuple(n -> 1, N) + return ntuple(n -> 1, Val(N)) end # reduce dims to find appropriate blocks