Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions source/source_io/read_set_globalv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,17 +126,22 @@ void ReadInput::set_global_dir(const Input_para& inp, System_para& sys)

// set the global log file
bool out_alllog = inp.out_alllog;
// set the global calculation type
std::string cal_type = inp.calculation;
#ifdef __MPI
// because log_file is different for each rank, so we need to bcast the out_alllog
Parallel_Common::bcast_bool(out_alllog);
// In `ReadInput::read_parameters`, `bcastfunc(param)` is after `set_global_dir`,
// so `cal_type` must be synchronized here manually
Parallel_Common::bcast_string(cal_type);
#endif
if (out_alllog)
{
PARAM.sys.log_file = "running_" + PARAM.inp.calculation + "_" + std::to_string(PARAM.sys.myrank + 1) + ".log";
PARAM.sys.log_file = "running_" + cal_type + "_" + std::to_string(PARAM.sys.myrank + 1) + ".log";
}
else
{
PARAM.sys.log_file = "running_" + PARAM.inp.calculation + ".log";
PARAM.sys.log_file = "running_" + cal_type + ".log";
}
#ifdef __MPI
Parallel_Common::bcast_string(sys.global_in_card);
Expand Down
Loading