Skip to content

Commit b5d7a11

Browse files
committed
Clean up logmsgs when using MPI
1 parent 03930a5 commit b5d7a11

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

src/solver/solve.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ walltime_in_days(es::EfficiencyStats) = es.walltime * (1 / (24 * 3600)) #=second
2121

2222
function timed_solve!(integrator)
2323
device = ClimaComms.device(integrator.u.c)
24+
comms_ctx = ClimaComms.context(device)
2425
local sol
25-
@time "solve!:" begin
26-
walltime = ClimaComms.elapsed(device) do
27-
sol = SciMLBase.solve!(integrator)
28-
end
26+
walltime = ClimaComms.elapsed(device) do
27+
sol = SciMLBase.solve!(integrator)
2928
end
29+
@info "solve! walltime = $(round(walltime, digits = 3))"
3030
(; tspan) = integrator.sol.prob
3131
es = EfficiencyStats(tspan, walltime)
3232
_sypd = simulated_years_per_day(es)

src/solver/type_getters.jl

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,6 @@ function get_sim_info(config::AtmosConfig)
574574
start_date = epoch,
575575
t_end = t_end,
576576
)
577-
@show sim.t_end, sim.dt
578577
n_steps = floor(Int, sim.t_end / sim.dt)
579578
@info(
580579
"Time info:",
@@ -639,15 +638,17 @@ end
639638

640639
import ClimaComms, Logging, NVTX
641640
function get_comms_context(parsed_args)
642-
device = if parsed_args["device"] == "auto"
643-
ClimaComms.device()
644-
elseif parsed_args["device"] == "CUDADevice"
645-
ClimaComms.CUDADevice()
646-
elseif parsed_args["device"] == "CPUMultiThreaded" || Threads.nthreads() > 1
647-
ClimaComms.CPUMultiThreaded()
648-
else
649-
ClimaComms.CPUSingleThreaded()
650-
end
641+
device =
642+
if !haskey(parsed_args, "device") || parsed_args["device"] === "auto"
643+
ClimaComms.device()
644+
elseif parsed_args["device"] == "CUDADevice"
645+
ClimaComms.CUDADevice()
646+
elseif parsed_args["device"] == "CPUMultiThreaded" ||
647+
Threads.nthreads() > 1
648+
ClimaComms.CPUMultiThreaded()
649+
else
650+
ClimaComms.CPUSingleThreaded()
651+
end
651652
comms_ctx = ClimaComms.context(device)
652653
ClimaComms.init(comms_ctx)
653654

src/solver/types.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -677,9 +677,7 @@ function AtmosConfig(
677677

678678
all_config_files =
679679
normrelpath.(maybe_add_default(config_files, default_config_file))
680-
681680
configs = map(all_config_files) do config_file
682-
@info "Loading yaml file $config_file"
683681
strip_help_messages(load_yaml_file(config_file))
684682
end
685683
return AtmosConfig(
@@ -714,13 +712,15 @@ function AtmosConfig(
714712
# using config_files = [default_config_file] as a default
715713
# relies on the fact that override_default_config uses
716714
# default_config_file.
717-
config = override_default_config(configs)
715+
config = merge(configs...)
716+
comms_ctx = isnothing(comms_ctx) ? get_comms_context(config) : comms_ctx
717+
config = override_default_config(config)
718+
718719
FT = config["FLOAT_TYPE"] == "Float64" ? Float64 : Float32
719720
toml_dict = CP.create_toml_dict(
720721
FT;
721722
override_file = CP.merge_toml_files(config["toml"]),
722723
)
723-
comms_ctx = isnothing(comms_ctx) ? get_comms_context(config) : comms_ctx
724724
config = config_with_resolved_and_acquired_artifacts(config, comms_ctx)
725725

726726
isempty(job_id) &&

src/solver/yaml_helper.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ override_default_config(config_dicts::ContainerType(AbstractDict)) =
5959
override_default_config(merge(config_dicts...))
6060

6161
function override_default_config(::Nothing)
62-
@info "Using default configuration"
6362
return default_config_dict()
6463
end
6564

0 commit comments

Comments
 (0)