From e016b5e87090f3ac6e15bf5ca9b62a0b453232f6 Mon Sep 17 00:00:00 2001 From: Guillaume Dalle <22795598+gdalle@users.noreply.github.com> Date: Mon, 7 Oct 2024 13:25:56 +0200 Subject: [PATCH 1/4] Remove or sanitize inbounds --- ext/SparseDiffToolsPolyesterExt.jl | 2 +- src/coloring/matrix2graph.jl | 4 ++-- src/differentiation/compute_jacobian_ad.jl | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ext/SparseDiffToolsPolyesterExt.jl b/ext/SparseDiffToolsPolyesterExt.jl index ea520810..8271ae3f 100644 --- a/ext/SparseDiffToolsPolyesterExt.jl +++ b/ext/SparseDiffToolsPolyesterExt.jl @@ -57,7 +57,7 @@ function polyesterforwarddiff_color_jacobian(J::AbstractMatrix{<:Number}, f::F, if colorvec[cols_index[idx]] == color_i] rows_index_c = rows_index[pick_inds] cols_index_c = cols_index[pick_inds] - @inbounds @simd for i in 1:length(rows_index_c) + @simd for i in eachindex(rows_index_c, cols_index_c) J[rows_index_c[i], cols_index_c[i]] = dx[rows_index_c[i]] end color_i += 1 diff --git a/src/coloring/matrix2graph.jl b/src/coloring/matrix2graph.jl index 85f79ee7..bf4fa69d 100644 --- a/src/coloring/matrix2graph.jl +++ b/src/coloring/matrix2graph.jl @@ -45,7 +45,7 @@ function matrix2graph(sparse_matrix::AbstractSparseMatrix{<:Number}, if partition_by_rows rows_by_cols = _rows_by_cols(rows_index, cols_index) - @inbounds for (cur_row, cur_col) in zip(rows_index, cols_index) + for (cur_row, cur_col) in zip(rows_index, cols_index) if !isempty(rows_by_cols[cur_col]) for next_row in rows_by_cols[cur_col] if next_row < cur_row @@ -56,7 +56,7 @@ function matrix2graph(sparse_matrix::AbstractSparseMatrix{<:Number}, end else cols_by_rows = _cols_by_rows(rows_index, cols_index) - @inbounds for (cur_row, cur_col) in zip(rows_index, cols_index) + for (cur_row, cur_col) in zip(rows_index, cols_index) if !isempty(cols_by_rows[cur_row]) for next_col in cols_by_rows[cur_row] if next_col < cur_col diff --git a/src/differentiation/compute_jacobian_ad.jl b/src/differentiation/compute_jacobian_ad.jl index f0cae288..3e603133 100644 --- a/src/differentiation/compute_jacobian_ad.jl +++ b/src/differentiation/compute_jacobian_ad.jl @@ -366,7 +366,7 @@ function forwarddiff_color_jacobian!(J::AbstractMatrix{<:Number}, partial_i = p[i] if vect isa Array - @inbounds @simd ivdep for j in eachindex(vect) + @inbounds @simd ivdep for j in eachindex(vect, vecx, partials_i) vect[j] = eltype(t)(vecx[j], ForwardDiff.Partials(partial_i[j])) end else @@ -377,7 +377,7 @@ function forwarddiff_color_jacobian!(J::AbstractMatrix{<:Number}, if !(sparsity isa Nothing) for j in 1:chunksize if dx isa Array - @inbounds @simd for k in eachindex(dx) + @inbounds @simd for k in eachindex(dx, fx) dx[k] = partials(fx[k], j) end else @@ -429,7 +429,7 @@ function forwarddiff_color_jacobian!(J::AbstractMatrix{<:Number}, col_index = (i - 1) * chunksize + j (col_index > ncols) && return J if J isa Array - @inbounds @simd for k in 1:size(J, 1) + @simd for k in axes(J, 1) J[k, col_index] = partials(vecfx[k], j) end else From c153d75962a45496ca1ad4e8615299778e9ce8c9 Mon Sep 17 00:00:00 2001 From: Guillaume Dalle <22795598+gdalle@users.noreply.github.com> Date: Mon, 7 Oct 2024 13:30:50 +0200 Subject: [PATCH 2/4] Typo --- src/differentiation/compute_jacobian_ad.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/differentiation/compute_jacobian_ad.jl b/src/differentiation/compute_jacobian_ad.jl index 3e603133..bfaad2c5 100644 --- a/src/differentiation/compute_jacobian_ad.jl +++ b/src/differentiation/compute_jacobian_ad.jl @@ -366,7 +366,7 @@ function forwarddiff_color_jacobian!(J::AbstractMatrix{<:Number}, partial_i = p[i] if vect isa Array - @inbounds @simd ivdep for j in eachindex(vect, vecx, partials_i) + @inbounds @simd ivdep for j in eachindex(vect, vecx, partial_i) vect[j] = eltype(t)(vecx[j], ForwardDiff.Partials(partial_i[j])) end else From 58aaed4b845432def1ce91ab309a7a152c2c10eb Mon Sep 17 00:00:00 2001 From: Guillaume Dalle <22795598+gdalle@users.noreply.github.com> Date: Mon, 7 Oct 2024 14:00:51 +0200 Subject: [PATCH 3/4] Add codecov token to CI --- .github/workflows/CI.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 2b2813ae..1f95094b 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -40,6 +40,7 @@ jobs: - uses: julia-actions/julia-processcoverage@v1 with: directories: src,ext - - uses: codecov/codecov-action@v3 + - uses: codecov/codecov-action@v4 with: + token: ${{ secrets.CODECOV_TOKEN }} files: lcov.info From e044805f60552342798e57516939f275e53ed6ff Mon Sep 17 00:00:00 2001 From: Guillaume Dalle <22795598+gdalle@users.noreply.github.com> Date: Mon, 7 Oct 2024 14:28:38 +0200 Subject: [PATCH 4/4] Fix Julia version in downstream tests --- .github/workflows/Downstream.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/Downstream.yml b/.github/workflows/Downstream.yml index 953c7934..8db8fc8a 100644 --- a/.github/workflows/Downstream.yml +++ b/.github/workflows/Downstream.yml @@ -14,7 +14,9 @@ jobs: strategy: fail-fast: false matrix: - julia-version: [1,1.10] + julia-version: + - '1' # Latest Release + - '1.10' # future LTS os: [ubuntu-latest] package: - {user: SciML, repo: OrdinaryDiffEq.jl, group: InterfaceII}