Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 12.56 KB | None | 0 0
  1. Index: src/mpid/ch3/include/mpidimpl.h
  2. ===================================================================
  3. --- src/mpid/ch3/include/mpidimpl.h (revision 7382)
  4. +++ src/mpid/ch3/include/mpidimpl.h (working copy)
  5. @@ -684,6 +684,9 @@ typedef struct MPIDI_Comm_ops
  6.           int *flag, MPI_Status *status);
  7.    
  8.  } MPIDI_Comm_ops_t;
  9. +
  10. +extern int (*MPIDI_Anysource_iprobe_fn)(int tag, MPID_Comm * comm, int context_offset, int *flag,
  11. +                                        MPI_Status * status);
  12.  #endif
  13.  
  14.  typedef struct MPIDI_VC
  15. Index: src/mpid/ch3/src/mpid_probe.c
  16. ===================================================================
  17. --- src/mpid/ch3/src/mpid_probe.c   (revision 7382)
  18. +++ src/mpid/ch3/src/mpid_probe.c   (working copy)
  19. @@ -26,6 +26,38 @@ int MPID_Probe(int source, int tag, MPID_Comm * co
  20.     goto fn_exit;
  21.      }
  22.  
  23. +#ifdef ENABLE_COMM_OVERRIDES
  24. +    if (MPIDI_Anysource_iprobe_fn) {
  25. +        if (source == MPI_ANY_SOURCE) {
  26. +            /* if it's anysource, loop while checking the shm recv
  27. +               queue and iprobing the netmod, then do a progress
  28. +               test to make some progress. */
  29. +            do {
  30. +                int found;
  31. +                
  32. +                MPIU_THREAD_CS_ENTER(MSGQUEUE,);
  33. +                found = MPIDI_CH3U_Recvq_FU(source, tag, context, status);
  34. +                MPIU_THREAD_CS_EXIT(MSGQUEUE,);
  35. +                if (found) break;
  36. +
  37. +                mpi_errno = MPIDI_Anysource_iprobe_fn(tag, comm, context_offset, &found, status);
  38. +                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
  39. +                if (found) break;
  40. +                
  41. +                mpi_errno = MPIDI_CH3_Progress_test();
  42. +                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
  43. +            } while (1);
  44. +        } else {
  45. +            /* it's not anysource, so just probe on the netmod*/
  46. +            MPIDI_VC_t * vc;
  47. +            MPIDI_Comm_get_vc_set_active(comm, source, &vc);
  48. +            MPIU_Assert(vc->comm_ops && vc->comm_ops->probe);
  49. +            mpi_errno = vc->comm_ops->probe(vc, source, tag, comm, context_offset, status);
  50. +            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
  51. +        }
  52. +        goto fn_exit;
  53. +    }
  54. +#endif
  55.      MPIDI_CH3_Progress_start(&progress_state);
  56.      do
  57.      {
  58. @@ -44,4 +76,6 @@ int MPID_Probe(int source, int tag, MPID_Comm * co
  59.   fn_exit:
  60.      MPIDI_FUNC_EXIT(MPID_STATE_MPID_PROBE);
  61.      return mpi_errno;
  62. + fn_fail:
  63. +    goto fn_exit;
  64.  }
  65. Index: src/mpid/ch3/src/mpid_iprobe.c
  66. ===================================================================
  67. --- src/mpid/ch3/src/mpid_iprobe.c  (revision 7382)
  68. +++ src/mpid/ch3/src/mpid_iprobe.c  (working copy)
  69. @@ -6,6 +6,9 @@
  70.  
  71.  #include "mpidimpl.h"
  72.  
  73. +int (*MPIDI_Anysource_iprobe_fn)(int tag, MPID_Comm * comm, int context_offset, int *flag,
  74. +                                 MPI_Status * status) = NULL;
  75. +
  76.  #undef FUNCNAME
  77.  #define FUNCNAME MPID_Iprobe
  78.  #undef FCNAME
  79. @@ -29,6 +32,48 @@ int MPID_Iprobe(int source, int tag, MPID_Comm *co
  80.     goto fn_exit;
  81.      }
  82.  
  83. +#ifdef ENABLE_COMM_OVERRIDES
  84. +    if (MPIDI_Anysource_iprobe_fn) {
  85. +        if (source == MPI_ANY_SOURCE) {
  86. +            /* if it's anysource, check shm, then check the network.
  87. +               If still not found, call progress, and check again. */
  88. +
  89. +            /* check shm*/
  90. +            MPIU_THREAD_CS_ENTER(MSGQUEUE,);
  91. +            found = MPIDI_CH3U_Recvq_FU(source, tag, context, status);
  92. +            MPIU_THREAD_CS_EXIT(MSGQUEUE,);
  93. +            if (!found) {
  94. +                /* not found, check network */
  95. +                mpi_errno = MPIDI_Anysource_iprobe_fn(tag, comm, context_offset, &found, status);
  96. +                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
  97. +                if (!found) {
  98. +                    /* still not found, make some progress*/
  99. +                    mpi_errno = MPIDI_CH3_Progress_poke();
  100. +                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
  101. +                    /* check shm again */
  102. +                    MPIU_THREAD_CS_ENTER(MSGQUEUE,);
  103. +                    found = MPIDI_CH3U_Recvq_FU(source, tag, context, status);
  104. +                    MPIU_THREAD_CS_EXIT(MSGQUEUE,);
  105. +                    if (!found) {
  106. +                        /* check network again */
  107. +                        mpi_errno = MPIDI_Anysource_iprobe_fn(tag, comm, context_offset, &found, status);
  108. +                        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
  109. +                    }
  110. +                }
  111. +            }
  112. +        } else {
  113. +            /* it's not anysource, so just iprobe on the netmod*/
  114. +            MPIDI_VC_t * vc;
  115. +            MPIDI_Comm_get_vc_set_active(comm, source, &vc);
  116. +            MPIU_Assert(vc->comm_ops && vc->comm_ops->probe);
  117. +            mpi_errno = vc->comm_ops->iprobe(vc, source, tag, comm, context_offset, &found, status);
  118. +            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
  119. +        }
  120. +        *flag = found;
  121. +        goto fn_exit;
  122. +    }
  123. +#endif
  124. +    
  125.      /* FIXME: The routine CH3U_Recvq_FU is used only by the probe functions;
  126.         it should atomically return the flag and status rather than create
  127.         a request.  Note that in some cases it will be possible to
  128. @@ -55,4 +100,6 @@ int MPID_Iprobe(int source, int tag, MPID_Comm *co
  129.   fn_exit:    
  130.      MPIDI_FUNC_EXIT(MPID_STATE_MPID_IPROBE);
  131.      return mpi_errno;
  132. + fn_fail:
  133. +    goto fn_exit;
  134.  }
  135. Index: src/mpid/ch3/channels/nemesis/nemesis/include/mpid_nem_nets.h
  136. ===================================================================
  137. --- src/mpid/ch3/channels/nemesis/nemesis/include/mpid_nem_nets.h   (revision 7382)
  138. +++ src/mpid/ch3/channels/nemesis/nemesis/include/mpid_nem_nets.h   (working copy)
  139. @@ -21,6 +21,8 @@ typedef int (* MPID_nem_net_module_connect_to_root
  140.  typedef int (* MPID_nem_net_module_vc_init_t)(MPIDI_VC_t *vc);
  141.  typedef int (* MPID_nem_net_module_vc_destroy_t)(MPIDI_VC_t *vc);
  142.  typedef int (* MPID_nem_net_module_vc_terminate_t)(MPIDI_VC_t *vc);
  143. +typedef int (* MPID_nem_net_module_anysource_iprobe_t)(int tag, MPID_Comm *comm, int context_offset, int *flag,
  144. +                                                       MPI_Status *status);
  145.  
  146.  typedef void (* MPID_nem_net_module_vc_dbg_print_sendq_t)(FILE *stream, MPIDI_VC_t *vc);
  147.  
  148. @@ -39,6 +41,7 @@ typedef struct MPID_nem_netmod_funcs
  149.      MPID_nem_net_module_vc_init_t vc_init;
  150.      MPID_nem_net_module_vc_destroy_t vc_destroy;
  151.      MPID_nem_net_module_vc_terminate_t vc_terminate;
  152. +    MPID_nem_net_module_anysource_iprobe_t anysource_iprobe;
  153.  } MPID_nem_netmod_funcs_t;
  154.  
  155.  extern MPID_nem_net_module_vc_dbg_print_sendq_t  MPID_nem_net_module_vc_dbg_print_sendq;
  156. Index: src/mpid/ch3/channels/nemesis/nemesis/netmod/elan/elan_init.c
  157. ===================================================================
  158. --- src/mpid/ch3/channels/nemesis/nemesis/netmod/elan/elan_init.c   (revision 7382)
  159. +++ src/mpid/ch3/channels/nemesis/nemesis/netmod/elan/elan_init.c   (working copy)
  160. @@ -21,7 +21,8 @@ MPID_nem_netmod_funcs_t MPIDI_nem_elan_funcs = {
  161.      MPID_nem_elan_connect_to_root,
  162.      MPID_nem_elan_vc_init,
  163.      MPID_nem_elan_vc_destroy,
  164. -    MPID_nem_elan_vc_terminate
  165. +    MPID_nem_elan_vc_terminate,
  166. +    NULL /* anysource iprobe */
  167.  };
  168.  
  169.  
  170. Index: src/mpid/ch3/channels/nemesis/nemesis/netmod/none/none.c
  171. ===================================================================
  172. --- src/mpid/ch3/channels/nemesis/nemesis/netmod/none/none.c    (revision 7382)
  173. +++ src/mpid/ch3/channels/nemesis/nemesis/netmod/none/none.c    (working copy)
  174. @@ -63,5 +63,6 @@ MPID_nem_netmod_funcs_t MPIDI_nem_none_funcs = {
  175.      nm_connect_to_root,
  176.      nm_vc_init,
  177.      nm_vc_destroy,
  178. -    nm_vc_terminate
  179. +    nm_vc_terminate,
  180. +    NULL /* anysource iprobe */
  181.  };
  182. Index: src/mpid/ch3/channels/nemesis/nemesis/netmod/psm/psm_init.c
  183. ===================================================================
  184. --- src/mpid/ch3/channels/nemesis/nemesis/netmod/psm/psm_init.c (revision 7382)
  185. +++ src/mpid/ch3/channels/nemesis/nemesis/netmod/psm/psm_init.c (working copy)
  186. @@ -18,7 +18,8 @@ MPID_nem_netmod_funcs_t MPIDI_nem_psm_funcs = {
  187.      MPID_nem_psm_connect_to_root,
  188.      MPID_nem_psm_vc_init,
  189.      MPID_nem_psm_vc_destroy,
  190. -    MPID_nem_psm_vc_terminate
  191. +    MPID_nem_psm_vc_terminate,
  192. +    NULL /* anysource iprobe */
  193.  };
  194.  
  195.  #define MPIDI_CH3I_ENDPOINT_KEY "endpoint_id"
  196. Index: src/mpid/ch3/channels/nemesis/nemesis/netmod/gm/gm_init.c
  197. ===================================================================
  198. --- src/mpid/ch3/channels/nemesis/nemesis/netmod/gm/gm_init.c   (revision 7382)
  199. +++ src/mpid/ch3/channels/nemesis/nemesis/netmod/gm/gm_init.c   (working copy)
  200. @@ -15,7 +15,8 @@ MPID_nem_netmod_funcs_t MPIDI_nem_gm_funcs = {
  201.      MPID_nem_gm_connect_to_root,
  202.      MPID_nem_gm_vc_init,
  203.      MPID_nem_gm_vc_destroy,
  204. -    MPID_nem_gm_vc_terminate
  205. +    MPID_nem_gm_vc_terminate,
  206. +    NULL /* anysource iprobe */
  207.  };
  208.  
  209.  
  210. Index: src/mpid/ch3/channels/nemesis/nemesis/netmod/mx/mx_init.c
  211. ===================================================================
  212. --- src/mpid/ch3/channels/nemesis/nemesis/netmod/mx/mx_init.c   (revision 7382)
  213. +++ src/mpid/ch3/channels/nemesis/nemesis/netmod/mx/mx_init.c   (working copy)
  214. @@ -15,7 +15,8 @@ MPID_nem_netmod_funcs_t MPIDI_nem_mx_funcs = {
  215.      MPID_nem_mx_connect_to_root,
  216.      MPID_nem_mx_vc_init,
  217.      MPID_nem_mx_vc_destroy,
  218. -    MPID_nem_mx_vc_terminate
  219. +    MPID_nem_mx_vc_terminate,
  220. +    MPID_nem_mx_anysource_iprobe
  221.  };
  222.  
  223.  static MPIDI_Comm_ops_t comm_ops = {
  224. Index: src/mpid/ch3/channels/nemesis/nemesis/netmod/mx/mx_impl.h
  225. ===================================================================
  226. --- src/mpid/ch3/channels/nemesis/nemesis/netmod/mx/mx_impl.h   (revision 7382)
  227. +++ src/mpid/ch3/channels/nemesis/nemesis/netmod/mx/mx_impl.h   (working copy)
  228. @@ -42,6 +42,8 @@ int MPID_nem_mx_cancel_recv(MPIDI_VC_t *vc, MPID_R
  229.  int MPID_nem_mx_probe(MPIDI_VC_t *vc,  int source, int tag, MPID_Comm *comm, int context_offset, MPI_Status *status);
  230.  int MPID_nem_mx_iprobe(MPIDI_VC_t *vc,  int source, int tag, MPID_Comm *comm, int context_offset, int *flag, MPI_Status *status);
  231.  
  232. +int MPID_nem_mx_anysource_iprobe(int tag, MPID_Comm *comm, int context_offset, int *flag, MPI_Status *status);
  233. +
  234.  /* Callback routine for unex msgs in MX */
  235.  mx_unexp_handler_action_t MPID_nem_mx_get_adi_msg(void *context,mx_endpoint_addr_t source,
  236.                           uint64_t match_info,uint32_t length,void *data);
  237. Index: src/mpid/ch3/channels/nemesis/nemesis/netmod/mx/mx_probe.c
  238. ===================================================================
  239. --- src/mpid/ch3/channels/nemesis/nemesis/netmod/mx/mx_probe.c  (revision 7382)
  240. +++ src/mpid/ch3/channels/nemesis/nemesis/netmod/mx/mx_probe.c  (working copy)
  241. @@ -114,3 +114,11 @@ int MPID_nem_mx_iprobe(MPIDI_VC_t *vc,  int source
  242.  
  243.  
  244.  
  245. +#undef FUNCNAME
  246. +#define FUNCNAME MPID_nem_mx_anysource_iprobe
  247. +#undef FCNAME
  248. +#define FCNAME MPIU_QUOTE(FUNCNAME)
  249. +int MPID_nem_mx_anysource_iprobe(int tag, MPID_Comm *comm, int context_offset, int *flag, MPI_Status *status)
  250. +{
  251. +    return MPID_nem_mx_iprobe(NULL, MPI_ANY_SOURCE, tag, comm, context_offset, flag, status);
  252. +}
  253. Index: src/mpid/ch3/channels/nemesis/nemesis/netmod/tcp/tcp_init.c
  254. ===================================================================
  255. --- src/mpid/ch3/channels/nemesis/nemesis/netmod/tcp/tcp_init.c (revision 7382)
  256. +++ src/mpid/ch3/channels/nemesis/nemesis/netmod/tcp/tcp_init.c (working copy)
  257. @@ -31,7 +31,8 @@ MPID_nem_netmod_funcs_t MPIDI_nem_tcp_funcs = {
  258.      MPID_nem_tcp_connect_to_root,
  259.      MPID_nem_tcp_vc_init,
  260.      MPID_nem_tcp_vc_destroy,
  261. -    MPID_nem_tcp_vc_terminate
  262. +    MPID_nem_tcp_vc_terminate,
  263. +    NULL /* anysource iprobe */
  264.  };
  265.  
  266.  /* in case there are no packet types defined (e.g., they're ifdef'ed out) make sure the array is not zero length */
  267. Index: src/mpid/ch3/channels/nemesis/nemesis/netmod/newmad/newmad_init.c
  268. ===================================================================
  269. --- src/mpid/ch3/channels/nemesis/nemesis/netmod/newmad/newmad_init.c   (revision 7382)
  270. +++ src/mpid/ch3/channels/nemesis/nemesis/netmod/newmad/newmad_init.c   (working copy)
  271. @@ -17,7 +17,8 @@ MPID_nem_netmod_funcs_t MPIDI_nem_newmad_funcs = {
  272.      MPID_nem_newmad_connect_to_root,
  273.      MPID_nem_newmad_vc_init,
  274.      MPID_nem_newmad_vc_destroy,
  275. -    MPID_nem_newmad_vc_terminate
  276. +    MPID_nem_newmad_vc_terminate,
  277. +    MPID_nem_newmad_anysource_iprobe
  278.  };
  279.  
  280.  static MPIDI_Comm_ops_t comm_ops = {
  281. Index: src/mpid/ch3/channels/nemesis/nemesis/src/mpid_nem_network.c
  282. ===================================================================
  283. --- src/mpid/ch3/channels/nemesis/nemesis/src/mpid_nem_network.c    (revision 7382)
  284. +++ src/mpid/ch3/channels/nemesis/nemesis/src/mpid_nem_network.c    (working copy)
  285. @@ -41,6 +41,9 @@ int MPID_nem_choose_netmod(void)
  286.          {
  287.              MPID_nem_netmod_func = MPID_nem_netmod_funcs[i];
  288.              MPID_nem_netmod_id = i;
  289. +#ifdef ENABLE_COMM_OVERRIDES
  290. +            MPIDI_Anysource_iprobe_fn = MPID_nem_netmod_func->anysource_iprobe;
  291. +#endif
  292.              goto fn_exit;
  293.          }
  294.      }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement