Skip to content

Commit 1a6c5b5

Browse files
committed
Print information only on rank 0
1 parent ff06229 commit 1a6c5b5

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/ML-METATOMIC/pair_metatomic.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -329,12 +329,14 @@ void PairMetatomic::settings(int argc, char ** argv) {
329329
mta_data->uncertainty_output->set_unit(this->energy_unit);
330330
mta_data->uncertainty_output->per_atom = true;
331331

332-
auto message = "Found '{}' output, we will check for atoms with high uncertainty on the energy predictions";
333-
if (screen) {
334-
fprintf(screen, "%s\n", fmt::format(message, mta_data->energy_uq_key).c_str());
335-
}
336-
if (logfile) {
337-
fprintf(logfile,"%s\n", fmt::format(message, mta_data->energy_uq_key).c_str());
332+
if (comm->me == 0) {
333+
auto message = "Found '{}' output, we will check for atoms with high uncertainty on the energy predictions";
334+
if (screen) {
335+
fprintf(screen, "%s\n", fmt::format(message, mta_data->energy_uq_key).c_str());
336+
}
337+
if (logfile) {
338+
fprintf(logfile,"%s\n", fmt::format(message, mta_data->energy_uq_key).c_str());
339+
}
338340
}
339341
}
340342
}
@@ -406,7 +408,10 @@ void PairMetatomic::pick_device(torch::Device& device, const char* requested) {
406408
}
407409

408410
try {
409-
device_string = metatomic_torch::pick_device(this->mta_data->capabilities->supported_devices, requested_string);
411+
device_string = metatomic_torch::pick_device(
412+
this->mta_data->capabilities->supported_devices,
413+
requested_string
414+
);
410415
} catch (const c10::Error& e) {
411416
error->all(FLERR, "pair_style metatomic: {}", e.what());
412417
}

0 commit comments

Comments
 (0)