diff --git a/swiftmpirdmastepsim.c b/swiftmpirdmastepsim.c index ff03b6af5e281c1cf6e3a60040a03a81750cf3f2..8169235c93edbaa2630b0a046515594ea77820e2 100644 --- a/swiftmpirdmastepsim.c +++ b/swiftmpirdmastepsim.c @@ -89,6 +89,9 @@ static const size_t HEADER_SIZE = 3; /* Are we verbose. */ static int verbose = 0; +/* Scale to apply to the size of the messages we send. */ +static double messagescale = 1.0; + /* Set a data pattern and check we get this back, slow... */ static int datacheck = 0; @@ -161,7 +164,7 @@ static int toblocks(BLOCKTYPE nr_bytes) { * * @result the number of bytes. */ -static BLOCKTYPE tobytes(int nr_blocks) { return (nr_blocks * BYTESINBLOCK); } +static BLOCKTYPE tobytes(BLOCKTYPE nr_blocks) { return (nr_blocks * BYTESINBLOCK); } /** * @brief fill a data area with our rank. @@ -470,6 +473,9 @@ static void pick_logs() { } else { error("task type '%d' is not a known send or recv task", log->type); } + + /* Scale size. */ + log->size *= messagescale ; } } } @@ -535,7 +541,7 @@ int main(int argc, char *argv[]) { /* Handle the command-line, we expect a mpiuse data file to read and various * options. */ int opt; - while ((opt = getopt(argc, argv, "vd")) != -1) { + while ((opt = getopt(argc, argv, "fvds:")) != -1) { switch (opt) { case 'd': datacheck = 1; @@ -543,6 +549,9 @@ int main(int argc, char *argv[]) { case 'v': verbose = 1; break; + case 's': + messagescale = atof(optarg); + break; default: if (myrank == 0) usage(argv); return 1; @@ -585,8 +594,13 @@ int main(int argc, char *argv[]) { MPI_Comm_dup(MPI_COMM_WORLD, &subtypeMPI_comms[i]); size_t size = tobytes(ranktag_sizes[i]); if (size == 0) size = BYTESINBLOCK; - MPI_Win_allocate(size, BYTESINBLOCK, MPI_INFO_NULL, subtypeMPI_comms[i], - &mpi_ptr[i], &mpi_window[i]); + int ret = MPI_Win_allocate(size, BYTESINBLOCK, MPI_INFO_NULL, + subtypeMPI_comms[i], &mpi_ptr[i], + &mpi_window[i]); + if (ret != MPI_SUCCESS) { + message("failed on size %zd", size); fflush(stdout); + mpi_error_message(ret, "MPI_Win_allocate failed"); + } memset(mpi_ptr[i], 0, tobytes(ranktag_sizes[i])); @@ -614,6 +628,10 @@ int main(int argc, char *argv[]) { if (myrank == 0) { message("Start of MPI tests"); message("=================="); + if (messagescale != 1.0f) { + message(" "); + message(" Using message scale of %f", messagescale); + } if (verbose) { if (datacheck) message("checking data pattern on send and recv completion");