1 /* Copyright (c) 2012-2014. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
11 int main(int argc, char **argv) {
13 double a[SIZE][SIZE] = {{0}};
15 MPI_Datatype columntype;
17 MPI_Init(&argc,&argv);
18 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
20 MPI_Type_hvector(SIZE, 1, SIZE*sizeof(double), MPI_DOUBLE, &columntype);
21 MPI_Type_commit(&columntype);
29 /* only one column is send this is an exemple for non-contignous data*/
30 MPI_Bcast(a, 1, columntype, 0, MPI_COMM_WORLD);
32 for(i=0; i<SIZE; i++){
33 for (j=0; j < SIZE; j++) {
34 printf("rank= %d, a[%d][%d]=%f\n", rank, i, j, a[i][j]);
39 MPI_Type_free(&columntype);