Skip to content

Commit 714db30

Browse files
committed
use Array(parent())
1 parent 07b5e0c commit 714db30

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

experiments/AMIP/user_io/debug_plots.jl

+11-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ function debug(cs_fields::NamedTuple, dir, cs_fields_ref = nothing)
6565
)
6666
cpu_field = ClimaCore.Fields.ones(cpu_space)
6767

68-
parent(cpu_field) .= parent(field)
68+
parent(cpu_field) .= Array(parent(field))
69+
# Check what we're doing is correct on CPU
70+
if comms_ctx isa ClimaComms.SingletonCommsContext
71+
@assert cpu_field == field
72+
end
6973

7074
push!(all_plots, Plots.plot(cpu_field, title = string(field_name) * print_extrema(field)))
7175
if (field_name == :T_S) && (@isdefined debug_csf0)
@@ -90,6 +94,11 @@ function debug(cs_fields::NamedTuple, dir, cs_fields_ref = nothing)
9094
# Copy field onto cpu space
9195
parent(cpu_field) .= parent(field)
9296

97+
# Check what we're doing is correct on CPU
98+
if comms_ctx isa ClimaComms.SingletonCommsContext
99+
@assert cpu_field == field
100+
end
101+
93102
push!(
94103
all_plots,
95104
Plots.plot(
@@ -149,7 +158,7 @@ function debug(sim::ComponentModelSimulation, dir)
149158
nz = nz,
150159
)
151160
cpu_field = ClimaCore.Fields.ones(cpu_space)
152-
parent(cpu_field) .= parent(field)
161+
parent(cpu_field) .= Array(parent(field))
153162

154163
push!(all_plots, Plots.plot(cpu_field, title = string(field_name) * print_extrema(field)))
155164
end

0 commit comments

Comments
 (0)