starpu_mpi_private.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010 Université de Bordeaux 1
  4. * Copyright (C) 2010, 2011 Centre National de la Recherche Scientifique
  5. *
  6. * StarPU is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU Lesser General Public License as published by
  8. * the Free Software Foundation; either version 2.1 of the License, or (at
  9. * your option) any later version.
  10. *
  11. * StarPU is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14. *
  15. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  16. */
  17. #ifndef __STARPU_MPI_PRIVATE_H__
  18. #define __STARPU_MPI_PRIVATE_H__
  19. #include <starpu.h>
  20. #include <common/config.h>
  21. #include "starpu_mpi.h"
  22. #include "starpu_mpi_fxt.h"
  23. #include <common/list.h>
  24. #include <common/utils.h>
  25. #include <pthread.h>
  26. //#define STARPU_MPI_VERBOSE 1
  27. #ifdef STARPU_MPI_VERBOSE
  28. # define _STARPU_MPI_DEBUG(fmt, args ...) { if (!getenv("STARPU_SILENT")) { \
  29. int rank; MPI_Comm_rank(MPI_COMM_WORLD, &rank); \
  30. int yyy; for(yyy=0 ; yyy<=rank ; yyy++) fprintf(stderr, " "); \
  31. fprintf(stderr, "[%d][starpu_mpi][%s] " fmt , rank, __func__ ,##args); \
  32. fflush(stderr); }}
  33. #else
  34. # define _STARPU_MPI_DEBUG(fmt, args ...)
  35. #endif
  36. #ifdef STARPU_MPI_VERBOSE0
  37. # define _STARPU_MPI_LOG_IN() { if (!getenv("STARPU_SILENT")) { \
  38. int rank; MPI_Comm_rank(MPI_COMM_WORLD, &rank); \
  39. int yyy; for(yyy=0 ; yyy<=rank ; yyy++) fprintf(stderr, " "); \
  40. fprintf(stderr, "[%d][starpu_mpi][%s] -->\n", rank, __func__ ); \
  41. fflush(stderr); }}
  42. # define _STARPU_MPI_LOG_OUT() { if (!getenv("STARPU_SILENT")) { \
  43. int rank; MPI_Comm_rank(MPI_COMM_WORLD, &rank); \
  44. int yyy; for(yyy=0 ; yyy<=rank ; yyy++) fprintf(stderr, " "); \
  45. fprintf(stderr, "[%d][starpu_mpi][%s] <--\n", rank, __func__ ); \
  46. fflush(stderr); }}
  47. #else
  48. # define _STARPU_MPI_LOG_IN()
  49. # define _STARPU_MPI_LOG_OUT()
  50. #endif
  51. #define SEND_REQ 0
  52. #define RECV_REQ 1
  53. #define WAIT_REQ 2
  54. #define TEST_REQ 3
  55. #define BARRIER_REQ 4
  56. LIST_TYPE(starpu_mpi_req,
  57. /* description of the data at StarPU level */
  58. starpu_data_handle data_handle;
  59. /* description of the data to be sent/received */
  60. MPI_Datatype datatype;
  61. /* who are we talking to ? */
  62. int srcdst;
  63. int mpi_tag;
  64. MPI_Comm comm;
  65. void (*func)(struct starpu_mpi_req_s *);
  66. MPI_Status *status;
  67. MPI_Request request;
  68. int *flag;
  69. int ret;
  70. pthread_mutex_t req_mutex;
  71. pthread_cond_t req_cond;
  72. unsigned request_type; /* 0 send, 1 recv */
  73. unsigned submitted;
  74. unsigned completed;
  75. /* In the case of a Wait/Test request, we are going to post a request
  76. * to test the completion of another request */
  77. struct starpu_mpi_req_s *other_request;
  78. /* in the case of detached requests */
  79. unsigned detached;
  80. void *callback_arg;
  81. void (*callback)(void *);
  82. );
  83. #endif // __STARPU_MPI_PRIVATE_H__