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

Merge branch 'master' into 'multi-injectors-many'

# Conflicts:
#   swiftmpistepsim.c
parents 0bb84451 0f210f8c
No related tags found
1 merge request!3Draft: Multi injectors many
...@@ -174,9 +174,11 @@ void mpiuse_log_restore(const char *filename) { ...@@ -174,9 +174,11 @@ void mpiuse_log_restore(const char *filename) {
* @brief dump the logs for all ranks to a file. * @brief dump the logs for all ranks to a file.
* *
* @param nranks the number of ranks. * @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 * @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. */ /* Make sure output file is empty, only on one rank. */
FILE *fd; FILE *fd;
...@@ -184,13 +186,21 @@ void mpiuse_dump_logs(int nranks, const char *dumpfile) { ...@@ -184,13 +186,21 @@ void mpiuse_dump_logs(int nranks, const char *dumpfile) {
fd = fopen(dumpfile, "w"); fd = fopen(dumpfile, "w");
/* Header. */ /* Header. */
fprintf(fd, if (standard) {
"# logticin logtic injtic endtic dtic step rank otherrank itype " fprintf(fd,
" isubtype tag size nr_tests tsum tmin tmax\n"); "# 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); fclose(fd);
} }
MPI_Barrier(MPI_COMM_WORLD); MPI_Barrier(MPI_COMM_WORLD);
const char *types[] = {"send", "recv"};
/* Loop over all ranks, one by one, getting each rank to append their /* Loop over all ranks, one by one, getting each rank to append their
* logs. */ * logs. */
for (int k = 0; k < nranks; k++) { for (int k = 0; k < nranks; k++) {
...@@ -210,20 +220,31 @@ void mpiuse_dump_logs(int nranks, const char *dumpfile) { ...@@ -210,20 +220,31 @@ void mpiuse_dump_logs(int nranks, const char *dumpfile) {
* version to match the expected injection times for this new run. */ * version to match the expected injection times for this new run. */
size_t nlogs = mpiuse_log_count; size_t nlogs = mpiuse_log_count;
ticks basetics = 0; ticks basetics = 0;
long long sum = 0;
for (size_t k = 0; k < nlogs; k++) { for (size_t k = 0; k < nlogs; k++) {
struct mpiuse_log_entry *log = &mpiuse_log[k]; struct mpiuse_log_entry *log = &mpiuse_log[k];
if (log->rank == myrank && log->endtic > 0) { if (log->rank == myrank && log->endtic > 0) {
if (basetics == 0) basetics = log->tic; if (basetics == 0) basetics = log->tic;
fprintf(fd, if (standard) {
"%lld %.4f %.4f %.4f %.6f %d %d %d %d %d %d %zd %d %.4f %.6f " fprintf(fd, "%lld %lld %lld %d %d %d %s %d %s %d %d %d %zd %lld\n",
"%.6f\n", log->injtic, log->injtic, log->endtic - log->injtic,
log->tic, clocks_from_ticks(log->tic - basetics), log->step, log->rank, log->otherrank,
clocks_from_ticks(log->injtic - clocks_start_ticks), types[log->type - SEND_TYPE], log->type, "none",
clocks_from_ticks(log->endtic - clocks_start_ticks), log->subtype, log->activation, log->tag, log->size, sum);
clocks_from_ticks(log->endtic - log->injtic), log->step, sum += log->size;
log->rank, log->otherrank, log->type, log->subtype, log->tag, } else {
log->size, log->nr_tests, clocks_from_ticks(log->tsum), fprintf(
clocks_from_ticks(log->tmin), clocks_from_ticks(log->tmax)); 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); fclose(fd);
......
...@@ -88,7 +88,7 @@ struct mpiuse_log_entry { ...@@ -88,7 +88,7 @@ struct mpiuse_log_entry {
#ifndef SEND_TYPE #ifndef SEND_TYPE
#define SEND_TYPE 25 #define SEND_TYPE 25
#define RECV_TYPE 26 #define RECV_TYPE 26
#define NO_SUBTYPE 0 #define NO_SUBTYPE 1
#endif #endif
/* API. */ /* API. */
...@@ -99,7 +99,7 @@ struct mpiuse_log_entry *mpiuse_get_log(int ind); ...@@ -99,7 +99,7 @@ struct mpiuse_log_entry *mpiuse_get_log(int ind);
void mpiuse_log_restore(const char *filename); void mpiuse_log_restore(const char *filename);
int mpiuse_nr_logs(void); int mpiuse_nr_logs(void);
int mpiuse_nr_ranks(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, void mpiuse_log_generate(int nr_nodes, int nr_logs, int size, int random,
long int seed, int uniform, const char *cdf, long int seed, int uniform, const char *cdf,
......
...@@ -92,7 +92,7 @@ with open(infile, "r") as fp: ...@@ -92,7 +92,7 @@ with open(infile, "r") as fp:
if line[0] == '#': if line[0] == '#':
continue continue
words = line.split() words = line.split()
if words[itypecol] == "22": if words[itypecol] == "25":
key = words[otherrankcol] + "/" + \ key = words[otherrankcol] + "/" + \
words[rankcol] + "/" + \ words[rankcol] + "/" + \
words[isubtypecol] + "/" + \ words[isubtypecol] + "/" + \
...@@ -105,7 +105,7 @@ with open(infile, "r") as fp: ...@@ -105,7 +105,7 @@ with open(infile, "r") as fp:
sends.append(words) sends.append(words)
nsends = nsends + 1 nsends = nsends + 1
elif words[itypecol] == "23": elif words[itypecol] == "26":
key = words[rankcol] + "/" + \ key = words[rankcol] + "/" + \
words[otherrankcol] + "/" + \ words[otherrankcol] + "/" + \
words[isubtypecol] + "/" + \ words[isubtypecol] + "/" + \
......
...@@ -103,7 +103,7 @@ static void *inject_thread(void *arg) { ...@@ -103,7 +103,7 @@ static void *inject_thread(void *arg) {
log->nr_tests = 0; log->nr_tests = 0;
log->tsum = 0.0; log->tsum = 0.0;
log->tmax = 0; log->tmax = 0;
log->tmin = INT_MAX; log->tmin = LONG_MAX;
log->endtic = 0; log->endtic = 0;
log->injtic = getticks(); log->injtic = getticks();
...@@ -175,7 +175,7 @@ static void queue_runner(struct mpiuse_log_entry **logs, int volatile *nr_logs, ...@@ -175,7 +175,7 @@ static void queue_runner(struct mpiuse_log_entry **logs, int volatile *nr_logs,
/* Global MPI_Test statistics. */ /* Global MPI_Test statistics. */
int lncalls = 0; int lncalls = 0;
double lsum = 0.0; double lsum = 0.0;
ticks lmint = INT_MAX; ticks lmint = LONG_MAX;
ticks lmaxt = 0; ticks lmaxt = 0;
/* We loop while new requests are being injected and we still have requests /* We loop while new requests are being injected and we still have requests
...@@ -388,7 +388,7 @@ static void pick_logs(int random) { ...@@ -388,7 +388,7 @@ static void pick_logs(int random) {
* @brief usage help. * @brief usage help.
*/ */
static void usage(char *argv[]) { 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, fprintf(stderr,
" options: -v verbose, -d data check, -s size (bytes/scale), \n" " options: -v verbose, -d data check, -s size (bytes/scale), \n"
"\t -f <1|2> randomize injection order, 1 == just sends, " "\t -f <1|2> randomize injection order, 1 == just sends, "
...@@ -398,7 +398,8 @@ static void usage(char *argv[]) { ...@@ -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 -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 " "\t-r -o <file> use occurence sample of values in a file, size is a "
"scale factor.,] \n" "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); fflush(stderr);
} }
...@@ -424,15 +425,16 @@ int main(int argc, char *argv[]) { ...@@ -424,15 +425,16 @@ int main(int argc, char *argv[]) {
/* Handle the command-line, we expect the number of messages to exchange per /* 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 * rank an output log and some options, the interesting ones are a size and
* whether to use a random selections of various kinds. */ * 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 *cdf = NULL;
char *odata = NULL; char *odata = NULL;
int opt; int opt;
int random = 0;
int randomorder = 0;
int size = 1024;
int standard = 0;
int uniform = 1;
unsigned int seed = default_seed; 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) { switch (opt) {
case 'd': case 'd':
datacheck = 1; datacheck = 1;
...@@ -458,6 +460,9 @@ int main(int argc, char *argv[]) { ...@@ -458,6 +460,9 @@ int main(int argc, char *argv[]) {
case 'v': case 'v':
verbose = 1; verbose = 1;
break; break;
case 'z':
standard = 1;
break;
case 'x': case 'x':
seed = atol(optarg); seed = atol(optarg);
break; break;
...@@ -532,10 +537,8 @@ int main(int argc, char *argv[]) { ...@@ -532,10 +537,8 @@ 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 (verbose) { if (datacheck)
if (datacheck) message("Checking data pattern on send and recv completion");
message("checking data pattern on send and recv completion");
}
} }
/* Make three threads, one for injecting tasks and two to check for /* Make three threads, one for injecting tasks and two to check for
...@@ -559,7 +562,7 @@ int main(int argc, char *argv[]) { ...@@ -559,7 +562,7 @@ int main(int argc, char *argv[]) {
MPI_Barrier(MPI_COMM_WORLD); MPI_Barrier(MPI_COMM_WORLD);
fflush(stdout); fflush(stdout);
if (myrank == 0) message("Dumping updated log"); if (myrank == 0) message("Dumping updated log");
mpiuse_dump_logs(nranks, logfile); mpiuse_dump_logs(nranks, standard, logfile);
/* Shutdown MPI. */ /* Shutdown MPI. */
res = MPI_Finalize(); res = MPI_Finalize();
......
...@@ -56,7 +56,7 @@ static const int task_type_send = 25; ...@@ -56,7 +56,7 @@ static const int task_type_send = 25;
static const int task_type_recv = 26; static const int task_type_recv = 26;
/* Global communicators for each of the subtypes. */ /* 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]; static MPI_Comm subtypeMPI_comms[task_subtype_count];
/* The local queues. */ /* The local queues. */
...@@ -164,7 +164,7 @@ static void injection_runner(int qid) { ...@@ -164,7 +164,7 @@ static void injection_runner(int qid) {
log->nr_tests = 0; log->nr_tests = 0;
log->tsum = 0.0; log->tsum = 0.0;
log->tmax = 0; log->tmax = 0;
log->tmin = INT_MAX; log->tmin = LONG_MAX;
log->endtic = 0; log->endtic = 0;
log->injtic = getticks(); log->injtic = getticks();
...@@ -259,7 +259,7 @@ static void queue_runner(struct mpiuse_log_entry **logs, int volatile *nr_logs, ...@@ -259,7 +259,7 @@ static void queue_runner(struct mpiuse_log_entry **logs, int volatile *nr_logs,
/* Global MPI_Test statistics. */ /* Global MPI_Test statistics. */
int lncalls = 0; int lncalls = 0;
double lsum = 0.0; double lsum = 0.0;
ticks lmint = INT_MAX; ticks lmint = LONG_MAX;
ticks lmaxt = 0; ticks lmaxt = 0;
/* We loop while new requests are being injected and we still have requests /* We loop while new requests are being injected and we still have requests
...@@ -503,6 +503,7 @@ int main(int argc, char *argv[]) { ...@@ -503,6 +503,7 @@ int main(int argc, char *argv[]) {
waitns = atoll(optarg); waitns = atoll(optarg);
case 'c': case 'c':
messagescale = atof(optarg); messagescale = atof(optarg);
break;
case 's': case 's':
messagesize = atoll(optarg); messagesize = atoll(optarg);
break; break;
...@@ -544,21 +545,13 @@ int main(int argc, char *argv[]) { ...@@ -544,21 +545,13 @@ 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 (waitns > 0) message("Adding fixed waits of %lld ns", waitns); if (messagesize > 0)
if (messagesize > 0) { message("Using fixed message size of %zd", messagesize);
message(" "); if (messagescale != 1.0f)
message(" Using fixed message size of %zd", messagesize); message("Using message scale of %f", messagescale);
} if (!usetics) message("Using fast untimed injections");
message("=================="); if (datacheck)
if (messagescale != 1.0f) { message("Checking data pattern on send and recv completion");
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");
}
} }
/* Make three threads, one for injecting tasks and two to check for /* Make three threads, one for injecting tasks and two to check for
...@@ -588,7 +581,7 @@ int main(int argc, char *argv[]) { ...@@ -588,7 +581,7 @@ int main(int argc, char *argv[]) {
MPI_Barrier(MPI_COMM_WORLD); MPI_Barrier(MPI_COMM_WORLD);
fflush(stdout); fflush(stdout);
if (myrank == 0) message("Dumping updated log"); if (myrank == 0) message("Dumping updated log");
mpiuse_dump_logs(nranks, logfile); mpiuse_dump_logs(nranks, 0, logfile);
/* Shutdown MPI. */ /* Shutdown MPI. */
res = MPI_Finalize(); res = MPI_Finalize();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment