diff --git a/mpiuse.c b/mpiuse.c index de72404ac44fa9500c56c0c57126f95a959f4c66..ee8737d5a7007284feab9cc18f7d3ba7ce8df53e 100644 --- a/mpiuse.c +++ b/mpiuse.c @@ -174,9 +174,11 @@ void mpiuse_log_restore(const char *filename) { * @brief dump the logs for all ranks to a file. * * @param nranks the number of ranks. + * @param standard only write a standard log, this can be used as input to + * other runs. * @param dumpfile the file to write */ -void mpiuse_dump_logs(int nranks, const char *dumpfile) { +void mpiuse_dump_logs(int nranks, int standard, const char *dumpfile) { /* Make sure output file is empty, only on one rank. */ FILE *fd; @@ -184,13 +186,21 @@ void mpiuse_dump_logs(int nranks, const char *dumpfile) { fd = fopen(dumpfile, "w"); /* Header. */ - fprintf(fd, - "# logticin logtic injtic endtic dtic step rank otherrank itype " - " isubtype tag size nr_tests tsum tmin tmax\n"); + if (standard) { + fprintf(fd, + "# stic etic dtic step rank otherrank type itype " + " subtype isubtype activation tag size sum\n"); + } else { + fprintf(fd, + "# logticin logtic injtic endtic dtic step rank otherrank itype " + " isubtype tag size nr_tests tsum tmin tmax\n"); + } fclose(fd); } MPI_Barrier(MPI_COMM_WORLD); + const char *types[] = {"send", "recv"}; + /* Loop over all ranks, one by one, getting each rank to append their * logs. */ for (int k = 0; k < nranks; k++) { @@ -210,20 +220,31 @@ void mpiuse_dump_logs(int nranks, const char *dumpfile) { * version to match the expected injection times for this new run. */ size_t nlogs = mpiuse_log_count; ticks basetics = 0; + long long sum = 0; for (size_t k = 0; k < nlogs; k++) { struct mpiuse_log_entry *log = &mpiuse_log[k]; if (log->rank == myrank && log->endtic > 0) { if (basetics == 0) basetics = log->tic; - fprintf(fd, - "%lld %.4f %.4f %.4f %.6f %d %d %d %d %d %d %zd %d %.4f %.6f " - "%.6f\n", - log->tic, clocks_from_ticks(log->tic - basetics), - clocks_from_ticks(log->injtic - clocks_start_ticks), - clocks_from_ticks(log->endtic - clocks_start_ticks), - clocks_from_ticks(log->endtic - log->injtic), log->step, - log->rank, log->otherrank, log->type, log->subtype, log->tag, - log->size, log->nr_tests, clocks_from_ticks(log->tsum), - clocks_from_ticks(log->tmin), clocks_from_ticks(log->tmax)); + if (standard) { + fprintf(fd, "%lld %lld %lld %d %d %d %s %d %s %d %d %d %zd %lld\n", + log->injtic, log->injtic, log->endtic - log->injtic, + log->step, log->rank, log->otherrank, + types[log->type - SEND_TYPE], log->type, "none", + log->subtype, log->activation, log->tag, log->size, sum); + sum += log->size; + } else { + fprintf( + fd, + "%lld %.4f %.4f %.4f %.6f %d %d %d %d %d %d %zd %d %.4f %.6f " + "%.6f\n", + log->tic, clocks_from_ticks(log->tic - basetics), + clocks_from_ticks(log->injtic - clocks_start_ticks), + clocks_from_ticks(log->endtic - clocks_start_ticks), + clocks_from_ticks(log->endtic - log->injtic), log->step, + log->rank, log->otherrank, log->type, log->subtype, log->tag, + log->size, log->nr_tests, clocks_from_ticks(log->tsum), + clocks_from_ticks(log->tmin), clocks_from_ticks(log->tmax)); + } } } fclose(fd); diff --git a/mpiuse.h b/mpiuse.h index 6a48c54080328d7852f2622a463ca9c26c8aa5e2..cbb09d5e7ffe0cc86a9799657ea21db9887ab544 100644 --- a/mpiuse.h +++ b/mpiuse.h @@ -94,7 +94,7 @@ struct mpiuse_log_entry { #ifndef SEND_TYPE #define SEND_TYPE 25 #define RECV_TYPE 26 -#define NO_SUBTYPE 0 +#define NO_SUBTYPE 1 #endif /* API. */ @@ -105,7 +105,7 @@ struct mpiuse_log_entry *mpiuse_get_log(int ind); void mpiuse_log_restore(const char *filename); int mpiuse_nr_logs(void); int mpiuse_nr_ranks(void); -void mpiuse_dump_logs(int nranks, const char *logfile); +void mpiuse_dump_logs(int nranks, int standard, const char *logfile); void mpiuse_log_generate(int nr_nodes, int nr_logs, int size, int random, long int seed, int uniform, const char *cdf, diff --git a/post-process.py b/post-process.py index 8a048b9fd8f37338aa17911872d3c40aef674a34..d7feceafce2d2be7a7bfba4a75e532c2e0e82992 100755 --- a/post-process.py +++ b/post-process.py @@ -92,7 +92,7 @@ with open(infile, "r") as fp: if line[0] == '#': continue words = line.split() - if words[itypecol] == "22": + if words[itypecol] == "25": key = words[otherrankcol] + "/" + \ words[rankcol] + "/" + \ words[isubtypecol] + "/" + \ @@ -105,7 +105,7 @@ with open(infile, "r") as fp: sends.append(words) nsends = nsends + 1 - elif words[itypecol] == "23": + elif words[itypecol] == "26": key = words[rankcol] + "/" + \ words[otherrankcol] + "/" + \ words[isubtypecol] + "/" + \ diff --git a/swiftmpifakestepsim.c b/swiftmpifakestepsim.c index d14d8538de4f2cd51d599881b6dcd4e9ef6678c8..e73ab832dd73c87342c7d99b260d7b204a4417ce 100644 --- a/swiftmpifakestepsim.c +++ b/swiftmpifakestepsim.c @@ -103,7 +103,7 @@ static void *inject_thread(void *arg) { log->nr_tests = 0; log->tsum = 0.0; log->tmax = 0; - log->tmin = INT_MAX; + log->tmin = LONG_MAX; log->endtic = 0; log->injtic = getticks(); @@ -175,7 +175,7 @@ static void queue_runner(struct mpiuse_log_entry **logs, int volatile *nr_logs, /* Global MPI_Test statistics. */ int lncalls = 0; double lsum = 0.0; - ticks lmint = INT_MAX; + ticks lmint = LONG_MAX; ticks lmaxt = 0; /* We loop while new requests are being injected and we still have requests @@ -388,7 +388,7 @@ static void pick_logs(int random) { * @brief usage help. */ static void usage(char *argv[]) { - fprintf(stderr, "Usage: %s [options] nr_messages logfile.dat\n", argv[0]); + fprintf(stderr, "Usage: %s [vds:rgx:c:o:f:z] nr_messages logfile.dat\n", argv[0]); fprintf(stderr, " options: -v verbose, -d data check, -s size (bytes/scale), \n" "\t -f <1|2> randomize injection order, 1 == just sends, " @@ -398,7 +398,8 @@ static void usage(char *argv[]) { "\t-r -c <file> use cdf from file, size is a scale factor., |\n" "\t-r -o <file> use occurence sample of values in a file, size is a " "scale factor.,] \n" - "\t-x random seed\n"); + "\t-x random seed\n" + "\t-z outout log in standard format, i.e. can be used as input"); fflush(stderr); } @@ -424,15 +425,16 @@ int main(int argc, char *argv[]) { /* Handle the command-line, we expect the number of messages to exchange per * rank an output log and some options, the interesting ones are a size and * whether to use a random selections of various kinds. */ - int size = 1024; - int random = 0; - int randomorder = 0; - int uniform = 1; char *cdf = NULL; char *odata = NULL; int opt; + int random = 0; + int randomorder = 0; + int size = 1024; + int standard = 0; + int uniform = 1; unsigned int seed = default_seed; - while ((opt = getopt(argc, argv, "vds:rgx:c:o:f:")) != -1) { + while ((opt = getopt(argc, argv, "vds:rgx:c:o:f:z")) != -1) { switch (opt) { case 'd': datacheck = 1; @@ -458,6 +460,9 @@ int main(int argc, char *argv[]) { case 'v': verbose = 1; break; + case 'z': + standard = 1; + break; case 'x': seed = atol(optarg); break; @@ -532,10 +537,8 @@ int main(int argc, char *argv[]) { if (myrank == 0) { message("Start of MPI tests"); message("=================="); - if (verbose) { - if (datacheck) - message("checking data pattern on send and recv completion"); - } + if (datacheck) + message("Checking data pattern on send and recv completion"); } /* Make three threads, one for injecting tasks and two to check for @@ -559,7 +562,7 @@ int main(int argc, char *argv[]) { MPI_Barrier(MPI_COMM_WORLD); fflush(stdout); if (myrank == 0) message("Dumping updated log"); - mpiuse_dump_logs(nranks, logfile); + mpiuse_dump_logs(nranks, standard, logfile); /* Shutdown MPI. */ res = MPI_Finalize(); diff --git a/swiftmpistepsim.c b/swiftmpistepsim.c index 715ea7bc81518685c655348540fbd9edd0cc373b..85d3459073071413473308f851e5cb1cc6a28af5 100644 --- a/swiftmpistepsim.c +++ b/swiftmpistepsim.c @@ -53,7 +53,7 @@ static const int task_type_send = 25; static const int task_type_recv = 26; /* Global communicators for each of the subtypes. */ -static const int task_subtype_count = 34; // Just some upper limit on subtype. +#define task_subtype_count 34 // Just some upper limit on subtype. static MPI_Comm subtypeMPI_comms[task_subtype_count]; /* The local queues. */ @@ -243,7 +243,7 @@ static void queue_runner(struct mpiuse_log_entry **logs, int volatile *nr_logs, /* Global MPI_Test statistics. */ int lncalls = 0; double lsum = 0.0; - ticks lmint = INT_MAX; + ticks lmint = LONG_MAX; ticks lmaxt = 0; /* We loop while new requests are being injected and we still have requests @@ -471,6 +471,7 @@ int main(int argc, char *argv[]) { break; case 'c': messagescale = atof(optarg); + break; case 's': messagesize = atoll(optarg); break; @@ -513,20 +514,14 @@ int main(int argc, char *argv[]) { clocks_set_cpufreq(freq); if (myrank == 0) { message("Start of MPI tests"); - if (messagesize > 0) { - message(" "); - message(" Using fixed message size of %zd", messagesize); - } message("=================="); - if (messagescale != 1.0f) { - message(" "); - message(" Using message scale of %f", messagescale); - } - if (verbose) { - if (!usetics) message("using fast untimed injections"); - if (datacheck) - message("checking data pattern on send and recv completion"); - } + if (messagesize > 0) + message("Using fixed message size of %zd", messagesize); + if (messagescale != 1.0f) + message("Using message scale of %f", messagescale); + if (!usetics) message("Using fast untimed injections"); + if (datacheck) + message("Checking data pattern on send and recv completion"); } /* Make three threads, one for injecting tasks and two to check for @@ -550,7 +545,7 @@ int main(int argc, char *argv[]) { MPI_Barrier(MPI_COMM_WORLD); fflush(stdout); if (myrank == 0) message("Dumping updated log"); - mpiuse_dump_logs(nranks, logfile); + mpiuse_dump_logs(nranks, 0, logfile); /* Shutdown MPI. */ res = MPI_Finalize();