Skip to content

Commit 1df223e

Browse files
committed
Replace fmt::println with std::cerr and std::format for error logging in functional and performance runners.
1 parent 201a6d3 commit 1df223e

2 files changed

Lines changed: 14 additions & 8 deletions

File tree

tasks/common/runners/functional.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#include <omp.h>
55

66
#include <cstdio>
7+
#include <format>
8+
#include <iostream>
79
#include <memory>
810
#include <string>
911
#include <utility>
@@ -27,10 +29,11 @@ class UnreadMessagesDetector : public ::testing::EmptyTestEventListener {
2729
MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &flag, &status);
2830

2931
if (flag != 0) {
30-
fmt::println(
31-
stderr,
32-
"[ PROCESS {} ] [ FAILED ] {}.{}: MPI message queue has an unread message from process {} with tag {}",
33-
rank, "test_suite_name", "test_name", status.MPI_SOURCE, status.MPI_TAG);
32+
std::cerr << std::format(
33+
"[ PROCESS {} ] [ FAILED ] {}.{}: MPI message queue has an unread message from process {} "
34+
"with tag {}",
35+
rank, "test_suite_name", "test_name", status.MPI_SOURCE, status.MPI_TAG)
36+
<< '\n';
3437
MPI_Abort(MPI_COMM_WORLD, EXIT_FAILURE);
3538
}
3639

tasks/common/runners/performance.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#include <omp.h>
55

66
#include <cstdio>
7+
#include <format>
8+
#include <iostream>
79
#include <memory>
810
#include <string>
911
#include <utility>
@@ -27,10 +29,11 @@ class UnreadMessagesDetector : public ::testing::EmptyTestEventListener {
2729
MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &flag, &status);
2830

2931
if (flag != 0) {
30-
fmt::println(stderr,
31-
"[ PROCESS {} ] [ FAILED ] MPI message queue has an unread message from process {} with tag {}",
32-
rank, status.MPI_SOURCE, status.MPI_TAG);
33-
32+
std::cerr
33+
<< std::format(
34+
"[ PROCESS {} ] [ FAILED ] MPI message queue has an unread message from process {} with tag {}",
35+
rank, status.MPI_SOURCE, status.MPI_TAG)
36+
<< '\n';
3437
MPI_Abort(MPI_COMM_WORLD, EXIT_FAILURE);
3538
}
3639

0 commit comments

Comments
 (0)