An Example of a Preprocessor Instrumented MPI Code (Corresponding, Uninstrumented MPI Code)

/*======================================================================*/
/* mpiExample2.c:                                                        */
/* This is an example of an mpi code after Pablo I/O instrumentation    */
/* has been added.                                                       */
/*======================================================================*/
#include <mpi.h>
#include <stdio.h>
#define IOTRACE
#include "IOTrace.h"


main(int argc, char **argv)
{
char traceFileName[20];
char outFile[20];
char path[] = "/tmp/myTrace";
int myNode;
FILE* ptr;

MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &myNode);
/*======================================================================*/
/* Set the trace file name to /tmp/myTrace.n where n is the              */
/* node number.                                                          */
/*======================================================================*/
sprintf(traceFileName, "%s.%d\0", path, myNode);
setTraceFileName( traceFileName );
setTraceProcessorNumber( myNode );
/*======================================================================*/
/* Initialize pablo tracing.                                             */
/*======================================================================*/
initIOTrace();
/*======================================================================*/
/* set output file name for this processor                               */
/*======================================================================*/
sprintf(outFile, "%s.%d\0", "OutFile", myNode);
ptr = fopen(outFile,"w");
fprintf( ptr, "Hi There\n");
fclose(ptr);
/*======================================================================*/
/* End pablo tracing.                                                    */
/*======================================================================*/
endIOTrace();
endTracing();


MPI_Finalize();
}

 

An Uninstrumented Version of the Same Code

 

/*======================================================================*/
/* mpiExample1.c: */
/* This is an example of an mpi code before Pablo I/O instrumentation */
/* has been added. */
/*======================================================================*/
#include <mpi.h>
#include <stdio.h>


main(int argc, char **argv)
{
char outFile[20];
int myNode;
FILE* ptr;

MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &myNode);
/*===================================================================*/
/* set output file name for this processor */
/*===================================================================*/
sprintf(outFile, "%s.%d\0", "OutFile", myNode);
ptr = fopen(outFile,"w");
fprintf( ptr, "Hi There\n");
fclose(ptr);


MPI_Finalize();
}