1 /* Copyright (c) 2009-2010, 2012. 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. */
9 #include "instr/instr.h"
11 #define DATATOSENT 100000000
13 int main(int argc, char *argv[])
16 int rank, numprocs, tag = 0;
17 int *r = malloc(sizeof(int) * DATATOSENT);
19 MPI_Init(&argc, &argv);
20 MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
21 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
25 for (i = 0; i < 10; i++) {
26 TRACE_smpi_set_category("A");
28 MPI_Send(r, DATATOSENT, MPI_INT, 1, tag, MPI_COMM_WORLD);
29 } else if (rank == 1) {
30 MPI_Recv(r, DATATOSENT, MPI_INT, 0, tag, MPI_COMM_WORLD, &status);
35 TRACE_smpi_set_category("B");
37 MPI_Recv(r, DATATOSENT, MPI_INT, 1, tag, MPI_COMM_WORLD, &status);
38 } else if (rank == 1) {
39 MPI_Send(r, DATATOSENT, MPI_INT, 0, tag, MPI_COMM_WORLD);
44 TRACE_smpi_set_category("C");
45 MPI_Barrier(MPI_COMM_WORLD);