starpu_mpi_helper.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * StarPU
  3. * Copyright (C) INRIA 2008-2009 (see AUTHORS file)
  4. *
  5. * This program 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. * This program 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. #include <starpu_mpi.h>
  17. static void starpu_mpi_unlock_tag_callback(void *arg)
  18. {
  19. starpu_tag_t *tagptr = arg;
  20. starpu_tag_notify_from_apps(*tagptr);
  21. free(tagptr);
  22. }
  23. int starpu_mpi_isend_detached_unlock_tag(starpu_data_handle data_handle, struct starpu_mpi_req_s *req,
  24. int dest, int mpi_tag, MPI_Comm comm, starpu_tag_t tag)
  25. {
  26. starpu_tag_t *tagptr = malloc(sizeof(starpu_tag_t));
  27. *tagptr = tag;
  28. return starpu_mpi_isend_detached(data_handle, req, dest, mpi_tag, comm,
  29. starpu_mpi_unlock_tag_callback, tagptr);
  30. }
  31. int starpu_mpi_irecv_detached_unlock_tag(starpu_data_handle data_handle, struct starpu_mpi_req_s *req, int source, int mpi_tag, MPI_Comm comm, starpu_tag_t tag)
  32. {
  33. starpu_tag_t *tagptr = malloc(sizeof(starpu_tag_t));
  34. *tagptr = tag;
  35. return starpu_mpi_irecv_detached(data_handle, req, source, mpi_tag, comm,
  36. starpu_mpi_unlock_tag_callback, tagptr);
  37. }