Skip to content

Commit 362445d

Browse files
committed
Use same prefix format for [host:pid]
Hostname and PID are output as a message prefix in many places in our code. Their printf-formats were either `[%s:%d]` or `[%s:%05d]`. This commit changes `[%s:%d]` to `[%s:%05d]`. The latter was more widely used in our code (including OPAL output system and the signal handler). Signed-off-by: KAWASHIMA Takahiro <[email protected]>
1 parent 6b91edd commit 362445d

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

ompi/errhandler/errhandler_predefined.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ static void backend_fatal_aggregate(char *type,
193193
arg = va_arg(arglist, char*);
194194
va_end(arglist);
195195

196-
if (asprintf(&prefix, "[%s:%d]",
196+
if (asprintf(&prefix, "[%s:%05d]",
197197
ompi_process_info.nodename,
198198
(int) ompi_process_info.pid) == -1) {
199199
prefix = NULL;

ompi/runtime/ompi_mpi_abort.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ ompi_mpi_abort(struct ompi_communicator_t* comm,
148148

149149
if (OPAL_SUCCESS == opal_backtrace_buffer(&messages, &len)) {
150150
for (i = 0; i < len; ++i) {
151-
fprintf(stderr, "[%s:%d] [%d] func:%s\n", host, (int) pid,
151+
fprintf(stderr, "[%s:%05d] [%d] func:%s\n", host, (int) pid,
152152
i, messages[i]);
153153
fflush(stderr);
154154
}
@@ -167,7 +167,7 @@ ompi_mpi_abort(struct ompi_communicator_t* comm,
167167
/* If the RTE isn't setup yet/any more, then don't even try
168168
killing everyone. Sorry, Charlie... */
169169
if (!ompi_rte_initialized) {
170-
fprintf(stderr, "[%s:%d] Local abort %s completed successfully, but am not able to aggregate error messages, and not able to guarantee that all other processes were killed!\n",
170+
fprintf(stderr, "[%s:%05d] Local abort %s completed successfully, but am not able to aggregate error messages, and not able to guarantee that all other processes were killed!\n",
171171
host, (int) pid, ompi_mpi_finalized ?
172172
"after MPI_FINALIZE started" : "before MPI_INIT completed");
173173
_exit(errcode == 0 ? 1 : errcode);

opal/mca/rcache/base/rcache_base_mem_cb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void mca_rcache_base_mem_cb (void* base, size_t size, void* cbdata, bool from_al
6565
if (rc != OPAL_SUCCESS) {
6666
if (from_alloc) {
6767
int len;
68-
len = snprintf(msg, sizeof(msg), "[%s:%d] Attempt to free memory that is still in "
68+
len = snprintf(msg, sizeof(msg), "[%s:%05d] Attempt to free memory that is still in "
6969
"use by an ongoing MPI communication (buffer %p, size %lu). MPI job "
7070
"will now abort.\n", opal_proc_local_get()->proc_hostname,
7171
getpid(), base, (unsigned long) size);

oshmem/runtime/oshmem_shmem_abort.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ int oshmem_shmem_abort(int errcode)
8181
if (OPAL_SUCCESS == opal_backtrace_buffer(&messages, &len)) {
8282
for (i = 0; i < len; ++i) {
8383
fprintf(stderr,
84-
"[%s:%d] [%d] func:%s\n",
84+
"[%s:%05d] [%d] func:%s\n",
8585
host,
8686
(int) pid,
8787
i,
@@ -110,7 +110,7 @@ int oshmem_shmem_abort(int errcode)
110110
(int) pid);
111111
} else {
112112
fprintf(stderr,
113-
"[%s:%d] Local abort completed successfully; not able to aggregate error messages, and not able to guarantee that all other processes were killed!\n",
113+
"[%s:%05d] Local abort completed successfully; not able to aggregate error messages, and not able to guarantee that all other processes were killed!\n",
114114
host,
115115
(int) pid);
116116
}

0 commit comments

Comments
 (0)