2 * This program performs some simple tests of the MPI_Bcast broadcast
11 main( int argc, char **argv)
13 int rank, size, ret, passed, i, *test_array;
16 MPI_Init(&argc, &argv);
17 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
18 MPI_Comm_size(MPI_COMM_WORLD, &size);
21 Test_Init("bcast", rank);
22 test_array = (int *)malloc(size*sizeof(int));
24 /* Perform the test - this operation should really be done
25 with an allgather, but it makes a good test... */
27 for (i=0; i < size; i++) {
30 MPI_Bcast(test_array, size, MPI_INT, i, MPI_COMM_WORLD);
31 if (test_array[i] != i)
35 Test_Failed("Simple Broadcast test");
38 Test_Passed("Simple Broadcast test");
41 /* Close down the tests */
44 ret = Summarize_Test_Results();