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

Add an option to fix the message size

parent 1e3af608
No related branches found
No related tags found
1 merge request!5Add an option to fix the message size
...@@ -38,6 +38,10 @@ static int verbose = 0; ...@@ -38,6 +38,10 @@ static int verbose = 0;
/* Attempt to keep original injection time differences. */ /* Attempt to keep original injection time differences. */
static int usetics = 1; static int usetics = 1;
/* Size of the messages we send. This overrides the logged values when not
* zero . */
static size_t messagesize = 0;
/* Integer types of send and recv tasks, must match log. */ /* Integer types of send and recv tasks, must match log. */
static const int task_type_send = 22; static const int task_type_send = 22;
static const int task_type_recv = 23; static const int task_type_recv = 23;
...@@ -336,6 +340,9 @@ static void pick_logs(void) { ...@@ -336,6 +340,9 @@ static void pick_logs(void) {
if (log->rank == myrank && log->activation) { if (log->rank == myrank && log->activation) {
if (log->type == task_type_send || log->type == task_type_recv) { if (log->type == task_type_send || log->type == task_type_recv) {
/* Override size if needed. */
if (messagesize > 0) log->size = messagesize;
/* Allocate space for data. */ /* Allocate space for data. */
log->data = calloc(log->size, 1); log->data = calloc(log->size, 1);
...@@ -366,7 +373,8 @@ static void pick_logs(void) { ...@@ -366,7 +373,8 @@ static void pick_logs(void) {
static void usage(char *argv[]) { static void usage(char *argv[]) {
fprintf(stderr, "Usage: %s [-vf] SWIFT_mpiuse-log-file.dat logfile.dat\n", fprintf(stderr, "Usage: %s [-vf] SWIFT_mpiuse-log-file.dat logfile.dat\n",
argv[0]); argv[0]);
fprintf(stderr, " options: -v verbose, -f fast injections\n"); fprintf(stderr, " options: -v verbose, -f fast injections, "
"-s message size (bytes)\n");
fflush(stderr); fflush(stderr);
} }
...@@ -392,7 +400,7 @@ int main(int argc, char *argv[]) { ...@@ -392,7 +400,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, "vf")) != -1) { while ((opt = getopt(argc, argv, "vfs:")) != -1) {
switch (opt) { switch (opt) {
case 'f': case 'f':
usetics = 0; usetics = 0;
...@@ -400,6 +408,9 @@ int main(int argc, char *argv[]) { ...@@ -400,6 +408,9 @@ int main(int argc, char *argv[]) {
case 'v': case 'v':
verbose = 1; verbose = 1;
break; break;
case 's':
messagesize = atoll(optarg);
break;
default: default:
if (myrank == 0) usage(argv); if (myrank == 0) usage(argv);
return 1; return 1;
...@@ -438,6 +449,10 @@ int main(int argc, char *argv[]) { ...@@ -438,6 +449,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 (messagesize > 0) {
message(" ");
message(" Using fixed message size of %zd", messagesize);
}
} }
/* Make three threads, one for injecting tasks and two to check for /* Make three threads, one for injecting tasks and two to check for
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment