📄 mpidimpl.h
字号:
(((req_)->dev.state & MPIDI_REQUEST_SRBUF_MASK) >> MPIDI_REQUEST_SRBUF_SHIFT)#define MPIDI_Request_set_srbuf_flag(req_, flag_) \{ \ (req_)->dev.state &= ~MPIDI_REQUEST_SRBUF_MASK; \ (req_)->dev.state |= ((flag_) << MPIDI_REQUEST_SRBUF_SHIFT) & MPIDI_REQUEST_SRBUF_MASK; \}#define MPIDI_REQUEST_SYNC_SEND_MASK (0x1 << MPIDI_REQUEST_SYNC_SEND_SHIFT)#define MPIDI_REQUEST_SYNC_SEND_SHIFT 3#define MPIDI_Request_get_sync_send_flag(req_) \(((req_)->dev.state & MPIDI_REQUEST_SYNC_SEND_MASK) >> MPIDI_REQUEST_SYNC_SEND_SHIFT)#define MPIDI_Request_set_sync_send_flag(req_, flag_) \{ \ (req_)->dev.state &= ~MPIDI_REQUEST_SYNC_SEND_MASK; \ (req_)->dev.state |= ((flag_) << MPIDI_REQUEST_SYNC_SEND_SHIFT) & MPIDI_REQUEST_SYNC_SEND_MASK;\}#define MPIDI_REQUEST_TYPE_MASK (0xF << MPIDI_REQUEST_TYPE_SHIFT)#define MPIDI_REQUEST_TYPE_SHIFT 4#define MPIDI_REQUEST_TYPE_RECV 0#define MPIDI_REQUEST_TYPE_SEND 1#define MPIDI_REQUEST_TYPE_RSEND 2#define MPIDI_REQUEST_TYPE_SSEND 3/* We need a BSEND type for persistent bsends (see mpid_startall.c) */#define MPIDI_REQUEST_TYPE_BSEND 4#define MPIDI_REQUEST_TYPE_PUT_RESP 5#define MPIDI_REQUEST_TYPE_GET_RESP 6#define MPIDI_REQUEST_TYPE_ACCUM_RESP 7#define MPIDI_REQUEST_TYPE_PUT_RESP_DERIVED_DT 8#define MPIDI_REQUEST_TYPE_GET_RESP_DERIVED_DT 9#define MPIDI_REQUEST_TYPE_ACCUM_RESP_DERIVED_DT 10#define MPIDI_REQUEST_TYPE_PT_SINGLE_PUT 11#define MPIDI_REQUEST_TYPE_PT_SINGLE_ACCUM 12#define MPIDI_Request_get_type(req_) \(((req_)->dev.state & MPIDI_REQUEST_TYPE_MASK) >> MPIDI_REQUEST_TYPE_SHIFT)#define MPIDI_Request_set_type(req_, type_) \{ \ (req_)->dev.state &= ~MPIDI_REQUEST_TYPE_MASK; \ (req_)->dev.state |= ((type_) << MPIDI_REQUEST_TYPE_SHIFT) & MPIDI_REQUEST_TYPE_MASK;\}/* NOTE: Request updates may require atomic ops (critical sections) if a fine-grain thread-sync model is used. */#define MPIDI_Request_cancel_pending(req_, flag_) \{ \ *(flag_) = (req_)->dev.cancel_pending; \ (req_)->dev.cancel_pending = TRUE; \}/* FIXME: Why does this have a side effect? */#define MPIDI_Request_recv_pending(req_, recv_pending_) \ { \ *(recv_pending_) = --(req_)->dev.recv_pending_count; \ }/* MPIDI_Request_fetch_and_clear_rts_sreq() - atomically fetch current partner RTS sreq and nullify partner request */#define MPIDI_Request_fetch_and_clear_rts_sreq(sreq_, rts_sreq_) \ { \ *(rts_sreq_) = (sreq_)->partner_request; \ (sreq_)->partner_request = NULL; \ }/* Note: In the current implementation, the mpid_xsend.c routines that make use of MPIDI_VC_FAI_send_seqnum are all protected by the SINGLE_CS_ENTER/EXIT macros, so all uses of this macro are alreay within a critical section when needed. If/when we move to a finer-grain model, we'll need to examine whether this requires a separate lock. */#if defined(MPID_USE_SEQUENCE_NUMBERS)# define MPIDI_Request_set_seqnum(req_, seqnum_) \ { \ (req_)->dev.seqnum = (seqnum_); \ }# define MPIDI_VC_FAI_send_seqnum(vc_, seqnum_out_) \ { \ (seqnum_out_) = (vc_)->seqnum_send++; \ }# define MPIDI_Pkt_set_seqnum(pkt_, seqnum_) \ { \ (pkt_)->seqnum = (seqnum_); \ }# define MPIDI_VC_Init_seqnum_send(vc_) \ { \ (vc_)->seqnum_send = 0; \ }#else# define MPIDI_Request_set_seqnum(req_, seqnum_)# define MPIDI_VC_FAI_send_seqnum(vc_, seqnum_out_)# define MPIDI_Pkt_set_seqnum(pkt_, seqnum_)# define MPIDI_VC_Init_seqnum_send(vc_)#endif/*------------------- END REQUEST SECTION -------------------*//*------------------ BEGIN COMM SECTION ------------------*/#define MPIDI_Comm_get_vc(comm_, rank_, vcp_) \{ \ *(vcp_) = (comm_)->vcr[(rank_)]; \ if ((*(vcp_))->state == MPIDI_VC_STATE_INACTIVE) \ { \ MPIU_DBG_PrintVCState2(*(vcp_), MPIDI_VC_STATE_ACTIVE); \ (*(vcp_))->state = MPIDI_VC_STATE_ACTIVE; \ } \}/*---------------- END COMM SECTION ----------------*//*-------------------- BEGIN PACKET SECTION --------------------*/#if !defined(MPICH_DEBUG_MEMINIT)# define MPIDI_Pkt_init(pkt_, type_) \ { \ (pkt_)->type = (type_); \ }#else# define MPIDI_Pkt_init(pkt_, type_) \ { \ memset((void *) (pkt_), 0xfc, sizeof(MPIDI_CH3_Pkt_t)); \ (pkt_)->type = (type_); \ }#endif/*------------------ END PACKET SECTION ------------------*//*--------------------------- BEGIN PROCESS GROUP SECTION ---------------------------*//* FIXME: Determine which of these functions should be exported to all of the MPICH routines and which are internal to the device implementation */typedef int (*MPIDI_PG_Compare_ids_fn_t)(void * id1, void * id2);typedef int (*MPIDI_PG_Destroy_fn_t)(MPIDI_PG_t * pg);int MPIDI_PG_Init( int *, char ***, MPIDI_PG_Compare_ids_fn_t, MPIDI_PG_Destroy_fn_t);int MPIDI_PG_Finalize(void);int MPIDI_PG_Create(int vct_sz, void * pg_id, MPIDI_PG_t ** ppg);int MPIDI_PG_Destroy(MPIDI_PG_t * pg);int MPIDI_PG_Find(void * id, MPIDI_PG_t ** pgp);int MPIDI_PG_Id_compare(void *id1, void *id2);int MPIDI_PG_Get_next(MPIDI_PG_t ** pgp);int MPIDI_PG_Iterate_reset(void);/* FIXME: MPIDI_PG_Get_vc is a macro, not a routine */int MPIDI_PG_Get_vc(MPIDI_PG_t * pg, int rank, struct MPIDI_VC ** vc); int MPIDI_PG_Close_VCs( void );int MPIDI_PG_InitConnKVS( MPIDI_PG_t * );int MPIDI_PG_GetConnKVSname( char ** );int MPIDI_PG_InitConnString( MPIDI_PG_t * );int MPIDI_PG_GetConnString( MPIDI_PG_t *, int, char *, int );int MPIDI_PG_Dup_vcr( MPIDI_PG_t *, int, struct MPIDI_VC ** );int MPIDI_PG_Get_size(MPIDI_PG_t * pg);void MPIDI_PG_IdToNum( MPIDI_PG_t *, int * );int MPIU_PG_Printall( FILE * );int MPIDI_PG_CheckForSingleton( void );/* CH3_PG_Init allows the channel to pre-initialize the process group */int MPIDI_CH3_PG_Init( MPIDI_PG_t * );#define MPIDI_PG_add_ref(pg_) \{ \ MPIU_Object_add_ref(pg_); \ MPIU_DBG_MSG_FMT(REFCOUNT,TYPICAL,(MPIU_DBG_FDEST,\ "Incr process group %p ref count to %d",pg_,pg_->ref_count));\}#define MPIDI_PG_release_ref(pg_, inuse_) \{ \ MPIU_Object_release_ref(pg_, inuse_); \ MPIU_DBG_MSG_FMT(REFCOUNT,TYPICAL,(MPIU_DBG_FDEST,\ "Decr process group %p ref count to %d",pg_,pg_->ref_count));\}/* FIXME: What is the difference between get_vcr and get_vc? */#define MPIDI_PG_Get_vc(pg_, rank_, vcp_) \{ \ *(vcp_) = &(pg_)->vct[rank_]; \ if ((*(vcp_))->state == MPIDI_VC_STATE_INACTIVE) \ { \ MPIU_DBG_PrintVCState2(*(vcp_), MPIDI_VC_STATE_ACTIVE); \ (*(vcp_))->state = MPIDI_VC_STATE_ACTIVE; \ } \}#define MPIDI_PG_Get_size(pg_) ((pg_)->size)#ifdef MPIDI_DEV_IMPLEMENTS_KVSint MPIDI_PG_To_string(MPIDI_PG_t *pg_ptr, char **str_ptr, int *);int MPIDI_PG_Create_from_string(const char * str, MPIDI_PG_t ** pg_pptr, int *flag);#endif/*------------------------- END PROCESS GROUP SECTION -------------------------*//*-------------------------------- BEGIN VIRTUAL CONNECTION SECTION --------------------------------*//*E MPIDI_VC_State - States for a virtual connection. Notes: A closed connection is placed into 'STATE_INACTIVE'. (is this true?) E*/typedef enum MPIDI_VC_State{ MPIDI_VC_STATE_INACTIVE=1, MPIDI_VC_STATE_ACTIVE, MPIDI_VC_STATE_LOCAL_CLOSE, MPIDI_VC_STATE_REMOTE_CLOSE, MPIDI_VC_STATE_CLOSE_ACKED} MPIDI_VC_State_t;struct MPID_Comm;typedef struct MPIDI_VC{ /* XXX - need better comment */ /* MPIU_Object fields. MPIDI_VC_t objects are not allocated using the MPIU_Object system, but we do use the associated reference counting routines. The handle value is required when debugging objects (the handle kind is used in reporting on changes to the object). */ int handle; volatile int ref_count; /* state of the VC */ MPIDI_VC_State_t state; /* Process group to which this VC belongs */ struct MPIDI_PG * pg; /* Rank of the process in that process group associated with this VC */ int pg_rank; /* Local process ID */ int lpid; #if defined(MPID_USE_SEQUENCE_NUMBERS) /* Sequence number of the next packet to be sent */ MPID_Seqnum_t seqnum_send;#endif #if defined(MPIDI_CH3_MSGS_UNORDERED) /* Sequence number of the next packet we expect to receive */ MPID_Seqnum_t seqnum_recv; /* Queue for holding packets received out of order. NOTE: the CH3 device only orders packets. Handling of out-of-order data is the responsibility of the channel. */ MPIDI_CH3_Pkt_send_container_t * msg_reorder_queue;#endif /* rendezvous function pointers. Called to send a rendevous message or when one is matched */ int (* rndvSend_fn)( struct MPID_Request **sreq_p, const void * buf, int count, MPI_Datatype datatype, int dt_contig, MPIDI_msg_sz_t data_sz, MPI_Aint dt_true_lb, int rank, int tag, struct MPID_Comm * comm, int context_offset ); int (* rndvRecv_fn)( struct MPIDI_VC * vc, struct MPID_Request *rreq ); /* eager message threshold */ int eager_max_msg_sz; /* noncontiguous send function pointer. Called to send a noncontiguous message. Caller must initialize sreq->dev.segment, _first and _size. Contiguous messages are called directly from CH3 and cannot be overridden. */ int (* sendNoncontig_fn)( struct MPIDI_VC *vc, struct MPID_Request *sreq, void *header, MPIDI_msg_sz_t hdr_sz ); /* Rather than have each channel define its own fields for the channel-specific data, we provide a fixed-sized scratchpad. Currently, this has a very generous size, though this may shrink later (a channel can always allocate storage and hang it off of the end). This is necessary to allow dynamic loading of channels at MPI_Init time. *//* The ssm channel needs a *huge* space for the VC. We need to fix that. */#define MPIDI_CH3_VC_SIZE 256 int32_t channel_private[MPIDI_CH3_VC_SIZE];# if defined(MPIDI_CH3_VC_DECL) MPIDI_CH3_VC_DECL# endif}MPIDI_VC_t;typedef enum MPIDI_VC_Event{ MPIDI_VC_EVENT_TERMINATED}MPIDI_VC_Event_t;#ifndef HAVE_MPIDI_VCRT#define HAVE_MPIDI_VCRTtypedef struct MPIDI_VCRT * MPID_VCRT;typedef struct MPIDI_VC * MPID_VCR;#endif/* Initialize a new VC */int MPIDI_VC_Init( MPIDI_VC_t *, MPIDI_PG_t *, int );#if defined(MPIDI_CH3_MSGS_UNORDERED)# define MPIDI_VC_Init_seqnum_recv(vc_); \ { \ (vc_)->seqnum_recv = 0; \ (vc_)->msg_reorder_queue = NULL; \ }#else# define MPIDI_VC_Init_seqnum_recv(vc_);#endif#define MPIDI_VC_add_ref( _vc ) \ { MPIU_Object_add_ref( _vc ); \ MPIU_DBG_MSG_FMT(REFCOUNT,TYPICAL,(MPIU_DBG_FDEST, \ "Incr VC %p ref count to %d",_vc,_vc->ref_count));}#define MPIDI_VC_release_ref( _vc, _inuse ) \ { MPIU_Object_release_ref( _vc, _inuse ); \ MPIU_DBG_MSG_FMT(REFCOUNT,TYPICAL,(MPIU_DBG_FDEST,\ "Decr VC %p ref count to %d",_vc,_vc->ref_count));}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -