Skip to content

Commit 1c1726a

Browse files
authored
Merge branch 'bartgol/eamxx/flush-log-during-init' (PR #7178)
Allows to better debug issues when model crashes during init. [BFB]
2 parents 999959c + 05787c4 commit 1c1726a

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

components/eamxx/src/control/atmosphere_driver.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ init_time_stamps (const util::TimeStamp& run_t0, const util::TimeStamp& case_t0,
156156
{
157157
m_atm_logger->info(" [EAMxx] Run start time stamp: " + run_t0.to_string());
158158
m_atm_logger->info(" [EAMxx] Case start time stamp: " + case_t0.to_string());
159+
m_atm_logger->flush(); // During init, flush often (to help debug crashes)
159160

160161
EKAT_REQUIRE_MSG (case_t0<=run_t0,
161162
"Error! Case t0 time stamp must precede the run t0 time stamp.\n"
@@ -225,6 +226,7 @@ void AtmosphereDriver::create_atm_processes()
225226
m_atm_logger->info("[EAMxx] create_atm_processes ...");
226227
start_timer("EAMxx::init");
227228
start_timer("EAMxx::create_atm_processes");
229+
m_atm_logger->flush(); // During init, flush often (to help debug crashes)
228230

229231
// At this point, must have comm and params set.
230232
check_ad_status(s_comm_set | s_params_set);
@@ -241,13 +243,15 @@ void AtmosphereDriver::create_atm_processes()
241243
stop_timer("EAMxx::create_atm_processes");
242244
stop_timer("EAMxx::init");
243245
m_atm_logger->info("[EAMxx] create_atm_processes ... done!");
246+
m_atm_logger->flush(); // During init, flush often (to help debug crashes)
244247
}
245248

246249
void AtmosphereDriver::create_grids()
247250
{
248251
m_atm_logger->info("[EAMxx] create_grids ...");
249252
start_timer("EAMxx::init");
250253
start_timer("EAMxx::create_grids");
254+
m_atm_logger->flush(); // During init, flush often (to help debug crashes)
251255

252256
// Must have procs created by now (and comm/params set)
253257
check_ad_status (s_procs_created | s_comm_set | s_params_set | s_ts_inited);
@@ -314,6 +318,7 @@ void AtmosphereDriver::create_grids()
314318
stop_timer("EAMxx::create_grids");
315319
stop_timer("EAMxx::init");
316320
m_atm_logger->info("[EAMxx] create_grids ... done!");
321+
m_atm_logger->flush(); // During init, flush often (to help debug crashes)
317322
}
318323

319324
void AtmosphereDriver::setup_surface_coupling_data_manager(SurfaceCouplingTransferType transfer_type,
@@ -523,6 +528,7 @@ void AtmosphereDriver::add_additional_column_data_to_property_checks () {
523528
void AtmosphereDriver::create_fields()
524529
{
525530
m_atm_logger->info("[EAMxx] create_fields ...");
531+
m_atm_logger->flush(); // During init, flush often (to help debug crashes)
526532
start_timer("EAMxx::init");
527533
start_timer("EAMxx::create_fields");
528534

@@ -679,12 +685,14 @@ void AtmosphereDriver::create_fields()
679685
stop_timer("EAMxx::create_fields");
680686
stop_timer("EAMxx::init");
681687
m_atm_logger->info("[EAMxx] create_fields ... done!");
688+
m_atm_logger->flush(); // During init, flush often (to help debug crashes)
682689
}
683690

684691
void AtmosphereDriver::create_output_managers () {
685692
m_atm_logger->info("[EAMxx] create_output_managers ...");
686693
start_timer("EAMxx::init");
687694
start_timer("EAMxx::create_output_managers");
695+
m_atm_logger->flush(); // During init, flush often (to help debug crashes)
688696

689697
check_ad_status (s_comm_set | s_params_set | s_ts_inited);
690698

@@ -748,10 +756,12 @@ void AtmosphereDriver::create_output_managers () {
748756
stop_timer("EAMxx::create_output_managers");
749757
stop_timer("EAMxx::init");
750758
m_atm_logger->info("[EAMxx] create_output_managers ... done!");
759+
m_atm_logger->flush(); // During init, flush often (to help debug crashes)
751760
}
752761

753762
void AtmosphereDriver::initialize_output_managers () {
754763
m_atm_logger->info("[EAMxx] initialize_output_managers ...");
764+
m_atm_logger->flush(); // During init, flush often (to help debug crashes)
755765
start_timer("EAMxx::init");
756766
start_timer("EAMxx::initialize_output_managers");
757767

@@ -788,6 +798,7 @@ void AtmosphereDriver::initialize_output_managers () {
788798
stop_timer("EAMxx::initialize_output_managers");
789799
stop_timer("EAMxx::init");
790800
m_atm_logger->info("[EAMxx] initialize_output_managers ... done!");
801+
m_atm_logger->flush(); // During init, flush often (to help debug crashes)
791802
}
792803

793804
void AtmosphereDriver::
@@ -1027,6 +1038,7 @@ void AtmosphereDriver::create_logger () {
10271038
void AtmosphereDriver::set_initial_conditions ()
10281039
{
10291040
m_atm_logger->info(" [EAMxx] set_initial_conditions ...");
1041+
m_atm_logger->flush(); // During init, flush often (to help debug crashes)
10301042

10311043
auto& ic_pl = m_atm_params.sublist("initial_conditions");
10321044

@@ -1416,6 +1428,7 @@ void AtmosphereDriver::set_initial_conditions ()
14161428
}
14171429

14181430
m_atm_logger->info(" [EAMxx] set_initial_conditions ... done!");
1431+
m_atm_logger->flush(); // During init, flush often (to help debug crashes)
14191432
}
14201433

14211434
void AtmosphereDriver::
@@ -1493,6 +1506,8 @@ initialize_constant_field(const FieldIdentifier& fid,
14931506
void AtmosphereDriver::initialize_atm_procs ()
14941507
{
14951508
m_atm_logger->info("[EAMxx] initialize_atm_procs ...");
1509+
m_atm_logger->flush(); // During init, flush often (to help debug crashes)
1510+
14961511
start_timer("EAMxx::init");
14971512
start_timer("EAMxx::initialize_atm_procs");
14981513

@@ -1532,6 +1547,7 @@ void AtmosphereDriver::initialize_atm_procs ()
15321547
stop_timer("EAMxx::initialize_atm_procs");
15331548
stop_timer("EAMxx::init");
15341549
m_atm_logger->info("[EAMxx] initialize_atm_procs ... done!");
1550+
m_atm_logger->flush(); // During init, flush often (to help debug crashes)
15351551

15361552
report_res_dep_memory_footprint ();
15371553

components/eamxx/src/share/atm_process/atmosphere_process.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ void AtmosphereProcess::initialize (const TimeStamp& t0, const RunType run_type)
7070
if (this->type()!=AtmosphereProcessType::Group) {
7171
start_timer (m_timer_prefix + this->name() + "::init");
7272
}
73+
74+
log (LogLevel::info," Initializing " + name() + "...");
75+
m_atm_logger->flush(); // During init, flush often (to help debug crashes)
76+
7377
set_fields_and_groups_pointers();
7478
m_time_stamp = t0;
7579
initialize_impl(run_type);
@@ -81,6 +85,9 @@ void AtmosphereProcess::initialize (const TimeStamp& t0, const RunType run_type)
8185
m_start_of_step_fields[fname] = get_field_out(fname).clone();
8286
}
8387

88+
log (LogLevel::info," Initializing " + name() + "... done!");
89+
m_atm_logger->flush(); // During init, flush often (to help debug crashes)
90+
8491
if (this->type()!=AtmosphereProcessType::Group) {
8592
stop_timer (m_timer_prefix + this->name() + "::init");
8693
}

0 commit comments

Comments
 (0)