📄 mpidimpl.h
字号:
/*------------------------------ END VIRTUAL CONNECTION SECTION ------------------------------*//*--------------------------------- BEGIN SEND/RECEIVE BUFFER SECTION ---------------------------------*/#if !defined(MPIDI_CH3U_Offsetof)# define MPIDI_CH3U_Offsetof(struct_, field_) ((MPI_Aint) &((struct_*)0)->field_)#endif#if !defined(MPIDI_CH3U_SRBuf_size)# define MPIDI_CH3U_SRBuf_size (256 * 1024)#endiftypedef struct __MPIDI_CH3U_SRBuf_element { /* Keep the buffer at the top to help keep the memory alignment */ char buf[MPIDI_CH3U_SRBuf_size]; struct __MPIDI_CH3U_SRBuf_element * next;} MPIDI_CH3U_SRBuf_element_t;extern MPIDI_CH3U_SRBuf_element_t * MPIDI_CH3U_SRBuf_pool;#if !defined (MPIDI_CH3U_SRBuf_get)# define MPIDI_CH3U_SRBuf_get(req_) \ { \ MPIDI_CH3U_SRBuf_element_t * tmp; \ if (!MPIDI_CH3U_SRBuf_pool) { \ MPIDI_CH3U_SRBuf_pool = \ MPIU_Malloc(sizeof(MPIDI_CH3U_SRBuf_element_t)); \ MPIDI_CH3U_SRBuf_pool->next = NULL; \ } \ tmp = MPIDI_CH3U_SRBuf_pool; \ MPIDI_CH3U_SRBuf_pool = MPIDI_CH3U_SRBuf_pool->next; \ tmp->next = NULL; \ (req_)->dev.tmpbuf = tmp->buf; \ }#endif#if !defined (MPIDI_CH3U_SRBuf_free)# define MPIDI_CH3U_SRBuf_free(req_) \ { \ MPIDI_CH3U_SRBuf_element_t * tmp; \ MPIU_Assert(MPIDI_Request_get_srbuf_flag(req_)); \ MPIDI_Request_set_srbuf_flag((req_), FALSE); \ tmp = (MPIDI_CH3U_SRBuf_element_t *) (((MPI_Aint) ((req_)->dev.tmpbuf)) - \ ((MPI_Aint) MPIDI_CH3U_Offsetof(MPIDI_CH3U_SRBuf_element_t, buf))); \ tmp->next = MPIDI_CH3U_SRBuf_pool; \ MPIDI_CH3U_SRBuf_pool = tmp; \ }#endif#if !defined(MPIDI_CH3U_SRBuf_alloc)# define MPIDI_CH3U_SRBuf_alloc(req_, size_) \ { \ MPIDI_CH3U_SRBuf_get(req_); \ if ((req_)->dev.tmpbuf != NULL) \ { \ (req_)->dev.tmpbuf_sz = MPIDI_CH3U_SRBuf_size; \ MPIDI_Request_set_srbuf_flag((req_), TRUE); \ } \ else \ { \ (req_)->dev.tmpbuf_sz = 0; \ } \ }#endif/*------------------------------- END SEND/RECEIVE BUFFER SECTION -------------------------------*//*---------------------------- BEGIN DEBUGGING TOOL SECTION ----------------------------*//* If there is no support for dynamic processes, there will be no channel-specific connection state */#ifdef USE_DBG_LOGGING#ifdef MPIDI_CH3_HAS_NO_DYNAMIC_PROCESS#define MPIDI_CH3_VC_GetStateString( _c ) "none"#else/* FIXME: This duplicates a value in util/sock/ch3usock.h */const char *MPIDI_CH3_VC_GetStateString(struct MPIDI_VC *);const char *MPIDI_CH3_VC_SockGetStateString(struct MPIDI_VC *);#endif/* These tw routines are in mpidi_pg.c and are used to print the connection string (which is attached to a process group) */int MPIDI_PrintConnStr( const char *file, int line, const char *label, const char *str );int MPIDI_PrintConnStrToFile( FILE *fd, const char *file, int line, const char *label, const char *str );#endif/* These macros simplify and unify the debugging of changes in the connection state MPIU_DBG_VCSTATECHANGE(vc,newstate) - use when changing the state of a VC MPIU_DBG_VCCHSTATECHANGE(vc,newstate) - use when changing the state of the channel-specific part of the vc (e.g., vc->ch.state) MPIU_DBG_CONNSTATECHANGE(vc,conn,newstate ) - use when changing the state of a conn. vc may be null MPIU_DBG_CONNSTATECHANGEMSG(vc,conn,newstate,msg ) - use when changing the state of a conn. vc may be null. Like CONNSTATECHANGE, but allows an additional message MPIU_DBG_PKT(conn,pkt,msg) - print out a short description of an packet being sent/received on the designated connection, prefixed with msg.*/#define MPIU_DBG_VCSTATECHANGE(_vc,_newstate) \ MPIU_DBG_MSG_FMT(CH3_CONNECT,TYPICAL,(MPIU_DBG_FDEST, \ "vc=%p: Setting state (vc) from %s to %s, vcchstate is %s", \ _vc, MPIDI_VC_GetStateString((_vc)->state), \ #_newstate, MPIU_CALL(MPIDI_CH3,VC_GetStateString( (_vc) ))) )#define MPIU_DBG_VCCHSTATECHANGE(_vc,_newstate) \ MPIU_DBG_MSG_FMT(CH3_CONNECT,TYPICAL,(MPIU_DBG_FDEST, \ "vc=%p: Setting state (ch) from %s to %s, vc state is %s", \ _vc, MPIU_CALL(MPIDI_CH3,VC_GetStateString((_vc))), \ #_newstate, MPIDI_VC_GetStateString( (_vc)->state )) )#define MPIU_DBG_CONNSTATECHANGE(_vc,_conn,_newstate) \ MPIU_DBG_MSG_FMT(CH3_CONNECT,TYPICAL,(MPIU_DBG_FDEST, \ "vc=%p,conn=%p: Setting state (conn) from %s to %s, vcstate = %s", \ _vc, _conn, \ MPIDI_Conn_GetStateString((_conn)->state), #_newstate, \ _vc ? MPIDI_VC_GetStateString((_vc)->state) : "<no vc>" ))#define MPIU_DBG_CONNSTATECHANGE_MSG(_vc,_conn,_newstate,_msg) \ MPIU_DBG_MSG_FMT(CH3_CONNECT,TYPICAL,(MPIU_DBG_FDEST, \ "vc=%p,conn=%p: Setting conn state from %s to %s, vcstate = %s %s", \ _vc, _conn, \ MPIDI_Conn_GetStateString((_conn)->state), #_newstate, \ _vc ? MPIDI_VC_GetStateString((_vc)->state) : "<no vc>", _msg ))#define MPIU_DBG_VCUSE(_vc,_msg) \ MPIU_DBG_MSG_FMT(CH3_CONNECT,TYPICAL,(MPIU_DBG_FDEST,\ "vc=%p: Using vc for %s", _vc, _msg ))#define MPIU_DBG_PKT(_conn,_pkt,_msg) \ MPIU_DBG_MSG_FMT(CH3_OTHER,TYPICAL,(MPIU_DBG_FDEST,\ "conn=%p: %s %s", _conn, _msg, MPIDI_Pkt_GetDescString( _pkt ) ))const char *MPIDI_Pkt_GetDescString( MPIDI_CH3_Pkt_t *pkt );/* These macros help trace communication headers */#define MPIU_DBG_MSGPKT(_vc,_tag,_contextid,_dest,_size,_kind) \ MPIU_DBG_MSG_FMT(CH3_MSG,TYPICAL,(MPIU_DBG_FDEST,\ "%s: vc=%p, tag=%d, context=%d, dest=%d, datasz=" MPIDI_MSG_SZ_FMT,\ _kind,_vc,_tag,_contextid,_dest,_size) )/* FIXME: Switch this to use the common debug code */void MPIDI_dbg_printf(int, char *, char *, ...);void MPIDI_err_printf(char *, char *, ...);/* FIXME: This does not belong here */#ifdef USE_MPIU_DBG_PRINT_VCextern char *MPIU_DBG_parent_str;#endif#if defined(MPICH_DBG_OUTPUT)#define MPIDI_DBG_PRINTF(e_) \{ \ if (MPIUI_dbg_state != MPIU_DBG_STATE_NONE) \ { \ MPIDI_dbg_printf e_; \ } \}#else# define MPIDI_DBG_PRINTF(e)#endif#define MPIDI_ERR_PRINTF(e) MPIDI_err_printf e#if defined(HAVE_CPP_VARARGS)# define MPIDI_dbg_printf(level, func, fmt, args...) \ { \ MPIU_dbglog_printf("[%d] %s(): " fmt "\n", MPIR_Process.comm_world->rank, func, ## args); \ }# define MPIDI_err_printf(func, fmt, args...) \ { \ MPIU_Error_printf("[%d] ERROR - %s(): " fmt "\n", MPIR_Process.comm_world->rank, func, ## args); \ fflush(stdout); \ }#endif/* This is used to quote a name in a definition (see FUNCNAME/FCNAME below) */#define MPIDI_QUOTE(A) MPIDI_QUOTE2(A)#define MPIDI_QUOTE2(A) #A#ifdef MPICH_DBG_OUTPUT void MPIDI_DBG_Print_packet(MPIDI_CH3_Pkt_t *pkt);#else# define MPIDI_DBG_Print_packet(a)#endif/* Given a state, return the string for this state (VC's and connections) */const char * MPIDI_VC_GetStateString(int);/*-------------------------- END DEBUGGING TOOL SECTION --------------------------*//* Prototypes for internal device routines */int MPIDI_Isend_self(const void *, int, MPI_Datatype, int, int, MPID_Comm *, int, int, MPID_Request **);/*-------------------------- BEGIN MPI PORT SECTION --------------------------*//* These are the default functions */int MPIDI_Comm_connect(const char *, MPID_Info *, int, MPID_Comm *, MPID_Comm **);int MPIDI_Comm_accept(const char *, MPID_Info *, int, MPID_Comm *, MPID_Comm **);int MPIDI_Comm_spawn_multiple(int, char **, char ***, int *, MPID_Info **, int, MPID_Comm *, MPID_Comm **, int *);/* This structure defines a module that handles the routines that work with MPI port names */typedef struct MPIDI_Port_Ops { int (*OpenPort)( MPID_Info *, char * ); int (*ClosePort)( const char * ); int (*CommAccept)( const char *, MPID_Info *, int, MPID_Comm *, MPID_Comm ** ); int (*CommConnect)( const char *, MPID_Info *, int, MPID_Comm *, MPID_Comm ** );} MPIDI_PortFns;#define MPIDI_PORTFNS_VERSION 1int MPIDI_CH3_PortFnsInit( MPIDI_PortFns * );/* Utility routines provided in src/ch3u_port.c for working with connection queues */int MPIDI_CH3I_Acceptq_enqueue(MPIDI_VC_t * vc, int port_name_tag);int MPIDI_CH3I_Acceptq_dequeue(MPIDI_VC_t ** vc, int port_name_tag);#ifdef MPIDI_CH3_CHANNEL_AVOIDS_SELECTint MPIDI_CH3_Complete_Acceptq_dequeue(MPIDI_VC_t * vc);#else#define MPIDI_CH3_Complete_Acceptq_dequeue(vc) MPI_SUCCESS#endif/*-------------------------- END MPI PORT SECTION --------------------------*//* part of mpid_vc.c, this routine completes any pending operations on a communicator */int MPIDI_CH3U_Comm_FinishPending( MPID_Comm * );#define MPIDI_MAX_KVS_VALUE_LEN 4096/* ------------------------------------------------------------------------- *//* mpirma.h (in src/mpi/rma?) *//* ------------------------------------------------------------------------- *//* This structure defines a module that handles the routines that work with MPI-2 RMA ops */typedef struct MPIDI_RMA_Ops { int (*Win_create)(void *, MPI_Aint, int, MPID_Info *, MPID_Comm *, MPID_Win **, struct MPIDI_RMA_Ops *); int (*Win_free)(MPID_Win **); int (*Put)(void *, int, MPI_Datatype, int, MPI_Aint, int, MPI_Datatype, MPID_Win *); int (*Get)(void *, int, MPI_Datatype, int, MPI_Aint, int, MPI_Datatype, MPID_Win *); int (*Accumulate)(void *, int, MPI_Datatype, int, MPI_Aint, int, MPI_Datatype, MPI_Op, MPID_Win *); int (*Win_fence)(int, MPID_Win *); int (*Win_post)(MPID_Group *, int, MPID_Win *); int (*Win_start)(MPID_Group *, int, MPID_Win *); int (*Win_complete)(MPID_Win *); int (*Win_wait)(MPID_Win *); int (*Win_lock)(int, int, int, MPID_Win *); int (*Win_unlock)(int, MPID_Win *); void * (*Alloc_mem)(size_t, MPID_Info *); int (*Free_mem)(void *);} MPIDI_RMAFns;#define MPIDI_RMAFNS_VERSION 1int MPIDI_CH3_RMAFnsInit( MPIDI_RMAFns * );#define MPIDI_RMA_PUT 23#define MPIDI_RMA_GET 24#define MPIDI_RMA_ACCUMULATE 25#define MPIDI_RMA_LOCK 26#define MPIDI_RMA_DATATYPE_BASIC 50#define MPIDI_RMA_DATATYPE_DERIVED 51#define MPID_LOCK_NONE 0int MPIDI_Win_create(void *, MPI_Aint, int, MPID_Info *, MPID_Comm *, MPID_Win **, MPIDI_RMAFns *);int MPIDI_Win_fence(int, MPID_Win *);int MPIDI_Put(void *, int, MPI_Datatype, int, MPI_Aint, int, MPI_Datatype, MPID_Win *); int MPIDI_Get(void *, int, MPI_Datatype, int, MPI_Aint, int, MPI_Datatype, MPID_Win *);int MPIDI_Accumulate(void *, int, MPI_Datatype, int, MPI_Aint, int, MPI_Datatype, MPI_Op, MPID_Win *);int MPIDI_Win_free(MPID_Win **); int MPIDI_Win_wait(MPID_Win *win_ptr);int MPIDI_Win_complete(MPID_Win *win_ptr);int MPIDI_Win_post(MPID_Group *group_ptr, int assert, MPID_Win *win_ptr);int MPIDI_Win_start(MPID_Group *group_ptr, int assert, MPID_Win *win_ptr);int MPIDI_Win_lock(int lock_type, int dest, int assert, MPID_Win *win_ptr);int MPIDI_Win_unlock(int dest, MPID_Win *win_ptr);void *MPIDI_Alloc_mem(size_t size, MPID_Info *info_ptr);int MPIDI_Free_mem(void *ptr);/* optional channel-specific */void *MPIDI_CH3_Alloc_mem(size_t size, MPID_Info *info_ptr);int MPIDI_CH3_Win_create(void *base, MPI_Aint size, int disp_unit, MPID_Info *info, MPID_Comm *comm_ptr, MPID_Win **win_ptr, MPIDI_RMAFns *RMAFns);int MPIDI_CH3_Free_mem(void *ptr);void MPIDI_CH3_Cleanup_mem(void);int MPIDI_CH3_Win_free(MPID_Win **win_ptr);int MPIDI_CH3_Put(void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank, MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPID_Win *win_ptr);int MPIDI_CH3_Get(void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank, MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPID_Win *win_ptr);int MPIDI_CH3_Accumulate(void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank, MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Op op, MPID_Win *win_ptr);int MPIDI_CH3_Win_fence(int assert, MPID_Win *win_ptr);int MPIDI_CH3_Win_lock(int lock_type, int dest, int assert, MPID_Win *win_ptr);int MPIDI_CH3_Win_unlock(int dest, MPID_Win *win_ptr);int MPIDI_CH3_Win_wait(MPID_Win *win_ptr);int MPIDI_CH3_Win_complete(MPID_Win *win_ptr);int MPIDI_CH3_Win_post(MPID_Group *group_ptr, int assert, MPID_Win *win_ptr);int MPIDI_CH3_Win_start(MPID_Group *group_ptr, int assert, MPID_Win *win_ptr);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -