Skip to content

Commit 9babbe3

Browse files
Merge pull request #3618 from CliMA/ne/logging
Clean up duplicated log messages when using MPI
2 parents 1556df7 + b5d7a11 commit 9babbe3

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
@@ -689,9 +689,7 @@ function AtmosConfig(
689689

690690
all_config_files =
691691
normrelpath.(maybe_add_default(config_files, default_config_file))
692-
693692
configs = map(all_config_files) do config_file
694-
@info "Loading yaml file $config_file"
695693
strip_help_messages(load_yaml_file(config_file))
696694
end
697695
return AtmosConfig(
@@ -726,13 +724,15 @@ function AtmosConfig(
726724
# using config_files = [default_config_file] as a default
727725
# relies on the fact that override_default_config uses
728726
# default_config_file.
729-
config = override_default_config(configs)
727+
config = merge(configs...)
728+
comms_ctx = isnothing(comms_ctx) ? get_comms_context(config) : comms_ctx
729+
config = override_default_config(config)
730+
730731
FT = config["FLOAT_TYPE"] == "Float64" ? Float64 : Float32
731732
toml_dict = CP.create_toml_dict(
732733
FT;
733734
override_file = CP.merge_toml_files(config["toml"]),
734735
)
735-
comms_ctx = isnothing(comms_ctx) ? get_comms_context(config) : comms_ctx
736736
config = config_with_resolved_and_acquired_artifacts(config, comms_ctx)
737737

738738
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)