nothing.c 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2020 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
  4. *
  5. * StarPU is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU Lesser General Public License as published by
  7. * the Free Software Foundation; either version 2.1 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * StarPU is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. *
  14. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  15. */
  16. /*
  17. * This program does nothing. It waits until it is interrupted by the user.
  18. * Useful to check binding while StarPU is running.
  19. */
  20. #include <starpu_mpi.h>
  21. #include "helper.h"
  22. int main(int argc, char **argv)
  23. {
  24. int ret, rank, worldsize;
  25. int mpi_init;
  26. MPI_INIT_THREAD(&argc, &argv, MPI_THREAD_SERIALIZED, &mpi_init);
  27. ret = starpu_mpi_init_conf(&argc, &argv, mpi_init, MPI_COMM_WORLD, NULL);
  28. STARPU_CHECK_RETURN_VALUE(ret, "starpu_mpi_init_conf");
  29. starpu_pause(); // our program will only wait, no need to stress cores by polling workers
  30. starpu_mpi_comm_rank(MPI_COMM_WORLD, &rank);
  31. starpu_mpi_comm_size(MPI_COMM_WORLD, &worldsize);
  32. starpu_mpi_barrier(MPI_COMM_WORLD);
  33. char hostname[65];
  34. gethostname(hostname, sizeof(hostname));
  35. printf("[rank %d on %s] ready to wait !\n", rank, hostname);
  36. if (rank == 0)
  37. {
  38. printf("You can now check if thread binding is correct, for instance.\n");
  39. }
  40. fflush(stdout);
  41. while(1)
  42. {
  43. sleep(1);
  44. }
  45. // TODO: maybe better handle the user interruption ?
  46. starpu_resume();
  47. starpu_mpi_shutdown();
  48. if (!mpi_init)
  49. MPI_Finalize();
  50. return 0;
  51. }