This section shows some short test programs. These examples assume that a null communicator may be used instead of MPI_COMM_WORLD; note that they do supply an explicit context variable.
This first test shows a simple exchange of messages with a blocking,
contiguous data. No error checking is done.
int main(argc,argv)
int argc;
char **argv;
{
char buf[256];
int ntest, i, len = 256, err, msgrep = 0;
struct MPIR_COMMUNICATOR *comm = 0;
MPI_Status status;
ntest = 10000;
err = MPI_SUCCESS;
MPID_Init( &argc, &argv, (void *)0, &err );
for (i=0; i<ntest; i++) {
if (MPID_MyWorldRank == 0) {
MPID_SendContig( comm, buf, len, 0, 0, 1, msgrep, &err );
MPID_RecvContig( comm, buf, len, 0, 0, 0, &status, &err );
}
else {
MPID_RecvContig( comm, buf, len, 0, 0, 0, &status, &err );
MPID_SendContig( comm, buf, len, 0, 0, 0, msgrep, &err );
}
}
MPID_End();
return 0;
}
This second test uses nonblocking, contiguous operations.
int main(argc,argv)
int argc;
char **argv;
{
char buf[256];
int ntest, i, len = 256, err, msgrep = 0;
struct MPIR_COMMUNICATOR *comm = 0;
MPI_Status status;
MPIR_RHANDLE rhandle;
MPI_Request request = (MPI_Request)&rhandle;
ntest = 10000;
err = MPI_SUCCESS;
MPID_Init( &argc, &argv, (void *)0, &err );
for (i=0; i<ntest; i++) {
if (MPID_MyWorldRank == 0) {
MPID_SendContig( comm, buf, len, 0, 0, 0, 1, msgrep, &err );
MPID_IrecvContig( comm, buf, len, 0, 0, 0, request, &err );
MPID_RecvComplete( request, &status, &err );
}
else {
MPID_RecvContig( comm, buf, len, 0, 0, 0, &status, &err );
MPID_SendContig( comm, buf, len, 0, 0, 0, 0, msgrep, &err );
}
}
MPID_End();
return 0;
}