@@ -50,6 +50,7 @@ function step_u!(integrator, cache::IMEXARKCache)
5050 (; u, p, t, dt, alg) = integrator
5151 (; f) = integrator. sol. prob
5252 (; post_explicit!, post_implicit!) = f
53+ (; comms_context) = f
5354 (; T_lim!, T_exp!, T_imp!, lim!, dss!) = f
5455 (; tableau, newtons_method) = alg
5556 (; a_exp, b_exp, a_imp, b_imp, c_exp, c_imp) = tableau
@@ -147,11 +148,21 @@ function step_u!(integrator, cache::IMEXARKCache)
147148 end
148149
149150 if ! all (iszero, a_exp[:, i]) || ! iszero (b_exp[i])
150- if ! isnothing (T_lim!)
151- T_lim! (T_lim[i], U, p, t_exp)
152- end
153- if ! isnothing (T_exp!)
154- T_exp! (T_exp[i], U, p, t_exp)
151+ if ! isnothing (T_lim!) && ! isnothing (T_lim!) && ! isnothing (comms_context)
152+ dev = ClimaComms. device (comms_context)
153+ ClimaComms. @sync dev begin
154+ @async begin
155+ T_lim! (T_lim[i], U, p, t_exp)
156+ nothing
157+ end
158+ @async begin
159+ T_exp! (T_exp[i], U, p, t_exp)
160+ nothing
161+ end
162+ end
163+ else
164+ isnothing (T_lim!) || T_lim! (T_lim[i], U, p, t_exp)
165+ isnothing (T_exp!) || T_exp! (T_exp[i], U, p, t_exp)
155166 end
156167 end
157168 end
0 commit comments