starpu_mpi_private.h 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*
  2. * StarPU
  3. * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (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_PRIVATE_H__
  17. #define __STARPU_MPI_PRIVATE_H__
  18. #include <starpu.h>
  19. #include <common/config.h>
  20. #include "starpu_mpi.h"
  21. #include "starpu_mpi_fxt.h"
  22. #include <common/list.h>
  23. #include <common/utils.h>
  24. #include <pthread.h>
  25. //#define STARPU_MPI_VERBOSE 1
  26. #ifdef STARPU_MPI_VERBOSE
  27. # define _STARPU_MPI_DEBUG(fmt, args ...) { int rank; MPI_Comm_rank(MPI_COMM_WORLD, &rank); \
  28. int yyy; for(yyy=0 ; yyy<=rank ; yyy++) fprintf(stderr, " "); \
  29. fprintf(stderr, "[%d][starpu_mpi][%s] " fmt , rank, __func__ ,##args); \
  30. fflush(stderr); }
  31. #else
  32. # define _STARPU_MPI_DEBUG(fmt, args ...)
  33. #endif
  34. #ifdef STARPU_MPI_VERBOSE0
  35. # define _STARPU_MPI_LOG_IN() { int rank; MPI_Comm_rank(MPI_COMM_WORLD, &rank); \
  36. int yyy; for(yyy=0 ; yyy<=rank ; yyy++) fprintf(stderr, " "); \
  37. fprintf(stderr, "[%d][starpu_mpi][%s] -->\n", rank, __func__ ); \
  38. fflush(stderr); }
  39. # define _STARPU_MPI_LOG_OUT() { int rank; MPI_Comm_rank(MPI_COMM_WORLD, &rank); \
  40. int yyy; for(yyy=0 ; yyy<=rank ; yyy++) fprintf(stderr, " "); \
  41. fprintf(stderr, "[%d][starpu_mpi][%s] <--\n", rank, __func__ ); \
  42. fflush(stderr); }
  43. #else
  44. # define _STARPU_MPI_LOG_IN()
  45. # define _STARPU_MPI_LOG_OUT()
  46. #endif
  47. #define SEND_REQ 0
  48. #define RECV_REQ 1
  49. #define WAIT_REQ 2
  50. #define TEST_REQ 3
  51. #define BARRIER_REQ 4
  52. LIST_TYPE(starpu_mpi_req,
  53. /* description of the data at StarPU level */
  54. starpu_data_handle data_handle;
  55. /* description of the data to be sent/received */
  56. void *ptr;
  57. MPI_Datatype datatype;
  58. /* who are we talking to ? */
  59. int srcdst;
  60. int mpi_tag;
  61. MPI_Comm comm;
  62. void (*func)(struct starpu_mpi_req_s *);
  63. MPI_Status *status;
  64. MPI_Request request;
  65. int *flag;
  66. int ret;
  67. pthread_mutex_t req_mutex;
  68. pthread_cond_t req_cond;
  69. unsigned request_type; /* 0 send, 1 recv */
  70. unsigned submitted;
  71. unsigned completed;
  72. /* In the case of a Wait/Test request, we are going to post a request
  73. * to test the completion of another request */
  74. struct starpu_mpi_req_s *other_request;
  75. /* in the case of detached requests */
  76. unsigned detached;
  77. void *callback_arg;
  78. void (*callback)(void *);
  79. );
  80. #endif // __STARPU_MPI_PRIVATE_H__