1 /* Copyright (c) 2009, 2010. 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);
23 TRACE_smpi_set_category("A");
25 MPI_Send(r, DATATOSENT, MPI_INT, 1, tag, MPI_COMM_WORLD);
26 } else if (rank == 1) {
27 MPI_Recv(r, DATATOSENT, MPI_INT, 0, tag, MPI_COMM_WORLD, &status);
31 TRACE_smpi_set_category("B");
33 MPI_Recv(r, DATATOSENT, MPI_INT, 1, tag, MPI_COMM_WORLD, &status);
34 } else if (rank == 1) {
35 MPI_Send(r, DATATOSENT, MPI_INT, 0, tag, MPI_COMM_WORLD);
39 TRACE_smpi_set_category("C");
40 MPI_Barrier(MPI_COMM_WORLD);