diff --git a/src/ior-internal.h b/src/ior-internal.h index c0af5442..e07afbca 100644 --- a/src/ior-internal.h +++ b/src/ior-internal.h @@ -9,6 +9,7 @@ void PrintHeader(int argc, char **argv); void ShowTestStart(IOR_param_t *params); void ShowTestEnd(IOR_test_t *tptr); +void ShowTaskToProcessor(IOR_param_t *params); void ShowSetup(IOR_param_t *params); void PrintRepeatEnd(); void PrintRepeatStart(); diff --git a/src/ior-output.c b/src/ior-output.c index 73eb2749..1e2c1c92 100644 --- a/src/ior-output.c +++ b/src/ior-output.c @@ -409,6 +409,54 @@ void ShowTestEnd(IOR_test_t *tptr){ PrintEndSection(); } +/* + * Show the processor assigned to each task in rank order. + */ +void ShowTaskToProcessor(IOR_param_t *params) +{ + char processor[MAX_STR]; + int processorLen = MAX_STR; + char task[MAX_STR]; + + MPI_CHECK(MPI_Get_processor_name(processor, &processorLen), + "cannot get processor name"); + + if (rank > 0) { + /* wait for the previous rank to signal us */ + MPI_CHECK(MPI_Recv(NULL, 0, MPI_BYTE, rank - 1, 0, + params->testComm, MPI_STATUS_IGNORE), "recv error"); + + /* send our processor assignment to rank 0 */ + MPI_CHECK(MPI_Send(processor, processorLen, MPI_CHAR, 0, 1, + params->testComm), "send error"); + } + + if (rank < params->numTasks - 1) { + /* signal the next rank */ + MPI_CHECK(MPI_Send(NULL, 0, MPI_BYTE, rank + 1, 0, + params->testComm), "send error"); + } + + if (rank == 0) { + PrintNamedSectionStart("TaskToProcessor"); + + /* print our own processor assignment */ + PrintKeyVal("0", processor); + + /* receive all the processor assignments from the other ranks and print them out */ + for(int i = 1; i < params->numTasks; ++i) + { + MPI_CHECK(MPI_Recv(processor, MAX_STR, MPI_CHAR, i, 1, + params->testComm, MPI_STATUS_IGNORE), "recv error"); + sprintf(task, "%d", i); + PrintKeyVal(task, processor); + } + PrintEndSection(); + } + + MPI_CHECK(MPI_Barrier(params->testComm), "barrier error"); +} + /* * Show simple test output with max results for iterations. */ diff --git a/src/ior.c b/src/ior.c index 2e100251..52bf6345 100755 --- a/src/ior.c +++ b/src/ior.c @@ -1162,6 +1162,10 @@ static void TestIoSys(IOR_test_t *test) void *hog_buf; IOR_io_buffers ioBuffers; + /* show the processor assigned to each task in rank order */ + if (verbose >= VERBOSE_2) + ShowTaskToProcessor(params); + /* show test setup */ if (rank == 0 && verbose >= VERBOSE_0) ShowSetup(params);