starpu_mpi.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. #ifndef __STARPU_MPI_H__
  17. #define __STARPU_MPI_H__
  18. #include <starpu.h>
  19. #include <mpi.h>
  20. #include <common/list.h>
  21. #include <pthread.h>
  22. LIST_TYPE(starpu_mpi_req,
  23. /* description of the data at StarPU level */
  24. starpu_data_handle data_handle;
  25. /* description of the data to be sent/received */
  26. void *ptr;
  27. MPI_Datatype datatype;
  28. /* who are we talking to ? */
  29. int srcdst;
  30. int mpi_tag;
  31. MPI_Comm comm;
  32. void (*func)(struct starpu_mpi_req_s *);
  33. MPI_Status *status;
  34. MPI_Request request;
  35. int *flag;
  36. int ret;
  37. pthread_mutex_t req_mutex;
  38. pthread_cond_t req_cond;
  39. unsigned submitted;
  40. unsigned completed;
  41. /* In the case of a Wait/Test request, we are going to post a request
  42. * to test the completion of another request */
  43. struct starpu_mpi_req_s *other_request;
  44. /* in the case of detached requests */
  45. unsigned detached;
  46. void *arg;
  47. void (*callback)(void *);
  48. );
  49. int starpu_mpi_isend(starpu_data_handle data_handle, struct starpu_mpi_req_s *req,
  50. int dest, int mpi_tag, MPI_Comm comm);
  51. int starpu_mpi_irecv(starpu_data_handle data_handle, struct starpu_mpi_req_s *req,
  52. int source, int mpi_tag, MPI_Comm comm);
  53. int starpu_mpi_send(starpu_data_handle data_handle,
  54. int dest, int mpi_tag, MPI_Comm comm);
  55. int starpu_mpi_recv(starpu_data_handle data_handle,
  56. int source, int mpi_tag, MPI_Comm comm, MPI_Status *status);
  57. int starpu_mpi_wait(struct starpu_mpi_req_s *req, MPI_Status *status);
  58. int starpu_mpi_test(struct starpu_mpi_req_s *req, int *flag, MPI_Status *status);
  59. int starpu_mpi_initialize(void);
  60. int starpu_mpi_shutdown(void);
  61. #endif // __STARPU_MPI_H__