starpu_mpi_nmad_backend.c 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2017 Inria
  4. * Copyright (C) 2010-2015,2017,2018,2019 CNRS
  5. * Copyright (C) 2009-2014,2017,2018-2019 Université de Bordeaux
  6. *
  7. * StarPU is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU Lesser General Public License as published by
  9. * the Free Software Foundation; either version 2.1 of the License, or (at
  10. * your option) any later version.
  11. *
  12. * StarPU is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. *
  16. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  17. */
  18. #include <stdlib.h>
  19. #include "starpu_mpi_nmad_backend.h"
  20. #include <starpu_mpi_private.h>
  21. #ifdef STARPU_USE_MPI_NMAD
  22. void _starpu_mpi_nmad_backend_init(struct starpu_conf *conf)
  23. {
  24. (void)conf;
  25. /* strat_prio is preferred for StarPU instead of default strat_aggreg */
  26. setenv("NMAD_STRATEGY", "prio", 0 /* do not overwrite user-supplied value, if set */);
  27. }
  28. void _starpu_mpi_nmad_backend_shutdown(void)
  29. {
  30. }
  31. int _starpu_mpi_nmad_backend_reserve_core(void)
  32. {
  33. return 1;
  34. }
  35. void _starpu_mpi_nmad_backend_request_init(struct _starpu_mpi_req *req)
  36. {
  37. _STARPU_MPI_CALLOC(req->backend, 1, sizeof(struct _starpu_mpi_req_backend));
  38. piom_cond_init(&req->backend->req_cond, 0);
  39. }
  40. void _starpu_mpi_nmad_backend_request_fill(struct _starpu_mpi_req *req, MPI_Comm comm, int is_internal_req)
  41. {
  42. nm_mpi_nmad_dest(&req->backend->session, &req->backend->gate, comm, req->node_tag.node.rank);
  43. }
  44. void _starpu_mpi_nmad_backend_request_destroy(struct _starpu_mpi_req *req)
  45. {
  46. piom_cond_destroy(&(req->backend->req_cond));
  47. free(req->backend);
  48. }
  49. void _starpu_mpi_nmad_backend_data_clear(starpu_data_handle_t data_handle)
  50. {
  51. (void)data_handle;
  52. }
  53. void _starpu_mpi_nmad_backend_data_register(starpu_data_handle_t data_handle, starpu_mpi_tag_t data_tag)
  54. {
  55. (void)data_handle;
  56. (void)data_tag;
  57. }
  58. void _starpu_mpi_nmad_backend_comm_register(MPI_Comm comm)
  59. {
  60. (void)comm;
  61. }
  62. struct _starpu_mpi_backend _mpi_backend =
  63. {
  64. ._starpu_mpi_backend_init = _starpu_mpi_nmad_backend_init,
  65. ._starpu_mpi_backend_shutdown = _starpu_mpi_nmad_backend_shutdown,
  66. ._starpu_mpi_backend_reserve_core = _starpu_mpi_nmad_backend_reserve_core,
  67. ._starpu_mpi_backend_request_init = _starpu_mpi_nmad_backend_request_init,
  68. ._starpu_mpi_backend_request_fill = _starpu_mpi_nmad_backend_request_fill,
  69. ._starpu_mpi_backend_request_destroy = _starpu_mpi_nmad_backend_request_destroy,
  70. ._starpu_mpi_backend_data_clear = _starpu_mpi_nmad_backend_data_clear,
  71. ._starpu_mpi_backend_data_register = _starpu_mpi_nmad_backend_data_register,
  72. ._starpu_mpi_backend_comm_register = _starpu_mpi_nmad_backend_comm_register
  73. };
  74. #endif /* STARPU_USE_MPI_NMAD*/