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.
10 int main(int argc, char *argv[])
13 int m = 2, n = 0, lda = 1;
15 MPI_Comm comm = MPI_COMM_WORLD;
16 MPI_Datatype type = MPI_DOUBLE, vtype;
18 MPI_Init(&argc, &argv);
19 MPI_Comm_size(comm, &np);
20 MPI_Comm_rank(comm, &iam);
22 printf("Should be at least 2 processes for the test\n");
25 MPI_Type_vector(n, m, lda, type, &vtype);
26 MPI_Type_commit(&vtype);
27 A[0] = -1.0 - 0.1 * iam;
28 A[1] = 0.5 + 0.1 * iam;
29 printf("In process %i of %i before Bcast: A = %f,%f\n", iam, np, A[0], A[1]);
30 MPI_Bcast(A, 1, vtype, 0, comm);
31 printf("In process %i of %i after Bcast: A = %f,%f\n", iam, np, A[0], A[1]);
32 MPI_Type_free(&vtype);