Skip to content

Commit

Permalink
Fix Aqua tests
Browse files Browse the repository at this point in the history
  • Loading branch information
charleskawczynski committed Jul 1, 2022
1 parent 7fd3618 commit 797e39e
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 21 deletions.
10 changes: 5 additions & 5 deletions src/DataLayouts/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ end
function Base.similar(
::Union{IF{<:Any, Ni, A}, Broadcast.Broadcasted{IFStyle{Ni, A}}},
::Type{Eltype},
) where {S, Ni, A, Eltype}
) where {Ni, A, Eltype}
Nf = typesize(eltype(A), Eltype)
array = MArray{Tuple{Ni, Nf}, eltype(A), 2, Ni * Nf}(undef)
return IF{Eltype, Ni}(array)
Expand Down Expand Up @@ -432,8 +432,8 @@ end

function Base.copyto!(
dest::IJFH{S, Nij},
bc::Union{IJFH{S, Nij}, Base.Broadcast.Broadcasted{IJFHStyle{Nij, A}}},
) where {S, Nij, A}
bc::Union{IJFH{S, Nij}, Base.Broadcast.Broadcasted{<:IJFHStyle{Nij}}},
) where {S, Nij}
_, _, _, _, Nh = size(bc)
@inbounds for h in 1:Nh
slab_dest = slab(dest, h)
Expand All @@ -445,8 +445,8 @@ end

function Base.copyto!(
dest::IFH{S, Ni},
bc::Union{IFH{S, Ni}, Base.Broadcast.Broadcasted{IFHStyle{Ni, A}}},
) where {S, Ni, A}
bc::Union{IFH{S, Ni}, Base.Broadcast.Broadcasted{<:IFHStyle{Ni}}},
) where {S, Ni}
_, _, _, _, Nh = size(bc)
@inbounds for h in 1:Nh
slab_dest = slab(dest, h)
Expand Down
2 changes: 0 additions & 2 deletions src/Fields/field_iterator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ function isa_12_covariant_field(
f::Type{CF},
) where {
FT,
T,
CF <: Geometry.AxisTensor{
FT,
1,
Expand All @@ -62,7 +61,6 @@ function isa_3_covariant_field(
f::Type{CF},
) where {
FT,
T,
CF <: Geometry.AxisTensor{
FT,
1,
Expand Down
3 changes: 1 addition & 2 deletions src/Geometry/axistensors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,7 @@ end
# LinearAlgebra

check_axes(::A, ::A) where {A} = nothing
check_axes(ax1, ax2) where {A} =
throw(DimensionMismatch("$ax1 and $ax2 do not match"))
check_axes(ax1, ax2) = throw(DimensionMismatch("$ax1 and $ax2 do not match"))

check_dual(ax1, ax2) = _check_dual(ax1, ax2, dual(ax2))
_check_dual(::A, _, ::A) where {A} = nothing
Expand Down
3 changes: 2 additions & 1 deletion src/Operators/stencilcoefs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ struct StencilCoefs{lbw, ubw, C <: NTuple}
coefs::C
end

function StencilCoefs{lbw, ubw}(coefs::NTuple{N, T}) where {lbw, ubw, N, T}
function StencilCoefs{lbw, ubw}(coefs::NTuple{N}) where {lbw, ubw, N}
if !(
(lbw isa Integer && ubw isa Integer) ||
(lbw isa PlusHalf && ubw isa PlusHalf)
Expand All @@ -23,6 +23,7 @@ function StencilCoefs{lbw, ubw}(coefs::NTuple{N, T}) where {lbw, ubw, N, T}
if N == 0 # no reason to support edge case of an empty stencil
error("Stencil cannot be empty")
end
T = eltype(coefs)
if !isconcretetype(T) # must be compatible with DataLayouts
error("Stencil coefficients must all have the same concrete type")
end
Expand Down
3 changes: 3 additions & 0 deletions src/Spaces/Spaces.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,7 @@ include("hybrid.jl")
include("triangulation.jl")
include("dss.jl")

horizontal_space(space::ExtrudedFiniteDifferenceSpace) = space.horizontal_space
horizontal_space(space::AbstractSpace) = space.topology

end # module
50 changes: 40 additions & 10 deletions src/Spaces/dss.jl
Original file line number Diff line number Diff line change
Expand Up @@ -691,14 +691,27 @@ Create the ghost buffer, if necessary, load the send buffer and start communicat
Part of [`Spaces.weighted_dss!`](@ref).
"""
function weighted_dss_start!(
weighted_dss_start!(data, space, ghost_buffer) =
weighted_dss_start!(data, space, horizontal_space(space), ghost_buffer)

weighted_dss_start!(
data,
space::ExtrudedFiniteDifferenceSpace{S, H},
hspace::H,
ghost_buffer,
) where {S, H <: SpectralElementSpace2D{<:DistributedTopology2D}} =
_weighted_dss_start!(data, space, hspace, ghost_buffer)

weighted_dss_start!(
data,
space::Union{ExtrudedFiniteDifferenceSpace{S, H}, H},
space::H,
hspace::H,
ghost_buffer,
) where {S, T <: DistributedTopology2D, H <: SpectralElementSpace2D{T}}
topology =
space isa ExtrudedFiniteDifferenceSpace ?
space.horizontal_space.topology : space.topology
) where {H <: SpectralElementSpace2D{<:DistributedTopology2D}} =
_weighted_dss_start!(data, space, hspace, ghost_buffer)

function _weighted_dss_start!(data, space, hspace, ghost_buffer)
topology = hspace.topology
if ghost_buffer isa GhostBuffer
# 1) copy send data to buffer
fill_send_buffer!(topology, data, ghost_buffer)
Expand All @@ -708,7 +721,7 @@ function weighted_dss_start!(
return nothing
end

function weighted_dss_start!(data, space, ghost_buffer)
function weighted_dss_start!(data, space, hspace, ghost_buffer)
return nothing
end

Expand Down Expand Up @@ -747,11 +760,28 @@ Complete communication. Perform weighted dss for ghost faces and vertices.
Part of [`Spaces.weighted_dss!`](@ref).
"""
weighted_dss_ghost!(data, space, ghost_buffer) =
weighted_dss_ghost!(data, space, horizontal_space(space), ghost_buffer)

function weighted_dss_ghost!(
data,
space::Union{ExtrudedFiniteDifferenceSpace{S, H}, H},
space::ExtrudedFiniteDifferenceSpace{S, H},
hspace::H,
ghost_buffer,
) where {S, T <: DistributedTopology2D, H <: SpectralElementSpace2D{T}}
) where {S, H <: SpectralElementSpace2D{<:DistributedTopology2D}}
_weighted_dss_ghost!(data, space, hspace, hspace, ghost_buffer)
end

function weighted_dss_ghost!(
data,
space::H,
hspace::H,
ghost_buffer,
) where {H <: SpectralElementSpace2D{<:DistributedTopology2D}}
_weighted_dss_ghost!(data, space, hspace, hspace, ghost_buffer)
end

function _weighted_dss_ghost!(data, space, hspace, ghost_buffer)
hspace =
space isa ExtrudedFiniteDifferenceSpace ? space.horizontal_space : space
topology = hspace.topology
Expand Down Expand Up @@ -793,6 +823,6 @@ function weighted_dss_ghost!(
return data
end

function weighted_dss_ghost!(data, space, ghost_buffer)
function weighted_dss_ghost!(data, space, hspace, ghost_buffer)
return data
end
4 changes: 3 additions & 1 deletion test/aqua.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ using Aqua
@testset "Aqua tests - unbound args" begin
# This tests that we don't accidentally run into
# https://github.com/JuliaLang/julia/issues/29393
# ua = Aqua.detect_unbound_args_recursively(ClimaCore)
Aqua.test_unbound_args(ClimaCore)

# returns a vector of all unbound args
# ua = Aqua.detect_unbound_args_recursively(ClimaCore)
end

0 comments on commit 797e39e

Please sign in to comment.