Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix memory issues #1113

Merged
merged 1 commit into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 0 additions & 44 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,18 @@ steps:
key: "cpu_unittests"
command:
- "julia --color=yes --check-bounds=yes --project=test test/runtests.jl"
agents:
slurm_mem: 64GB

- label: ":computer: unit tests expensive"
key: "cpu_unittests_expensive"
command:
- "julia --color=yes --check-bounds=yes --project=test test/runtests_expensive.jl"
env:
OMPI_MCA_rmaps_base_oversubscribe: 1
agents:
slurm_mem: 64GB

- label: ":computer: Field broadcast performance"
key: "cpu_field_perf"
command:
- "julia --color=yes --project=test test/Fields/field_opt.jl"
agents:
slurm_mem: 20GB

- label: ":flower_playing_cards: unit tests"
key: "gpu_unittests"
Expand All @@ -72,21 +66,16 @@ steps:
- "julia --color=yes --check-bounds=yes --project=test test/runtests.jl CUDA"
agents:
slurm_gres: "gpu:1"
slurm_mem: 32GB

- label: ":computer: test implicit_stencil Float32"
key: "cpu_implicit_stencil_float32"
command:
- "julia -O0 --color=yes --check-bounds=yes --project=test test/Operators/finitedifference/implicit_stencils.jl --float_type Float32"
agents:
slurm_mem: 10GB

- label: ":computer: test implicit_stencil Float64"
key: "cpu_implicit_stencil_float64"
command:
- "julia -O0 --color=yes --check-bounds=yes --project=test test/Operators/finitedifference/implicit_stencils.jl --float_type Float64"
agents:
slurm_mem: 10GB

- label: ":computer: test implicit_stencil opt"
key: "cpu_implicit_stencil_opt"
Expand Down Expand Up @@ -335,8 +324,6 @@ steps:
- "julia --color=yes --project=examples examples/hybrid/box/bubble_3d_rhotheta.jl"
artifact_paths:
- "examples/hybrid/box/output/bubble_3d_rhotheta/*"
agents:
slurm_mem: 20GB

- label: ":computer: Rising Bubble 2D hybrid invariant (ρθ)"
key: "cpu_rising_bubble_2d_hybrid_invariant_rhotheta"
Expand All @@ -358,8 +345,6 @@ steps:
- "julia --color=yes --project=examples examples/hybrid/box/bubble_3d_invariant_rhotheta.jl"
artifact_paths:
- "examples/hybrid/box/output/bubble_3d_invariant_rhotheta/*"
agents:
slurm_mem: 20GB

- label: ":computer: Rising Bubble 3D hybrid invariant (ρe)"
key: "cpu_rising_bubble_3d_hybrid_invariant_rhoe"
Expand Down Expand Up @@ -552,17 +537,13 @@ steps:
- "julia --color=yes --project=examples examples/hybrid/sphere/deformation_flow.jl"
artifact_paths:
- "examples/hybrid/sphere/output/deformation_flow/*"
agents:
slurm_mem: 20GB

- label: ":computer: 3D sphere Hadley circulation"
key: "cpu_3d_hadley_circulation"
command:
- "julia --color=yes --project=examples examples/hybrid/sphere/hadley_circulation.jl"
artifact_paths:
- "examples/hybrid/sphere/output/hadley_circulation/*"
agents:
slurm_mem: 40GB

- label: ":computer: Float 64 3D sphere baroclinic wave (ρe)"
key: "cpu_baroclinic_wave_rho_e_float64"
Expand All @@ -573,8 +554,6 @@ steps:
env:
TEST_NAME: "sphere/baroclinic_wave_rhoe"
FLOAT_TYPE: "Float64"
agents:
slurm_mem: 40GB

- label: ":computer: 3D sphere baroclinic wave (ρe)"
key: "cpu_baroclinic_wave_rho_e"
Expand All @@ -584,8 +563,6 @@ steps:
- "examples/hybrid/sphere/output/baroclinic_wave_rhoe/Float32/*"
env:
TEST_NAME: "sphere/baroclinic_wave_rhoe"
agents:
slurm_mem: 10GB

- label: ":computer: MPI 3D sphere baroclinic wave (ρe)"
key: "cpu_mpi_baroclinic_wave_rho_e"
Expand All @@ -598,7 +575,6 @@ steps:
CLIMACORE_DISTRIBUTED: "MPI"
agents:
slurm_ntasks: 2
slurm_mem: 20GB


- label: ":computer: 3D sphere baroclinic wave (ρθ)"
Expand All @@ -609,8 +585,6 @@ steps:
- "examples/hybrid/sphere/output/baroclinic_wave_rhotheta/Float32/*"
env:
TEST_NAME: "sphere/baroclinic_wave_rhotheta"
agents:
slurm_mem: 10GB

- label: ":computer: 3D sphere nonhydrostatic gravity wave"
key: "cpu_nonhydrostatic_gravity_wave"
Expand All @@ -632,8 +606,6 @@ steps:
- "examples/hybrid/sphere/output/balanced_flow_rhoe/Float32/*"
env:
TEST_NAME: "sphere/balanced_flow_rhoe"
agents:
slurm_mem: 20GB

- label: ":computer: 3D sphere hydrostatically and geostrophically balanced flow (ρθ)"
key: "cpu_balanced_flow_rho_theta"
Expand All @@ -652,8 +624,6 @@ steps:
- "examples/hybrid/sphere/output/held_suarez_rhoe/Float32/*"
env:
TEST_NAME: "sphere/held_suarez_rhoe"
agents:
slurm_mem: 10GB

- label: ":computer: Float64 3D sphere dry Held-Suarez (ρθ)"
key: "cpu_held_suarez_rho_theta_float64"
Expand All @@ -664,8 +634,6 @@ steps:
env:
TEST_NAME: "sphere/held_suarez_rhotheta"
FLOAT_TYPE: "Float64"
agents:
slurm_mem: 20GB

- label: ":computer: 3D sphere dry Held-Suarez (ρθ)"
key: "cpu_held_suarez_rho_theta"
Expand All @@ -675,8 +643,6 @@ steps:
- "examples/hybrid/sphere/output/held_suarez_rhotheta/Float32/*"
env:
TEST_NAME: "sphere/held_suarez_rhotheta"
agents:
slurm_mem: 20GB

- label: ":computer: 3D sphere dry Held-Suarez (ρe_int)"
key: "cpu_held_suarez_rho_e_int"
Expand All @@ -686,8 +652,6 @@ steps:
- "examples/hybrid/sphere/output/held_suarez_rhoe_int/Float32/*"
env:
TEST_NAME: "sphere/held_suarez_rhoe_int"
agents:
slurm_mem: 10GB

- group: "Examples hybrid plane"
steps:
Expand All @@ -700,8 +664,6 @@ steps:
- "examples/hybrid/plane/output/inertial_gravity_wave/Float32/*"
env:
TEST_NAME: "plane/inertial_gravity_wave"
agents:
slurm_mem: 20GB

- label: ":computer: stretched 2D plane inertial gravity wave"
key: "cpu_stretch_inertial_gravity_wave"
Expand All @@ -712,8 +674,6 @@ steps:
env:
TEST_NAME: "plane/inertial_gravity_wave"
Z_STRETCH: "true"
agents:
slurm_mem: 10GB

- group: "Analysis"
steps:
Expand All @@ -724,8 +684,6 @@ steps:
- "julia --color=yes --project=perf perf/allocs.jl"
artifact_paths:
- "perf/allocations_output/*"
agents:
slurm_mem: 40GB

- label: ":rocket::computer: Flamegraph profile"
key: "cpu_flamegraph"
Expand All @@ -745,8 +703,6 @@ steps:
key: "cpu_invalidations"
command:
- "julia --color=yes --project=perf perf/invalidations.jl"
agents:
slurm_mem: 20GB
- wait

- label: ":chart_with_downwards_trend: build history"
Expand Down
35 changes: 19 additions & 16 deletions src/DataLayouts/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -407,26 +407,29 @@ end

# broadcasting scalar assignment
# Performance optimization for the common identity scalar case: dest .= val
@inline function Base.copyto!(
function Base.copyto!(
dest::AbstractData,
bc::Base.Broadcast.Broadcasted{Style},
) where {Style <: Base.Broadcast.AbstractArrayStyle{0}}
) where {
Style <:
Union{Base.Broadcast.AbstractArrayStyle{0}, Base.Broadcast.Style{Tuple}},
}
bc = Base.Broadcast.instantiate(
Base.Broadcast.Broadcasted{Style}(bc.f, bc.args, ()),
)
@inbounds bc0 = bc[]
fill!(dest, bc0)
end

@inline function Base.copyto!(
function Base.copyto!(
dest::DataF{S},
bc::Union{DataF{S, A}, Base.Broadcast.Broadcasted{DataFStyle{A}}},
) where {S, A}
@inbounds dest[] = convert(S, bc[])
return dest
end

@inline function Base.copyto!(
function Base.copyto!(
dest::IJFH{S, Nij},
bc::Union{IJFH{S, Nij}, Base.Broadcast.Broadcasted{<:IJFHStyle{Nij}}},
) where {S, Nij}
Expand All @@ -439,7 +442,7 @@ end
return dest
end

@inline function Base.copyto!(
function Base.copyto!(
dest::IFH{S, Ni},
bc::Union{IFH{S, Ni}, Base.Broadcast.Broadcasted{<:IFHStyle{Ni}}},
) where {S, Ni}
Expand All @@ -453,7 +456,7 @@ end
end

# inline inner slab(::DataSlab2D) copy
@inline function Base.copyto!(
function Base.copyto!(
dest::IJF{S, Nij},
bc::Union{IJF{S, Nij, A}, Base.Broadcast.Broadcasted{IJFStyle{Nij, A}}},
) where {S, Nij, A}
Expand All @@ -465,7 +468,7 @@ end
end

# inline inner slab(::DataSlab1D) copy
@inline function Base.copyto!(
function Base.copyto!(
dest::IF{S, Ni},
bc::Base.Broadcast.Broadcasted{IFStyle{Ni, A}},
) where {S, Ni, A}
Expand All @@ -477,7 +480,7 @@ end
end

# inline inner column(::DataColumn) copy
@inline function Base.copyto!(
function Base.copyto!(
dest::VF{S},
bc::Union{VF{S, A}, Base.Broadcast.Broadcasted{VFStyle{A}}},
) where {S, A}
Expand All @@ -489,7 +492,7 @@ end
return dest
end

@inline function _serial_copyto!(
function _serial_copyto!(
dest::VIFH{S, Ni},
bc::Union{VIFH{S, Ni, A}, Base.Broadcast.Broadcasted{VIFHStyle{Ni, A}}},
) where {S, Ni, A}
Expand All @@ -503,7 +506,7 @@ end
return dest
end

@inline function _threaded_copyto!(
function _threaded_copyto!(
dest::VIFH{S, Ni},
bc::Base.Broadcast.Broadcasted{VIFHStyle{Ni, A}},
) where {S, Ni, A}
Expand All @@ -522,14 +525,14 @@ end
return dest
end

@inline function Base.copyto!(
function Base.copyto!(
dest::VIFH{S, Ni},
source::VIFH{S, Ni, A},
) where {S, Ni, A}
return _serial_copyto!(dest, source)
end

@inline function Base.copyto!(
function Base.copyto!(
dest::VIFH{S, Ni},
bc::Base.Broadcast.Broadcasted{VIFHStyle{Ni, A}},
) where {S, Ni, A}
Expand All @@ -539,7 +542,7 @@ end
return _serial_copyto!(dest, bc)
end

@inline function _serial_copyto!(
function _serial_copyto!(
dest::VIJFH{S, Nij},
bc::Union{VIJFH{S, Nij, A}, Base.Broadcast.Broadcasted{VIJFHStyle{Nij, A}}},
) where {S, Nij, A}
Expand All @@ -553,7 +556,7 @@ end
return dest
end

@inline function _threaded_copyto!(
function _threaded_copyto!(
dest::VIJFH{S, Nij},
bc::Base.Broadcast.Broadcasted{VIJFHStyle{Nij, A}},
) where {S, Nij, A}
Expand All @@ -572,14 +575,14 @@ end
return dest
end

@inline function Base.copyto!(
function Base.copyto!(
dest::VIJFH{S, Nij},
source::VIJFH{S, Nij, A},
) where {S, Nij, A}
return _serial_copyto!(dest, source)
end

@inline function Base.copyto!(
function Base.copyto!(
dest::VIJFH{S, Nij},
bc::Base.Broadcast.Broadcasted{VIJFHStyle{Nij, A}},
) where {S, Nij, A}
Expand Down
Loading