8.4 例子 |
假设剖析器希望累加由MPI-SEND函数发送的全部数据量以及函数中所花费的全部时间。这可以繁琐的获取
static int totalBytes;
static double totalTime;
int MPI_SEND(void * buffer, const int count, MPI_Datatype datatype,
int dest, int tag, MPI_Comm comm)
{
double tstart = MPI_Wtime(); /* Pass on all the arguments */
int extent;
int result = PMPI_Send(buffer, count, datatype, dest, tag, comm);
totalBytes += count * MPI_Type_size(datatype, &extent); /* Accumulate byte count */
totalTime += MPI_Wtime() - tstart; /* and time */
return result;
}
Copyright: NPACT |