16.2.3. Logic of the Design

PreviousUpNext
Up: Profiling Interface Next: MPI Library Implementation Previous: Discussion

Provided that an MPI implementation meets the requirements above, it is possible for the implementor of the profiling system to intercept the MPI calls that are made by the user program. The profiling system implementor can then collect any required information before calling the underlying MPI implementation (through its name shifted entry points) to achieve the desired effects.


Example A wrapper to accumulate the total amount of data sent by the MPI_SEND function, along with the total elapsed time spent in the function.


static int totalBytes = 0; 
static double totalTime = 0.0; 
 
int MPI_Send(const void* buffer, int count, MPI_Datatype datatype, 
             int dest, int tag, MPI_Comm comm) 
{ 
    double tstart = MPI_Wtime();       /* Pass on all arguments */ 
    int size; 
    int result    = PMPI_Send(buffer, count, datatype, dest, tag, comm); 
 
    totalTime    += MPI_Wtime() - tstart;  /* Compute time */ 
 
    MPI_Type_size(datatype, &size);        /* and size */ 
    totalBytes += count*size; 
 
    return result; 
} 


PreviousUpNext
Up: Profiling Interface Next: MPI Library Implementation Previous: Discussion


Return to MPI-5.0 Standard Index
Return to MPI Forum Home Page

(Unofficial) MPI-5.0 of June 9, 2025
HTML Generated on March 2, 2025