1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
4 * (C) 2003 by Argonne National Laboratory.
5 * See COPYRIGHT in top-level directory.
12 static char MTEST_Descrip[] = "Test of broadcast with various roots and datatypes and sizes that are not powers of two";
15 int main( int argc, char *argv[] )
19 int minsize = 2, count;
21 MTestDatatype sendtype, recvtype;
23 MTest_Init( &argc, &argv );
25 /* The following illustrates the use of the routines to
26 run through a selection of communicators and datatypes.
27 Use subsets of these for tests that do not involve combinations
28 of communicators, datatypes, and counts of datatypes */
29 while (MTestGetIntracommGeneral( &comm, minsize, 1 )) {
30 if (comm == MPI_COMM_NULL) continue;
31 /* Determine the sender and receiver */
32 MPI_Comm_rank( comm, &rank );
33 MPI_Comm_size( comm, &size );
36 /* This must be very large to ensure that we reach the long message
38 for (count = 4; count < 66000; count = count * 4) {
39 while (MTestGetDatatypes( &sendtype, &recvtype, count-1 )) {
40 for (root=0; root<size; root++) {
42 sendtype.InitBuf( &sendtype );
43 err = MPI_Bcast( sendtype.buf, sendtype.count,
44 sendtype.datatype, root, comm );
47 MTestPrintError( err );
51 recvtype.InitBuf( &recvtype );
52 err = MPI_Bcast( recvtype.buf, recvtype.count,
53 recvtype.datatype, root, comm );
56 fprintf( stderr, "Error with communicator %s and datatype %s\n",
57 MTestGetIntracommName(),
58 MTestGetDatatypeName( &recvtype ) );
59 MTestPrintError( err );
61 err = MTestCheckRecv( 0, &recvtype );
67 MTestFreeDatatype( &recvtype );
68 MTestFreeDatatype( &sendtype );
71 MTestFreeComm( &comm );
74 MTest_Finalize( errs );