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

Add a time that is relative to the start of the step

Should make it easier to sync between ranks
parent ba0576cc
No related branches found
No related tags found
1 merge request!861Add logging for task MPI requests
...@@ -1170,7 +1170,7 @@ int main(int argc, char *argv[]) { ...@@ -1170,7 +1170,7 @@ int main(int argc, char *argv[]) {
{ {
char dumpfile[40]; char dumpfile[40];
snprintf(dumpfile, 40, "mpiuse_report-rank%d-step%d.dat", engine_rank, 0); snprintf(dumpfile, 40, "mpiuse_report-rank%d-step%d.dat", engine_rank, 0);
mpiuse_log_dump(dumpfile); mpiuse_log_dump(dumpfile, clocks_start_ticks);
} }
#endif #endif
...@@ -1241,7 +1241,7 @@ int main(int argc, char *argv[]) { ...@@ -1241,7 +1241,7 @@ int main(int argc, char *argv[]) {
char dumpfile[40]; char dumpfile[40];
snprintf(dumpfile, 40, "mpiuse_report-rank%d-step%d.dat", engine_rank, snprintf(dumpfile, 40, "mpiuse_report-rank%d-step%d.dat", engine_rank,
j + 1); j + 1);
mpiuse_log_dump(dumpfile); mpiuse_log_dump(dumpfile, e.tic_step);
} }
#endif // WITH_MPI #endif // WITH_MPI
......
...@@ -77,8 +77,8 @@ struct mpiuse_log_entry { ...@@ -77,8 +77,8 @@ struct mpiuse_log_entry {
uint8_t vptr[sizeof(uintptr_t)]; /* For rnode keys. */ uint8_t vptr[sizeof(uintptr_t)]; /* For rnode keys. */
}; };
/* Relative time of this action. */ /* Ticks at time of this action. */
ticks dtic; ticks tic;
/* Time taken for handoff of this action. */ /* Time taken for handoff of this action. */
ticks acttic; ticks acttic;
...@@ -171,7 +171,7 @@ void mpiuse_log_allocation(int type, int subtype, void *ptr, int activation, ...@@ -171,7 +171,7 @@ void mpiuse_log_allocation(int type, int subtype, void *ptr, int activation,
mpiuse_log[ind].ptr = ptr; mpiuse_log[ind].ptr = ptr;
mpiuse_log[ind].otherrank = otherrank; mpiuse_log[ind].otherrank = otherrank;
mpiuse_log[ind].tag = tag; mpiuse_log[ind].tag = tag;
mpiuse_log[ind].dtic = getticks() - clocks_start_ticks; mpiuse_log[ind].tic = getticks();
mpiuse_log[ind].acttic = 0; mpiuse_log[ind].acttic = 0;
mpiuse_log[ind].active = 1; mpiuse_log[ind].active = 1;
atomic_inc(&mpiuse_log_done); atomic_inc(&mpiuse_log_done);
...@@ -181,8 +181,11 @@ void mpiuse_log_allocation(int type, int subtype, void *ptr, int activation, ...@@ -181,8 +181,11 @@ void mpiuse_log_allocation(int type, int subtype, void *ptr, int activation,
* @brief dump the log to a file and reset, if anything to dump. * @brief dump the log to a file and reset, if anything to dump.
* *
* @param filename name of file for log dump. * @param filename name of file for log dump.
* @param stepticks the clock ticks at the start of step, if dumping a step,
* otherwise some locally relative time that might help
* synchronize across ranks.
*/ */
void mpiuse_log_dump(const char *filename) { void mpiuse_log_dump(const char *filename, ticks stepticks) {
/* Skip if nothing logged this step. */ /* Skip if nothing logged this step. */
if (mpiuse_log_count == 0) return; if (mpiuse_log_count == 0) return;
...@@ -206,7 +209,7 @@ void mpiuse_log_dump(const char *filename) { ...@@ -206,7 +209,7 @@ void mpiuse_log_dump(const char *filename) {
/* Write a header. */ /* Write a header. */
fprintf(fd, fprintf(fd,
"# dtic acttic step rank otherrank type itype subtype isubtype " "# stic etic dtic step rank otherrank type itype subtype isubtype "
"activation tag size sum\n"); "activation tag size sum\n");
size_t mpiuse_current = 0; size_t mpiuse_current = 0;
...@@ -243,7 +246,7 @@ void mpiuse_log_dump(const char *filename) { ...@@ -243,7 +246,7 @@ void mpiuse_log_dump(const char *filename) {
mpiuse_log[k].tag = oldlog->tag; mpiuse_log[k].tag = oldlog->tag;
/* Time taken to handoff. */ /* Time taken to handoff. */
mpiuse_log[k].acttic = mpiuse_log[k].dtic - oldlog->dtic; mpiuse_log[k].acttic = mpiuse_log[k].tic - oldlog->tic;
/* And deactivate this key. */ /* And deactivate this key. */
child->ptr = NULL; child->ptr = NULL;
...@@ -298,13 +301,14 @@ void mpiuse_log_dump(const char *filename) { ...@@ -298,13 +301,14 @@ void mpiuse_log_dump(const char *filename) {
} }
/* And output. */ /* And output. */
fprintf(fd, "%lld %lld %d %d %d %s %d %s %d %d %d %zd %zd\n", fprintf(fd, "%lld %lld %lld %d %d %d %s %d %s %d %d %d %zd %zd\n",
mpiuse_log[k].dtic, mpiuse_log[k].acttic, mpiuse_log[k].step, mpiuse_log[k].tic - stepticks,
engine_rank, mpiuse_log[k].otherrank, mpiuse_log[k].tic - clocks_start_ticks,
taskID_names[mpiuse_log[k].type], mpiuse_log[k].type, mpiuse_log[k].acttic, mpiuse_log[k].step, engine_rank,
subtaskID_names[mpiuse_log[k].subtype], mpiuse_log[k].subtype, mpiuse_log[k].otherrank, taskID_names[mpiuse_log[k].type],
mpiuse_log[k].activation, mpiuse_log[k].tag, mpiuse_log[k].size, mpiuse_log[k].type, subtaskID_names[mpiuse_log[k].subtype],
mpiuse_current); mpiuse_log[k].subtype, mpiuse_log[k].activation,
mpiuse_log[k].tag, mpiuse_log[k].size, mpiuse_current);
} }
#ifdef MEMUSE_RNODE_DUMP #ifdef MEMUSE_RNODE_DUMP
......
...@@ -22,12 +22,15 @@ ...@@ -22,12 +22,15 @@
/* Config parameters. */ /* Config parameters. */
#include "../config.h" #include "../config.h"
/* Local includes. */
#include "cycle.h"
/* Includes. */ /* Includes. */
#include <stdlib.h> #include <stdlib.h>
/* API. */ /* API. */
#if defined(SWIFT_MPIUSE_REPORTS) && defined(WITH_MPI) #if defined(SWIFT_MPIUSE_REPORTS) && defined(WITH_MPI)
void mpiuse_log_dump(const char *filename); void mpiuse_log_dump(const char *filename, ticks stepticks);
void mpiuse_log_allocation(int type, int subtype, void *ptr, int activation, void mpiuse_log_allocation(int type, int subtype, void *ptr, int activation,
size_t size, int otherrank, int tag); size_t size, int otherrank, int tag);
#else #else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment