starpu_mpi_nmad_backend.c 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2017,2020 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. /* prefer rcache on ibverbs */
  28. setenv("NMAD_IBVERBS_RCACHE", "1", 0);
  29. /* use pioman dedicated thread */
  30. setenv("PIOM_DEDICATED", "1", 0);
  31. /* pioman waits for starpu to place its dedicated thread */
  32. setenv("PIOM_DEDICATED_WAIT", "1", 0);
  33. }
  34. void _starpu_mpi_nmad_backend_shutdown(void)
  35. {
  36. }
  37. int _starpu_mpi_nmad_backend_reserve_core(void)
  38. {
  39. return 1;
  40. }
  41. void _starpu_mpi_nmad_backend_request_init(struct _starpu_mpi_req *req)
  42. {
  43. _STARPU_MPI_CALLOC(req->backend, 1, sizeof(struct _starpu_mpi_req_backend));
  44. piom_cond_init(&req->backend->req_cond, 0);
  45. }
  46. void _starpu_mpi_nmad_backend_request_fill(struct _starpu_mpi_req *req, MPI_Comm comm, int is_internal_req)
  47. {
  48. /* this function gives session and gate: */
  49. nm_mpi_nmad_dest(&req->backend->session, &req->backend->gate, comm, req->node_tag.node.rank);
  50. }
  51. void _starpu_mpi_nmad_backend_request_destroy(struct _starpu_mpi_req *req)
  52. {
  53. piom_cond_destroy(&(req->backend->req_cond));
  54. free(req->backend);
  55. }
  56. void _starpu_mpi_nmad_backend_data_clear(starpu_data_handle_t data_handle)
  57. {
  58. (void)data_handle;
  59. }
  60. void _starpu_mpi_nmad_backend_data_register(starpu_data_handle_t data_handle, starpu_mpi_tag_t data_tag)
  61. {
  62. (void)data_handle;
  63. (void)data_tag;
  64. }
  65. void _starpu_mpi_nmad_backend_comm_register(MPI_Comm comm)
  66. {
  67. (void)comm;
  68. }
  69. struct _starpu_mpi_backend _mpi_backend =
  70. {
  71. ._starpu_mpi_backend_init = _starpu_mpi_nmad_backend_init,
  72. ._starpu_mpi_backend_shutdown = _starpu_mpi_nmad_backend_shutdown,
  73. ._starpu_mpi_backend_reserve_core = _starpu_mpi_nmad_backend_reserve_core,
  74. ._starpu_mpi_backend_request_init = _starpu_mpi_nmad_backend_request_init,
  75. ._starpu_mpi_backend_request_fill = _starpu_mpi_nmad_backend_request_fill,
  76. ._starpu_mpi_backend_request_destroy = _starpu_mpi_nmad_backend_request_destroy,
  77. ._starpu_mpi_backend_data_clear = _starpu_mpi_nmad_backend_data_clear,
  78. ._starpu_mpi_backend_data_register = _starpu_mpi_nmad_backend_data_register,
  79. ._starpu_mpi_backend_comm_register = _starpu_mpi_nmad_backend_comm_register
  80. };
  81. #endif /* STARPU_USE_MPI_NMAD*/