starpu_mpi_private.h 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010, 2012 Université de Bordeaux 1
  4. * Copyright (C) 2010, 2011, 2012 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 ...) do { if (!getenv("STARPU_SILENT")) { \
  29. int _debug_rank; MPI_Comm_rank(MPI_COMM_WORLD, &_debug_rank); \
  30. fprintf(stderr, "%*s[%d][starpu_mpi][%s] " fmt , (_debug_rank+1)*4, "", _debug_rank, __func__ ,##args); \
  31. fflush(stderr); }} while(0);
  32. #else
  33. # define _STARPU_MPI_DEBUG(fmt, args ...)
  34. #endif
  35. #ifdef STARPU_MPI_VERBOSE0
  36. # define _STARPU_MPI_LOG_IN() do { if (!getenv("STARPU_SILENT")) { \
  37. int _debug_rank; MPI_Comm_rank(MPI_COMM_WORLD, &_debug_rank); \
  38. fprintf(stderr, "%*s[%d][starpu_mpi][%s] -->\n", (_debug_rank+1)*4, "", _debug_rank, __func__ ); \
  39. fflush(stderr); }} while(0)
  40. # define _STARPU_MPI_LOG_OUT() do { if (!getenv("STARPU_SILENT")) { \
  41. int _debug_rank; MPI_Comm_rank(MPI_COMM_WORLD, &_debug_rank); \
  42. fprintf(stderr, "%*s[%d][starpu_mpi][%s] <--\n", (_debug_rank+1)*4, "", _debug_rank, __func__ ); \
  43. fflush(stderr); }} while(0)
  44. #else
  45. # define _STARPU_MPI_LOG_IN()
  46. # define _STARPU_MPI_LOG_OUT()
  47. #endif
  48. #define SEND_REQ 0
  49. #define RECV_REQ 1
  50. #define WAIT_REQ 2
  51. #define TEST_REQ 3
  52. #define BARRIER_REQ 4
  53. LIST_TYPE(_starpu_mpi_req,
  54. /* description of the data at StarPU level */
  55. starpu_data_handle_t data_handle;
  56. /* description of the data to be sent/received */
  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 *);
  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 *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__