@@ -52,49 +52,60 @@ cpu_artifacts_dir = joinpath(output_dir, joinpath(mode_name, cpu_run_name)) * "_
52
52
gpu_artifacts_dir = joinpath (output_dir, joinpath (mode_name, gpu_run_name)) * " _artifacts"
53
53
54
54
55
- # Read in and compare atmos state variables
55
+ # Read in and compare atmos state variables on centers and on faces
56
56
cpu_atmos_state_center = DLM. readdlm (joinpath (cpu_artifacts_dir, " atmos_state_center_tend_cpu.txt" ), ' ,' )
57
57
gpu_atmos_state_center = DLM. readdlm (joinpath (gpu_artifacts_dir, " atmos_state_center_tend_gpu.txt" ), ' ,' )
58
58
59
59
@show abs (maximum (cpu_atmos_state_center .- gpu_atmos_state_center))
60
60
@show abs (median (cpu_atmos_state_center .- gpu_atmos_state_center))
61
61
@show abs (mean (cpu_atmos_state_center .- gpu_atmos_state_center))
62
- @assert isapprox (cpu_atmos_state_center, gpu_atmos_state_center)
62
+ atmos_center_approx = isapprox (cpu_atmos_state_center, gpu_atmos_state_center)
63
63
64
64
cpu_atmos_state_face = DLM. readdlm (joinpath (cpu_artifacts_dir, " atmos_state_face_tend_cpu.txt" ), ' ,' )
65
65
gpu_atmos_state_face = DLM. readdlm (joinpath (gpu_artifacts_dir, " atmos_state_face_tend_gpu.txt" ), ' ,' )
66
66
67
67
@show abs (maximum (cpu_atmos_state_face .- gpu_atmos_state_face))
68
68
@show abs (median (cpu_atmos_state_face .- gpu_atmos_state_face))
69
69
@show abs (mean (cpu_atmos_state_face .- gpu_atmos_state_face))
70
- @assert isapprox (cpu_atmos_state_face, gpu_atmos_state_face)
70
+ println ()
71
+ atmos_face_approx = isapprox (cpu_atmos_state_face, gpu_atmos_state_face)
71
72
72
73
73
- # Read in and compare land state variables
74
+ # Read in and compare land state variables on 3D space and 2D space
74
75
cpu_land_state_3d = DLM. readdlm (joinpath (cpu_artifacts_dir, " land_state_3d_tend_cpu.txt" ), ' ,' )
75
76
gpu_land_state_3d = DLM. readdlm (joinpath (gpu_artifacts_dir, " land_state_3d_tend_gpu.txt" ), ' ,' )
76
77
77
78
@show abs (maximum (cpu_land_state_3d .- gpu_land_state_3d))
78
79
@show abs (median (cpu_land_state_3d .- gpu_land_state_3d))
79
80
@show abs (mean (cpu_land_state_3d .- gpu_land_state_3d))
80
- @assert isapprox (cpu_land_state_3d, gpu_land_state_3d)
81
+ land_3d_approx = isapprox (cpu_land_state_3d, gpu_land_state_3d)
81
82
82
83
cpu_land_state_2d = DLM. readdlm (joinpath (cpu_artifacts_dir, " land_state_2d_tend_cpu.txt" ), ' ,' )
83
84
gpu_land_state_2d = DLM. readdlm (joinpath (gpu_artifacts_dir, " land_state_2d_tend_gpu.txt" ), ' ,' )
84
85
85
86
@show abs (maximum (cpu_land_state_2d .- gpu_land_state_2d))
86
87
@show abs (median (cpu_land_state_2d .- gpu_land_state_2d))
87
88
@show abs (mean (cpu_land_state_2d .- gpu_land_state_2d))
88
- @assert isapprox (cpu_land_state_2d, gpu_land_state_2d)
89
+ println ()
90
+ land_2d_approx = isapprox (cpu_land_state_2d, gpu_land_state_2d)
89
91
90
92
91
93
# Read in ocean state variables (if not AMIP)
94
+ ocean_approx = true
92
95
if ! (mode_name == " amip" )
93
- cpu_land_state = DLM. readdlm (joinpath (cpu_artifacts_dir, " land_state_tend_cpu .txt" ), ' ,' )
94
- gpu_land_state = DLM. readdlm (joinpath (gpu_artifacts_dir, " land_state_tend_gpu .txt" ), ' ,' )
96
+ cpu_ocean_state = DLM. readdlm (joinpath (cpu_artifacts_dir, " ocean_state_tend_cpu .txt" ), ' ,' )
97
+ gpu_ocean_state = DLM. readdlm (joinpath (gpu_artifacts_dir, " ocean_state_tend_gpu .txt" ), ' ,' )
95
98
96
99
@show abs (maximum (cpu_ocean_state .- gpu_ocean_state))
97
100
@show abs (median (cpu_ocean_state .- gpu_ocean_state))
98
101
@show abs (mean (cpu_ocean_state .- gpu_ocean_state))
99
- @assert isapprox (cpu_ocean_state, gpu_ocean_state)
102
+ ocean_approx = isapprox (cpu_ocean_state, gpu_ocean_state)
100
103
end
104
+
105
+ # Output warning for each component model if not equal
106
+ ! atmos_center_approx || ! atmos_face_approx ? @warn (" atmos states not equal" ) : nothing
107
+ ! land_2d_approx || ! land_3d_approx ? @warn (" land states not equal" ) : nothing
108
+ ! ocean_approx ? @warn (" ocean states not equal" ) : nothing
109
+
110
+ # Assert all states are equal at the end so we still check all of them
111
+ @assert atmos_center_approx && atmos_face_approx && land_3d_approx && land_2d_approx && ocean_approx
0 commit comments