Skip to content
Snippets Groups Projects
Commit c706c1c8 authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Add option to scale the size of messages, fix bug in tobytes

parent 1aeb25b8
No related branches found
No related tags found
1 merge request!11Draft: Fast one-sided MPI version
...@@ -89,6 +89,9 @@ static const size_t HEADER_SIZE = 3; ...@@ -89,6 +89,9 @@ static const size_t HEADER_SIZE = 3;
/* Are we verbose. */ /* Are we verbose. */
static int verbose = 0; 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... */ /* Set a data pattern and check we get this back, slow... */
static int datacheck = 0; static int datacheck = 0;
...@@ -161,7 +164,7 @@ static int toblocks(BLOCKTYPE nr_bytes) { ...@@ -161,7 +164,7 @@ static int toblocks(BLOCKTYPE nr_bytes) {
* *
* @result the number of 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. * @brief fill a data area with our rank.
...@@ -470,6 +473,9 @@ static void pick_logs() { ...@@ -470,6 +473,9 @@ static void pick_logs() {
} else { } else {
error("task type '%d' is not a known send or recv task", log->type); 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[]) { ...@@ -535,7 +541,7 @@ int main(int argc, char *argv[]) {
/* Handle the command-line, we expect a mpiuse data file to read and various /* Handle the command-line, we expect a mpiuse data file to read and various
* options. */ * options. */
int opt; int opt;
while ((opt = getopt(argc, argv, "vd")) != -1) { while ((opt = getopt(argc, argv, "fvds:")) != -1) {
switch (opt) { switch (opt) {
case 'd': case 'd':
datacheck = 1; datacheck = 1;
...@@ -543,6 +549,9 @@ int main(int argc, char *argv[]) { ...@@ -543,6 +549,9 @@ int main(int argc, char *argv[]) {
case 'v': case 'v':
verbose = 1; verbose = 1;
break; break;
case 's':
messagescale = atof(optarg);
break;
default: default:
if (myrank == 0) usage(argv); if (myrank == 0) usage(argv);
return 1; return 1;
...@@ -585,8 +594,13 @@ int main(int argc, char *argv[]) { ...@@ -585,8 +594,13 @@ int main(int argc, char *argv[]) {
MPI_Comm_dup(MPI_COMM_WORLD, &subtypeMPI_comms[i]); MPI_Comm_dup(MPI_COMM_WORLD, &subtypeMPI_comms[i]);
size_t size = tobytes(ranktag_sizes[i]); size_t size = tobytes(ranktag_sizes[i]);
if (size == 0) size = BYTESINBLOCK; if (size == 0) size = BYTESINBLOCK;
MPI_Win_allocate(size, BYTESINBLOCK, MPI_INFO_NULL, subtypeMPI_comms[i], int ret = MPI_Win_allocate(size, BYTESINBLOCK, MPI_INFO_NULL,
&mpi_ptr[i], &mpi_window[i]); 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])); memset(mpi_ptr[i], 0, tobytes(ranktag_sizes[i]));
...@@ -614,6 +628,10 @@ int main(int argc, char *argv[]) { ...@@ -614,6 +628,10 @@ int main(int argc, char *argv[]) {
if (myrank == 0) { if (myrank == 0) {
message("Start of MPI tests"); message("Start of MPI tests");
message("=================="); message("==================");
if (messagescale != 1.0f) {
message(" ");
message(" Using message scale of %f", messagescale);
}
if (verbose) { if (verbose) {
if (datacheck) if (datacheck)
message("checking data pattern on send and recv completion"); message("checking data pattern on send and recv completion");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment