1 /* Copyright (c) 2009-2021. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #include <simgrid/s4u/Actor.hpp>
8 #include "smpi/sampi.h"
10 int main(int argc, char* argv[])
12 MPI_Init(&argc, &argv);
13 // useless alocations for testing and coverage
14 void* pointer = malloc(100 * sizeof(int));
16 if ((ptmp = realloc(pointer, 50 * sizeof(int))) != nullptr)
18 if ((ptmp = realloc(pointer, 200 * sizeof(int))) != nullptr)
21 pointer = calloc(100, sizeof(int));
23 int err = MPI_Comm_rank(MPI_COMM_WORLD, &rank); /* Get id of this process */
24 if (err != MPI_SUCCESS) {
25 fprintf(stderr, "MPI_Comm_rank failed: %d", err);
26 MPI_Abort(MPI_COMM_WORLD, EXIT_FAILURE);
29 AMPI_Iteration_in(MPI_COMM_WORLD);
30 simgrid::s4u::this_actor::sleep_for(rank);
31 AMPI_Iteration_out(MPI_COMM_WORLD);
33 AMPI_Iteration_in(MPI_COMM_WORLD);
34 simgrid::s4u::this_actor::sleep_for(rank);
35 AMPI_Iteration_out(MPI_COMM_WORLD);
40 AMPI_Migrate(MPI_COMM_WORLD);