Skip to content

Commit

Permalink
Merge pull request #45 from CliMA/ck/deps
Browse files Browse the repository at this point in the history
Upgrade Flux and Julia
  • Loading branch information
charleskawczynski authored Sep 29, 2023
2 parents 380e6f3 + e6328f5 commit 4eed2d5
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .dev/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899"

[compat]
JuliaFormatter = "0.3"
JuliaFormatter = "1"
2 changes: 1 addition & 1 deletion .github/workflows/Docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@latest
with:
version: 1.7
version: 1.9
- name: Install dependencies
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
- name: Build and deploy
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
fail-fast: false
matrix:
version:
- '1.7.0'
- '1.9'
os:
- ubuntu-latest
- macOS-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/julia_formatter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- uses: julia-actions/setup-julia@latest
if: steps.filter.outputs.julia_file_change == 'true'
with:
version: 1.7.0
version: 1.9

- name: Apply JuliaFormatter
if: steps.filter.outputs.julia_file_change == 'true'
Expand Down
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "OperatorFlux"
uuid = "47cfafe2-3833-4da3-8183-ce14c2b92cbd"
authors = ["CliMA Contributors <[email protected]>"]
version = "0.1.2"
version = "0.1.3"

[deps]
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
Expand All @@ -18,7 +18,7 @@ ChainRulesCore = "1"
ChainRulesTestUtils = "1"
Distributions = "0.25"
FFTW = "1"
Flux = "0.13"
Flux = "0.13, 0.14"
GaussQuadrature = "0.5"
Tullio = "0.3"
julia = "1.7"
Expand Down
6 changes: 3 additions & 3 deletions bors.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
status = [
"ci 1.7.0 - ubuntu-latest",
"ci 1.7.0 - windows-latest",
"ci 1.7.0 - macOS-latest",
"ci 1.9 - ubuntu-latest",
"ci 1.9 - windows-latest",
"ci 1.9 - macOS-latest",
"format",
"docbuild"
]
Expand Down
1 change: 1 addition & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ makedocs(
modules = [OperatorFlux],
sitename = "OperatorFlux.jl",
authors = "CliMA",
warnonly = true,
format = Documenter.HTML(
prettyurls = !isempty(get(ENV, "CI", "")),
collapselevel = 1,
Expand Down
8 changes: 4 additions & 4 deletions src/transform_fourier.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ function truncate_modes(tr::FourierTransform{N}, coeff) where {N}

# indices for the spectral coefficients that we need to retain
inds = [
vcat(collect(1:(m)), collect((s - m + 1):s))
for (s, m) in zip(size(coeff)[2:(end - 1)], tr.modes)
vcat(collect(1:(m)), collect((s - m + 1):s)) for
(s, m) in zip(size(coeff)[2:(end - 1)], tr.modes)
]

# we need to handle the first dimension of the real Fourier transform
Expand All @@ -63,8 +63,8 @@ function pad_modes(
size_padded = (size(coeff)[1], size_pad..., size(coeff)[end])
coeff_padded = zeros(eltype(coeff), size_padded)
inds = [
vcat(collect(1:(div(m, 2) + 1)), collect((s - div(m, 2) + 2):s))
for (s, m) in zip(size_pad, size(coeff)[2:(end - 1)])
vcat(collect(1:(div(m, 2) + 1)), collect((s - div(m, 2) + 2):s)) for
(s, m) in zip(size_pad, size(coeff)[2:(end - 1)])
]

# we need to handle the first dimension of the real Fourier transform
Expand Down
21 changes: 6 additions & 15 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ mview(c, inds, ::Val{2}) = view(c, :, inds[1], inds[2], :)
mview(c, inds, ::Val{3}) = view(c, :, inds[1], inds[2], inds[3], :)
mview(c, inds, ::Val{4}) = view(c, :, inds[1], inds[2], inds[3], inds[4], :)

tensor_contraction(
A,
B,
::Val{1},
) = @tullio C[o, a, b] := A[i, a, o] * B[i, a, b]
tensor_contraction(A, B, ::Val{1}) =
@tullio C[o, a, b] := A[i, a, o] * B[i, a, b]
tensor_contraction(A, B, ::Val{2}) =
@tullio C[o, a₁, a₂, b] := A[i, a₁, a₂, o] * B[i, a₁, a₂, b]
tensor_contraction(A, B, ::Val{3}) =
Expand All @@ -16,21 +13,15 @@ tensor_contraction(A, B, ::Val{4}) = @tullio C[o, a₁, a₂, a₃, a₄, b] :=
A[i, a₁, a₂, a₃, a₄, o] * B[i, a₁, a₂, a₃, a₄, b]

sparse_mean(w, c, ::Val{1}) = @tullio μ[o, a, b] := w[i, o] * c[i, a, b]
sparse_mean(
w,
c,
::Val{2},
) = @tullio μ[o, a₁, a₂, b] := w[i, o] * c[i, a₁, a₂, b]
sparse_mean(w, c, ::Val{2}) =
@tullio μ[o, a₁, a₂, b] := w[i, o] * c[i, a₁, a₂, b]
sparse_mean(w, c, ::Val{3}) =
@tullio μ[o, a₁, a₂, a₃, b] := w[i, o] * c[i, a₁, a₂, a₃, b]
sparse_mean(w, c, ::Val{4}) =
@tullio μ[o, a₁, a₂, a₃, a₄, b] := w[i, o] * c[i, a₁, a₂, a₃, a₄, b]

sparse_covariance(
w,
c,
::Val{1},
) = @tullio μ[o, a, r, b] := w[i, r, o] * c[i, a, b]
sparse_covariance(w, c, ::Val{1}) =
@tullio μ[o, a, r, b] := w[i, r, o] * c[i, a, b]
sparse_covariance(w, c, ::Val{2}) =
@tullio μ[o, a₁, a₂, r, b] := w[i, r, o] * c[i, a₁, a₂, b]
sparse_covariance(w, c, ::Val{3}) =
Expand Down
4 changes: 2 additions & 2 deletions test/transform_fourier.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ using LinearAlgebra
trafo = FourierTransform(modes = (12, 5))
c = rand(27, 16, 14, 1)
inds = [
[(1:(div(m, 2) + 1))..., ((s - div(m, 2) + 2):s)...]
for (s, m) in zip((M, 14), size(c)[2:(end - 1)])
[(1:(div(m, 2) + 1))..., ((s - div(m, 2) + 2):s)...] for
(s, m) in zip((M, 14), size(c)[2:(end - 1)])
]
inds[1] = collect(1:16)
@test all(OperatorFlux.pad_modes(trafo, c, (32, 14))[:, inds..., :] .== c)
Expand Down

2 comments on commit 4eed2d5

@charleskawczynski
Copy link
Member Author

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/92426

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.3 -m "<description of version>" 4eed2d5ba063b70a285cdd8dace1807b41d407a3
git push origin v0.1.3

Please sign in to comment.