Skip to content

Commit

Permalink
print pcontrol vals in trace
Browse files Browse the repository at this point in the history
  • Loading branch information
tim0s committed Oct 22, 2023
1 parent 42ebecc commit 5da8660
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 22 deletions.
5 changes: 1 addition & 4 deletions build/mpi_c_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,6 @@ static void lap_collect_traces(void) {
free(chunkbuf);
}

void lap_write_epoch(int epoch) {
WRITE_TRACE("# epoch %i\n", epoch);
}

int MPI_Abort (MPI_Comm comm, int errorcode) {
if (lap_tracing_enabled == 0) {
int pmpi_retval; pmpi_retval = PMPI_Abort(comm, errorcode);
Expand Down Expand Up @@ -5925,6 +5921,7 @@ int MPI_Pcontrol (const int level, ...) {
if (level == 1) { lap_tracing_enabled = 1; lap_elem_tracing_enabled = 0; lap_backtrace_enabled = 0; }
if (level == 2) { lap_tracing_enabled = 1; lap_elem_tracing_enabled = 1; lap_backtrace_enabled = 0; }
if (level >= 3) { lap_tracing_enabled = 1; lap_elem_tracing_enabled = 1; lap_backtrace_enabled = 1; }
WRITE_TRACE("# pcontrol with value / epoch %i)\n", level);
return MPI_SUCCESS;
}

Expand Down
5 changes: 1 addition & 4 deletions build/mpi_f_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -467,10 +467,6 @@ void FortranCInterface_GLOBAL(pmpi_wtick,PMPI_WTICK) (int* ierr);
void FortranCInterface_GLOBAL(pmpi_wtime,PMPI_WTIME) (int* ierr);


void FortranCInterface_GLOBAL(lap_write_epoch,LAP_WRITE_EPOCH) (int* epoch) {
WRITE_TRACE("# epoch %i\n", *epoch);
}

void FortranCInterface_GLOBAL(mpi_abort,MPI_ABORT) (int* comm, int* errorcode, int* ierr) {
if (lap_tracing_enabled == 0) {
int pmpi_retval; FortranCInterface_GLOBAL(pmpi_abort,PMPI_ABORT)(comm, errorcode, ierr);
Expand Down Expand Up @@ -5835,6 +5831,7 @@ void FortranCInterface_GLOBAL(mpi_pcontrol,MPI_PCONTROL) (int* level, int* ierr)
if (*level == 1) { lap_tracing_enabled = 1; lap_elem_tracing_enabled = 0; lap_backtrace_enabled = 0; }
if (*level == 2) { lap_tracing_enabled = 1; lap_elem_tracing_enabled = 1; lap_backtrace_enabled = 0; }
if (*level >= 3) { lap_tracing_enabled = 1; lap_elem_tracing_enabled = 1; lap_backtrace_enabled = 1; }
WRITE_TRACE("# pcontrol with value / epoch %i)\n", *level);
}

void FortranCInterface_GLOBAL(mpi_probe,MPI_PROBE) (int* source, int* tag, int* comm, int* status, int* ierr) {
Expand Down
15 changes: 1 addition & 14 deletions src/liballprof2/gencode.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,18 +293,6 @@ def produce_fortran_pmpi_prototypes(self):
self.outfile.write(f"void FortranCInterface_GLOBAL({pfunc.lower()},{pfunc.upper()}) ({params})"+";\n")
self.outfile.write("\n\n")

def produce_lap_util(self, mode):
ref = ""
if mode == 'fortran':
ref = "*"
pfunc = "lap_write_epoch"
params = f"int{ref} epoch"
if mode == 'fortran':
self.outfile.write(f"void FortranCInterface_GLOBAL({pfunc.lower()},{pfunc.upper()}) ({params})"+" {\n")
else:
self.outfile.write(f"void {pfunc}({params})"+" {\n")
self.outfile.write(f" WRITE_TRACE(\"# epoch %i\\n\", {ref}epoch);\n")
self.outfile.write("}\n\n")

def produce_pmpi_only_if_tracing_disabled(self, func, mode):
self.outfile.write(f" if (lap_tracing_enabled == 0) {{ \n")
Expand All @@ -325,6 +313,7 @@ def produce_pcontrol(self, mode):
self.outfile.write(f" if ({deref}level == 1) {{ lap_tracing_enabled = 1; lap_elem_tracing_enabled = 0; lap_backtrace_enabled = 0; }}\n")
self.outfile.write(f" if ({deref}level == 2) {{ lap_tracing_enabled = 1; lap_elem_tracing_enabled = 1; lap_backtrace_enabled = 0; }}\n")
self.outfile.write(f" if ({deref}level >= 3) {{ lap_tracing_enabled = 1; lap_elem_tracing_enabled = 1; lap_backtrace_enabled = 1; }}\n")
self.outfile.write(f" WRITE_TRACE(\"# pcontrol with value / epoch %i)\\n\", {deref}level);\n")
if mode == 'c':
self.outfile.write(f" return MPI_SUCCESS;\n")

Expand Down Expand Up @@ -394,7 +383,6 @@ def produce_tracers(self, mode='c'):
codegen.parse_semantics(args.semantics_file)
codegen.outfile = open(args.c_output_file, "w")
codegen.write_prolog(mode='c')
codegen.produce_lap_util(mode='c')
codegen.produce_tracers(mode='c')
codegen.outfile.close()

Expand All @@ -406,7 +394,6 @@ def produce_tracers(self, mode='c'):
codegen.outfile = open(args.fortran_output_file, "w")
codegen.write_prolog(mode='fortran')
codegen.produce_fortran_pmpi_prototypes()
codegen.produce_lap_util(mode='fortran')
codegen.produce_tracers(mode='fortran')
codegen.outfile.close()

0 comments on commit 5da8660

Please sign in to comment.