📄 mpid_nem_inline.h
字号:
#endif MPIU_DBG_STMT (CH3_CHANNEL, VERBOSE, pbox->cell.pkt.mpich2.type = MPID_NEM_PKT_MPICH2_HEAD); payload_32[0] = buf_32[0]; payload_32[1] = buf_32[1]; payload_32[2] = buf_32[2]; payload_32[3] = buf_32[3]; payload_32[4] = buf_32[4]; payload_32[5] = buf_32[5]; payload_32[6] = buf_32[6]; payload_32[7] = buf_32[7]; if (sizeof(MPIDI_CH3_Pkt_t) == 40) /* This conditional should be optimized out */ { payload_32[8] = buf_32[8]; payload_32[9] = buf_32[9]; } MPID_NEM_MEMCPY ((char *)pbox->cell.pkt.mpich2.payload +sizeof(MPIDI_CH3_Pkt_t), (*iov)[1].iov_base, (*iov)[1].iov_len); MPID_NEM_WRITE_BARRIER(); pbox->flag.value = 1; *n_iov = 0; MPIU_DBG_MSG (CH3_CHANNEL, VERBOSE, "--> Sent fbox "); MPIU_DBG_STMT (CH3_CHANNEL, VERBOSE, MPID_nem_dbg_dump_cell (&pbox->cell)); goto return_success; } } usequeue_l: #endif /*USE_FASTBOX */ #ifdef PREFETCH_CELL el = MPID_nem_prefetched_cell; if (!el) { if (MPID_nem_queue_empty (MPID_nem_mem_region.my_freeQ)) { DO_PAPI (PAPI_accum_var (PAPI_EventSet, PAPI_vvalues5)); goto return_again; } MPID_nem_queue_dequeue (MPID_nem_mem_region.my_freeQ, &el); }#else /*PREFETCH_CELL */ if (MPID_nem_queue_empty (MPID_nem_mem_region.my_freeQ)) { DO_PAPI (PAPI_accum_var (PAPI_EventSet, PAPI_vvalues5)); goto return_again; } MPID_nem_queue_dequeue (MPID_nem_mem_region.my_freeQ, &el);#endif /*PREFETCH_CELL */ ((u_int32_t *)(el->pkt.mpich2.payload))[0] = ((u_int32_t *)(*iov)->iov_base)[0]; ((u_int32_t *)(el->pkt.mpich2.payload))[1] = ((u_int32_t *)(*iov)->iov_base)[1]; ((u_int32_t *)(el->pkt.mpich2.payload))[2] = ((u_int32_t *)(*iov)->iov_base)[2]; ((u_int32_t *)(el->pkt.mpich2.payload))[3] = ((u_int32_t *)(*iov)->iov_base)[3]; ((u_int32_t *)(el->pkt.mpich2.payload))[4] = ((u_int32_t *)(*iov)->iov_base)[4]; ((u_int32_t *)(el->pkt.mpich2.payload))[5] = ((u_int32_t *)(*iov)->iov_base)[5]; ((u_int32_t *)(el->pkt.mpich2.payload))[6] = ((u_int32_t *)(*iov)->iov_base)[6]; ((u_int32_t *)(el->pkt.mpich2.payload))[7] = ((u_int32_t *)(*iov)->iov_base)[7]; if (sizeof(MPIDI_CH3_Pkt_t) == 40) /* This conditional should be optimized out */ { ((u_int32_t *)(el->pkt.mpich2.payload))[8] = ((u_int32_t *)(*iov)->iov_base)[8]; ((u_int32_t *)(el->pkt.mpich2.payload))[9] = ((u_int32_t *)(*iov)->iov_base)[9]; } cell_buf = (char *)(el->pkt.mpich2.payload) + sizeof(MPIDI_CH3_Pkt_t); ++(*iov); --(*n_iov); payload_len = MPID_NEM_MPICH2_DATA_LEN - sizeof(MPIDI_CH3_Pkt_t); while (*n_iov && payload_len >= (*iov)->iov_len) { int _iov_len = (*iov)->iov_len; MPID_NEM_MEMCPY (cell_buf, (*iov)->iov_base, _iov_len); payload_len -= _iov_len; cell_buf += _iov_len; --(*n_iov); ++(*iov); } if (*n_iov && payload_len > 0) { MPID_NEM_MEMCPY (cell_buf, (*iov)->iov_base, payload_len); (*iov)->iov_base = (char *)(*iov)->iov_base + payload_len; (*iov)->iov_len -= payload_len; payload_len = 0; } el->pkt.mpich2.source = my_rank; el->pkt.mpich2.dest = vc->lpid; el->pkt.mpich2.datalen = MPID_NEM_MPICH2_DATA_LEN - payload_len; el->pkt.mpich2.seqno = vc_ch->send_seqno++;#ifdef ENABLED_CHECKPOINTING el->pkt.mpich2.type = MPID_NEM_PKT_MPICH2;#endif MPIU_DBG_STMT (CH3_CHANNEL, VERBOSE, el->pkt.mpich2.type = MPID_NEM_PKT_MPICH2_HEAD); MPIU_DBG_MSG (CH3_CHANNEL, VERBOSE, "--> Sent queue"); MPIU_DBG_STMT (CH3_CHANNEL, VERBOSE, MPID_nem_dbg_dump_cell (el)); if (vc_ch->is_local) { MPID_nem_queue_enqueue (vc_ch->recv_queue, el); /*MPID_nem_rel_dump_queue( vc_ch->recv_queue ); */ } else { mpi_errno = MPID_nem_net_module_send (vc, el, MPID_NEM_MPICH2_DATA_LEN - payload_len); if (mpi_errno) MPIU_ERR_POP (mpi_errno); }#ifdef PREFETCH_CELL if (!MPID_nem_queue_empty (MPID_nem_mem_region.my_freeQ)) MPID_nem_queue_dequeue (MPID_nem_mem_region.my_freeQ, &MPID_nem_prefetched_cell); else MPID_nem_prefetched_cell = 0;#endif /*PREFETCH_CELL */ DO_PAPI (PAPI_accum_var (PAPI_EventSet, PAPI_vvalues5)); return_success: *again = 0; goto fn_exit; return_again: *again = 1; goto fn_exit; fn_exit: MPIDI_FUNC_EXIT(MPID_STATE_MPID_NEM_MPICH2_SENDV_HEADER); return mpi_errno; fn_fail: goto fn_exit;}/* send the header and data described by the segment in one cell. If there is no cell available, *again is set to 1. If all of the data cannot be sent, *segment_first is set to the index of the first unsent byte. Pre condition: This must be the first packet of a message (i.e., *segment first == 0) The destination process is local Post conditions: the header has been sent iff *again == 0 if there is data to send (segment_size > 0) then (the header has been sent iff any data has been sent (i.e., *segment_first > 0) ) i.e.: we will never send only the header*/#undef FUNCNAME#define FUNCNAME MPID_nem_mpich2_send_seg_header#undef FCNAME#define FCNAME MPIDI_QUOTE(FUNCNAME)MPID_NEM_INLINE_DECL voidMPID_nem_mpich2_send_seg_header (MPID_Segment *segment, MPIDI_msg_sz_t *segment_first, MPIDI_msg_sz_t segment_size, void *header, MPIDI_msg_sz_t header_sz, MPIDI_VC_t *vc, int *again){ MPID_nem_cell_ptr_t el; MPIDI_msg_sz_t datalen; int my_rank; MPIDI_msg_sz_t last; MPIDI_CH3I_VC *vc_ch = (MPIDI_CH3I_VC *)vc->channel_private; MPIU_Assert(vc_ch->is_local); /* netmods will have their own implementation */ MPIU_Assert(header_sz <= sizeof(MPIDI_CH3_Pkt_t)); MPIU_Assert(*segment_first == 0); /* this routine is only called for new messages */ #ifdef ENABLED_CHECKPOINTING if (MPID_nem_ckpt_sending_markers) { MPID_nem_ckpt_send_markers(); goto return_again; }#endif DO_PAPI (PAPI_reset (PAPI_EventSet)); my_rank = MPID_nem_mem_region.rank;#ifdef USE_FASTBOX if (sizeof(MPIDI_CH3_Pkt_t) + segment_size <= MPID_NEM_FBOX_DATALEN) { MPID_nem_fbox_mpich2_t *pbox = vc_ch->fbox_out; int count = 10;#ifdef BLOCKING_FBOX DO_PAPI3 (PAPI_reset (PAPI_EventSet)); MPID_nem_waitforlock ((MPID_nem_fbox_common_ptr_t)pbox, 0, count);#else /*BLOCKING_FBOX */ if (MPID_nem_islocked ((MPID_nem_fbox_common_ptr_t)pbox, 0, count)) goto usequeue_l;#endif /*BLOCKING_FBOX */ { pbox->cell.pkt.mpich2.source = MPID_nem_mem_region.local_rank; pbox->cell.pkt.mpich2.datalen = sizeof(MPIDI_CH3_Pkt_t) + segment_size; pbox->cell.pkt.mpich2.seqno = vc_ch->send_seqno++;#ifdef ENABLED_CHECKPOINTING pbox->cell.pkt.mpich2.type = MPID_NEM_PKT_MPICH2;#endif MPIU_DBG_STMT (CH3_CHANNEL, VERBOSE, pbox->cell.pkt.mpich2.type = MPID_NEM_PKT_MPICH2_HEAD); /* copy header */ MPID_NEM_MEMCPY((char *)pbox->cell.pkt.mpich2.payload, header, header_sz); /* copy data */ last = segment_size; MPID_Segment_pack(segment, *segment_first, &last, (char *)pbox->cell.pkt.mpich2.payload + sizeof(MPIDI_CH3_Pkt_t)); MPIU_Assert(last == segment_size); MPID_NEM_WRITE_BARRIER(); pbox->flag.value = 1; *segment_first = last; MPIU_DBG_MSG(CH3_CHANNEL, VERBOSE, "--> Sent fbox "); MPIU_DBG_STMT (CH3_CHANNEL, VERBOSE, MPID_nem_dbg_dump_cell (&pbox->cell)); goto return_success; } } usequeue_l: #endif /*USE_FASTBOX */ #ifdef PREFETCH_CELL el = MPID_nem_prefetched_cell; if (!el) { if (MPID_nem_queue_empty (MPID_nem_mem_region.my_freeQ)) { DO_PAPI (PAPI_accum_var (PAPI_EventSet, PAPI_vvalues5)); goto return_again; } MPID_nem_queue_dequeue (MPID_nem_mem_region.my_freeQ, &el); }#else /*PREFETCH_CELL */ if (MPID_nem_queue_empty (MPID_nem_mem_region.my_freeQ)) { DO_PAPI (PAPI_accum_var (PAPI_EventSet, PAPI_vvalues5)); goto return_again; } MPID_nem_queue_dequeue (MPID_nem_mem_region.my_freeQ, &el);#endif /*PREFETCH_CELL */ /* copy header */ MPID_NEM_MEMCPY(el->pkt.mpich2.payload, header, header_sz); /* copy data */ if (segment_size - *segment_first <= MPID_NEM_MPICH2_DATA_LEN - sizeof(MPIDI_CH3_Pkt_t)) last = segment_size; else last = *segment_first + MPID_NEM_MPICH2_DATA_LEN - sizeof(MPIDI_CH3_Pkt_t); MPID_Segment_pack(segment, *segment_first, &last, (char *)el->pkt.mpich2.payload + sizeof(MPIDI_CH3_Pkt_t)); datalen = sizeof(MPIDI_CH3_Pkt_t) + last - *segment_first; *segment_first = last; el->pkt.mpich2.source = my_rank; el->pkt.mpich2.dest = vc->lpid; el->pkt.mpich2.datalen = datalen; el->pkt.mpich2.seqno = vc_ch->send_seqno++;#ifdef ENABLED_CHECKPOINTING el->pkt.mpich2.type = MPID_NEM_PKT_MPICH2;#endif MPIU_DBG_STMT (CH3_CHANNEL, VERBOSE, el->pkt.mpich2.type = MPID_NEM_PKT_MPICH2_HEAD); MPIU_DBG_MSG (CH3_CHANNEL, VERBOSE, "--> Sent queue"); MPIU_DBG_STMT (CH3_CHANNEL, VERBOSE, MPID_nem_dbg_dump_cell (el)); MPID_nem_queue_enqueue (vc_ch->recv_queue, el); #ifdef PREFETCH_CELL if (!MPID_nem_queue_empty (MPID_nem_mem_region.my_freeQ)) MPID_nem_queue_dequeue (MPID_nem_mem_region.my_freeQ, &MPID_nem_prefetched_cell); else MPID_nem_prefetched_cell = 0;#endif /*PREFETCH_CELL */ DO_PAPI (PAPI_accum_var (PAPI_EventSet, PAPI_vvalues5)); return_success: *again = 0; goto fn_exit; return_again: *again = 1; goto fn_exit; fn_exit: return;}/* similar to MPID_nem_mpich2_send_seg_header, except there is no header to send. This need not be the first packet of a message. */#undef FUNCNAME#define FUNCNAME MPID_nem_mpich2_send_seg#undef FCNAME#define FCNAME MPIDI_QUOTE(FUNCNAME)MPID_NEM_INLINE_DECL voidMPID_nem_mpich2_send_seg (MPID_Segment *segment, MPIDI_msg_sz_t *segment_first, MPIDI_msg_sz_t segment_size, MPIDI_VC_t *vc, int *again){ MPID_nem_cell_ptr_t el; MPIDI_msg_sz_t datalen; int my_rank; MPIDI_msg_sz_t last; MPIDI_CH3I_VC *vc_ch = (MPIDI_CH3I_VC *)vc->channel_private; MPIU_Assert(vc_ch->is_local); /* netmods will have their own implementation */ #ifdef ENABLED_CHECKPOINTING if (MPID_nem_ckpt_sending_markers) { MPID_nem_ckpt_send_markers(); goto return_again; }#endif DO_PAPI (PAPI_reset (PAPI_EventSet)); my_rank = MPID_nem_mem_region.rank; #ifdef PREFETCH_CELL el = MPID_nem_prefetched_cell; if (!el) { if (MPID_nem_queue_empty (MPID_nem_mem_region.my_freeQ)) { DO_PAPI (PAPI_accum_var (PAPI_EventSet, PAPI_vvalues5)); goto return_again; } MPID_nem_queue_dequeue (MPID_nem_mem_region.my_freeQ, &el); }#else /*PREFETCH_CELL */ if (MPID_nem_queue_empty (MPID_nem_mem_region.my_freeQ)) { DO_PAPI (PAPI_accum_var (PAPI_EventSet, PAPI_vvalues5)); goto return_again; } MPID_nem_queue_dequeue (MPID_nem_mem_region.my_freeQ, &el);#endif /*PREFETCH_CELL */ /* copy data */ if (segment_size - *segment_first <= MPID_NEM_MPICH2_DATA_LEN) last = segment_size; else last = *segment_first + MPID_NEM_MPICH2_DATA_LEN; MPID_Segment_pack(segment, *segment_first, &last, (char *)el->pkt.mpich2.payload); datalen = last - *segment_first; *segment_first = last; el->pkt.mpich2.source = my_rank; el->pkt.mpich2.dest = vc->lpid; el->pkt.mpich2.datalen = datalen; el->pkt.mpich2.seqno = vc_ch->send_seqno++;#ifdef ENABLED_CHECKPOINTING el->pkt.mpich2.type = MPID_NEM_PKT_MPICH2;#endif MPIU_DBG_STMT (CH3_CHANNEL, VERBOSE, el->pkt.mpich2.type = MPID_NEM_PKT_MPICH2_HEAD); MPIU_DBG_MSG (CH3_CHANNEL, VERBOSE, "--> Sent queue"); MPIU_DBG_STMT (CH3_CHANNEL, VERBOSE, MPID_nem_dbg_dump_cell (el)); MPID_nem_queue_enqueue (vc_ch->recv_queue, el); #ifdef PREFETCH_CELL if (!MPID_nem_queue_empty (MPID_nem_mem_region.my_freeQ)) MPID_nem_queue_dequeue (MPID_nem_mem_region.my_freeQ, &MPID_nem_prefetched_cell); else MPID_nem_prefetched_cell = 0;#endif /*PREFETCH_CELL */ DO_PAPI (PAPI_accum_var (PAPI_EventSet, PAPI_vvalues5)); *again = 0; goto fn_exit; return_again: *again = 1; goto fn_exit; fn_exit: return;}/* MPID_nem_mpich2_dequeue_fastbox (int local_rank) decrements usage count on fastbox for process with local rank local_rank and dequeues it from fbox queue if usage is 0. This function is called whenever a receive for a process on this node is matched. Fastboxes on fbox queue are polled regularly for incoming messages.*/#undef FUNCNAME#define FUNCNAME MPID_nem_mpich2_dequeue_fastbox#undef FCNAME#define FCNAME MPIDI_QUOTE(FUNCNAME)MPID_NEM_INLINE_DECL int
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -