1 /* Copyright (c) 2009-2010, 2012-2013. 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. */
14 #define EXIT_SUCCESS 0
15 #define EXIT_FAILURE 1
18 int main(int argc, char *argv[])
26 MPI_Init(&argc, &argv);
27 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
28 MPI_Comm_size(MPI_COMM_WORLD, &size);
30 sb = (int *) malloc(size * sizeof(int));
32 perror("can't allocate send buffer");
34 MPI_Abort(MPI_COMM_WORLD, EXIT_FAILURE);
36 rb = (int *) malloc(size * sizeof(int));
38 perror("can't allocate recv buffer");
41 MPI_Abort(MPI_COMM_WORLD, EXIT_FAILURE);
43 for (i = 0; i < size; ++i) {
48 status = MPI_Alltoall(sb, 1, MPI_INT, rb, 1, MPI_INT, MPI_COMM_WORLD);
50 printf("[%d] rcvbuf=[", rank);
51 for (i = 0; i < size; i++)
57 if (status != MPI_SUCCESS) {
58 printf("all_to_all returned %d\n", status);
65 return (EXIT_SUCCESS);