int MPID_nem_mx_init (MPIDI_PG_t *pg_p, int pg_rank, char **bc_val_p, int *val_max_sz_p) { int mpi_errno = MPI_SUCCESS ; MPID_nem_mx_internal_req_queue_init(); mpi_errno = init_mx(pg_p); if (mpi_errno) MPIU_ERR_POP(mpi_errno); mpi_errno = MPID_nem_mx_get_business_card (pg_rank, bc_val_p, val_max_sz_p); if (mpi_errno) MPIU_ERR_POP (mpi_errno); mx_register_unexp_handler(MPID_nem_mx_local_endpoint,MPID_nem_mx_get_adi_msg,NULL); mpi_errno = MPIDI_CH3I_Register_anysource_notification(MPID_nem_mx_anysource_posted, MPID_nem_mx_anysource_matched); if (mpi_errno) MPIU_ERR_POP(mpi_errno); fn_exit: return mpi_errno; fn_fail: goto fn_exit; }
int MPID_nem_newmad_init (MPIDI_PG_t *pg_p, int pg_rank, char **bc_val_p, int *val_max_sz_p) { int mpi_errno = MPI_SUCCESS ; int index; /* fprintf(stdout,"Size of MPID_nem_mad_module_vc_area_internal_t : %i | size of nm_sr_request_t :%i | Size of req_area : %i\n", sizeof(MPID_nem_newmad_vc_area_internal_t),sizeof(nm_sr_request_t), sizeof(MPID_nem_newmad_req_area)); */ /* MPIU_Assert( sizeof(MPID_nem_newmad_vc_area_internal_t) <= MPID_NEM_VC_NETMOD_AREA_LEN); MPIU_Assert( sizeof(MPID_nem_newmad_req_area) <= MPID_NEM_REQ_NETMOD_AREA_LEN); */ if (sizeof(MPID_nem_newmad_vc_area) > MPID_NEM_VC_NETMOD_AREA_LEN) { fprintf(stdout,"===========================================================\n"); fprintf(stdout,"=== Error : Newmad data structure size is too long ===\n"); fprintf(stdout,"=== VC netmod area is %4i | Nmad struct size is %4i ===\n", MPID_NEM_VC_NETMOD_AREA_LEN, sizeof(MPID_nem_newmad_vc_area)); fprintf(stdout,"===========================================================\n"); exit(0); } if (sizeof(MPID_nem_newmad_req_area) > MPID_NEM_REQ_NETMOD_AREA_LEN) { fprintf(stdout,"===========================================================\n"); fprintf(stdout,"=== Error : Newmad data structure size is too long ===\n"); fprintf(stdout,"=== Req netmod area is %4i | Nmad struct size is %4i ===\n", MPID_NEM_REQ_NETMOD_AREA_LEN, sizeof(MPID_nem_newmad_req_area)); fprintf(stdout,"===========================================================\n"); exit(0); } mpid_nem_newmad_myrank = pg_rank; init_mad(pg_p); mpi_errno = MPID_nem_newmad_get_business_card(pg_rank,bc_val_p, val_max_sz_p); if (mpi_errno) MPIU_ERR_POP (mpi_errno); mpi_errno = MPIDI_CH3I_Register_anysource_notification(MPID_nem_newmad_anysource_posted, MPID_nem_newmad_anysource_matched); if (mpi_errno) MPIU_ERR_POP(mpi_errno); mpi_errno = MPID_nem_register_initcomp_cb(MPID_nem_newmad_init_completed); if (mpi_errno) MPIU_ERR_POP(mpi_errno); fn_exit: return mpi_errno; fn_fail: goto fn_exit; }
int MPID_nem_mxm_init(MPIDI_PG_t * pg_p, int pg_rank, char **bc_val_p, int *val_max_sz_p) { int mpi_errno = MPI_SUCCESS; MPIDI_STATE_DECL(MPID_STATE_MXM_INIT); MPIDI_FUNC_ENTER(MPID_STATE_MXM_INIT); /* first make sure that our private fields in the vc and req fit into the area provided */ MPIU_Assert(sizeof(MPID_nem_mxm_vc_area) <= MPID_NEM_VC_NETMOD_AREA_LEN); MPIU_Assert(sizeof(MPID_nem_mxm_req_area) <= MPID_NEM_REQ_NETMOD_AREA_LEN); mpi_errno = _mxm_init(pg_rank, pg_p->size); if (mpi_errno) MPIU_ERR_POP(mpi_errno); mpi_errno = MPID_nem_mxm_get_business_card(pg_rank, bc_val_p, val_max_sz_p); if (mpi_errno) MPIU_ERR_POP(mpi_errno); mpi_errno = MPIDI_CH3I_Register_anysource_notification(MPID_nem_mxm_anysource_posted, MPID_nem_mxm_anysource_matched); if (mpi_errno) MPIU_ERR_POP(mpi_errno); mpi_errno = MPID_nem_register_initcomp_cb(_mxm_post_init); if (mpi_errno) MPIU_ERR_POP(mpi_errno); mpi_errno = MPIDI_CH3U_Comm_register_create_hook(_mxm_add_comm, NULL); if (mpi_errno) MPIU_ERR_POP(mpi_errno); mpi_errno = MPIDI_CH3U_Comm_register_destroy_hook(_mxm_del_comm, NULL); if (mpi_errno) MPIU_ERR_POP(mpi_errno); fn_exit: MPIDI_FUNC_EXIT(MPID_STATE_MXM_INIT); return mpi_errno; fn_fail: goto fn_exit; }
int MPID_nem_mxm_init(MPIDI_PG_t * pg_p, int pg_rank, char **bc_val_p, int *val_max_sz_p) { int r; int mpi_errno = MPI_SUCCESS; MPIR_FUNC_VERBOSE_STATE_DECL(MPID_STATE_MXM_INIT); MPIR_FUNC_VERBOSE_ENTER(MPID_STATE_MXM_INIT); /* first make sure that our private fields in the vc and req fit into the area provided */ MPIR_Assert(sizeof(MPID_nem_mxm_vc_area) <= MPIDI_NEM_VC_NETMOD_AREA_LEN); MPIR_Assert(sizeof(MPID_nem_mxm_req_area) <= MPIDI_NEM_REQ_NETMOD_AREA_LEN); /* mpich-specific initialization of mxm */ /* check if the user is not trying to override the tls setting * before resetting it */ if (getenv("MXM_TLS") == NULL) { r = MPL_putenv("MXM_TLS=rc,dc,ud"); MPIR_ERR_CHKANDJUMP(r, mpi_errno, MPI_ERR_OTHER, "**putenv"); } /* [PB @ 2014-10-06] If hugepage support is not enabled, we force * memory allocation to go through mmap. This is mainly to * workaround issues in MXM with Ubuntu where the detection has * some issues (either because of bugs on the platform or within * MXM) causing errors. This can probably be deleted eventually * when this issue is resolved. */ if (MPIR_CVAR_NEMESIS_MXM_HUGEPAGE == 0) { if (getenv("MXM_MEM_ALLOC") == NULL) { r = MPL_putenv("MXM_MEM_ALLOC=mmap,libc,sysv"); MPIR_ERR_CHKANDJUMP(r, mpi_errno, MPI_ERR_OTHER, "**putenv"); } } mpi_errno = _mxm_init(pg_rank, pg_p->size); if (mpi_errno) MPIR_ERR_POP(mpi_errno); mpi_errno = MPID_nem_mxm_get_business_card(pg_rank, bc_val_p, val_max_sz_p); if (mpi_errno) MPIR_ERR_POP(mpi_errno); mpi_errno = MPIDI_CH3I_Register_anysource_notification(MPID_nem_mxm_anysource_posted, MPID_nem_mxm_anysource_matched); if (mpi_errno) MPIR_ERR_POP(mpi_errno); mpi_errno = MPID_nem_register_initcomp_cb(_mxm_post_init); if (mpi_errno) MPIR_ERR_POP(mpi_errno); mpi_errno = MPIDI_CH3U_Comm_register_create_hook(_mxm_add_comm, NULL); if (mpi_errno) MPIR_ERR_POP(mpi_errno); mpi_errno = MPIDI_CH3U_Comm_register_destroy_hook(_mxm_del_comm, NULL); if (mpi_errno) MPIR_ERR_POP(mpi_errno); MPIDI_Anysource_improbe_fn = MPID_nem_mxm_anysource_improbe; fn_exit: MPIR_FUNC_VERBOSE_EXIT(MPID_STATE_MXM_INIT); return mpi_errno; fn_fail: goto fn_exit; }
static int ptl_init(MPIDI_PG_t *pg_p, int pg_rank, char **bc_val_p, int *val_max_sz_p) { int mpi_errno = MPI_SUCCESS; int ret; ptl_md_t md; ptl_ni_limits_t desired; MPIR_FUNC_VERBOSE_STATE_DECL(MPID_STATE_PTL_INIT); MPIR_FUNC_VERBOSE_ENTER(MPID_STATE_PTL_INIT); /* first make sure that our private fields in the vc and req fit into the area provided */ MPIR_Assert(sizeof(MPID_nem_ptl_vc_area) <= MPIDI_NEM_VC_NETMOD_AREA_LEN); MPIR_Assert(sizeof(MPID_nem_ptl_req_area) <= MPIDI_NEM_REQ_NETMOD_AREA_LEN); /* Make sure our IOV is the same as portals4's IOV */ MPIR_Assert(sizeof(ptl_iovec_t) == sizeof(MPL_IOV)); MPIR_Assert(((void*)&(((ptl_iovec_t*)0)->iov_base)) == ((void*)&(((MPL_IOV*)0)->MPL_IOV_BUF))); MPIR_Assert(((void*)&(((ptl_iovec_t*)0)->iov_len)) == ((void*)&(((MPL_IOV*)0)->MPL_IOV_LEN))); MPIR_Assert(sizeof(((ptl_iovec_t*)0)->iov_len) == sizeof(((MPL_IOV*)0)->MPL_IOV_LEN)); mpi_errno = MPIDI_CH3I_Register_anysource_notification(MPID_nem_ptl_anysource_posted, MPID_nem_ptl_anysource_matched); if (mpi_errno) MPIR_ERR_POP(mpi_errno); MPIDI_Anysource_improbe_fn = MPID_nem_ptl_anysource_improbe; /* init portals */ ret = PtlInit(); MPIR_ERR_CHKANDJUMP1(ret, mpi_errno, MPI_ERR_OTHER, "**ptlinit", "**ptlinit %s", MPID_nem_ptl_strerror(ret)); /* do an interface pre-init to get the default limits struct */ ret = PtlNIInit(PTL_IFACE_DEFAULT, PTL_NI_MATCHING | PTL_NI_PHYSICAL, PTL_PID_ANY, NULL, &desired, &MPIDI_nem_ptl_ni); MPIR_ERR_CHKANDJUMP1(ret, mpi_errno, MPI_ERR_OTHER, "**ptlniinit", "**ptlniinit %s", MPID_nem_ptl_strerror(ret)); /* finalize the interface so we can re-init with our desired maximums */ ret = PtlNIFini(MPIDI_nem_ptl_ni); MPIR_ERR_CHKANDJUMP1(ret, mpi_errno, MPI_ERR_OTHER, "**ptlnifini", "**ptlnifini %s", MPID_nem_ptl_strerror(ret)); /* set higher limits if they are determined to be too low */ if (desired.max_unexpected_headers < UNEXPECTED_HDR_COUNT && getenv("PTL_LIM_MAX_UNEXPECTED_HEADERS") == NULL) desired.max_unexpected_headers = UNEXPECTED_HDR_COUNT; if (desired.max_list_size < LIST_SIZE && getenv("PTL_LIM_MAX_LIST_SIZE") == NULL) desired.max_list_size = LIST_SIZE; if (desired.max_entries < ENTRY_COUNT && getenv("PTL_LIM_MAX_ENTRIES") == NULL) desired.max_entries = ENTRY_COUNT; /* do the real init */ ret = PtlNIInit(PTL_IFACE_DEFAULT, PTL_NI_MATCHING | PTL_NI_PHYSICAL, PTL_PID_ANY, &desired, &MPIDI_nem_ptl_ni_limits, &MPIDI_nem_ptl_ni); MPIR_ERR_CHKANDJUMP1(ret, mpi_errno, MPI_ERR_OTHER, "**ptlniinit", "**ptlniinit %s", MPID_nem_ptl_strerror(ret)); /* allocate EQs for each portal */ ret = PtlEQAlloc(MPIDI_nem_ptl_ni, EVENT_COUNT, &MPIDI_nem_ptl_eq); MPIR_ERR_CHKANDJUMP1(ret, mpi_errno, MPI_ERR_OTHER, "**ptleqalloc", "**ptleqalloc %s", MPID_nem_ptl_strerror(ret)); ret = PtlEQAlloc(MPIDI_nem_ptl_ni, EVENT_COUNT, &MPIDI_nem_ptl_get_eq); MPIR_ERR_CHKANDJUMP1(ret, mpi_errno, MPI_ERR_OTHER, "**ptleqalloc", "**ptleqalloc %s", MPID_nem_ptl_strerror(ret)); ret = PtlEQAlloc(MPIDI_nem_ptl_ni, EVENT_COUNT, &MPIDI_nem_ptl_control_eq); MPIR_ERR_CHKANDJUMP1(ret, mpi_errno, MPI_ERR_OTHER, "**ptleqalloc", "**ptleqalloc %s", MPID_nem_ptl_strerror(ret)); ret = PtlEQAlloc(MPIDI_nem_ptl_ni, EVENT_COUNT, &MPIDI_nem_ptl_rpt_eq); MPIR_ERR_CHKANDJUMP1(ret, mpi_errno, MPI_ERR_OTHER, "**ptleqalloc", "**ptleqalloc %s", MPID_nem_ptl_strerror(ret)); /* allocate a separate EQ for origin events. with this, we can implement rate-limit operations to prevent a locally triggered flow control even */ ret = PtlEQAlloc(MPIDI_nem_ptl_ni, EVENT_COUNT, &MPIDI_nem_ptl_origin_eq); MPIR_ERR_CHKANDJUMP1(ret, mpi_errno, MPI_ERR_OTHER, "**ptleqalloc", "**ptleqalloc %s", MPID_nem_ptl_strerror(ret)); /* allocate portal for matching messages */ ret = PtlPTAlloc(MPIDI_nem_ptl_ni, PTL_PT_ONLY_USE_ONCE | PTL_PT_ONLY_TRUNCATE | PTL_PT_FLOWCTRL, MPIDI_nem_ptl_eq, PTL_PT_ANY, &MPIDI_nem_ptl_pt); MPIR_ERR_CHKANDJUMP1(ret, mpi_errno, MPI_ERR_OTHER, "**ptlptalloc", "**ptlptalloc %s", MPID_nem_ptl_strerror(ret)); /* allocate portal for large messages where receiver does a get */ ret = PtlPTAlloc(MPIDI_nem_ptl_ni, PTL_PT_ONLY_USE_ONCE | PTL_PT_ONLY_TRUNCATE | PTL_PT_FLOWCTRL, MPIDI_nem_ptl_get_eq, PTL_PT_ANY, &MPIDI_nem_ptl_get_pt); MPIR_ERR_CHKANDJUMP1(ret, mpi_errno, MPI_ERR_OTHER, "**ptlptalloc", "**ptlptalloc %s", MPID_nem_ptl_strerror(ret)); /* allocate portal for MPICH control messages */ ret = PtlPTAlloc(MPIDI_nem_ptl_ni, PTL_PT_ONLY_USE_ONCE | PTL_PT_ONLY_TRUNCATE | PTL_PT_FLOWCTRL, MPIDI_nem_ptl_control_eq, PTL_PT_ANY, &MPIDI_nem_ptl_control_pt); MPIR_ERR_CHKANDJUMP1(ret, mpi_errno, MPI_ERR_OTHER, "**ptlptalloc", "**ptlptalloc %s", MPID_nem_ptl_strerror(ret)); /* allocate portal for MPICH control messages */ ret = PtlPTAlloc(MPIDI_nem_ptl_ni, PTL_PT_ONLY_USE_ONCE | PTL_PT_ONLY_TRUNCATE | PTL_PT_FLOWCTRL, MPIDI_nem_ptl_rpt_eq, PTL_PT_ANY, &MPIDI_nem_ptl_rpt_pt); MPIR_ERR_CHKANDJUMP1(ret, mpi_errno, MPI_ERR_OTHER, "**ptlptalloc", "**ptlptalloc %s", MPID_nem_ptl_strerror(ret)); /* allocate portal for MPICH control messages */ ret = PtlPTAlloc(MPIDI_nem_ptl_ni, PTL_PT_ONLY_USE_ONCE | PTL_PT_ONLY_TRUNCATE | PTL_PT_FLOWCTRL, MPIDI_nem_ptl_rpt_eq, PTL_PT_ANY, &MPIDI_nem_ptl_get_rpt_pt); MPIR_ERR_CHKANDJUMP1(ret, mpi_errno, MPI_ERR_OTHER, "**ptlptalloc", "**ptlptalloc %s", MPID_nem_ptl_strerror(ret)); /* allocate portal for MPICH control messages */ ret = PtlPTAlloc(MPIDI_nem_ptl_ni, PTL_PT_ONLY_USE_ONCE | PTL_PT_ONLY_TRUNCATE | PTL_PT_FLOWCTRL, MPIDI_nem_ptl_rpt_eq, PTL_PT_ANY, &MPIDI_nem_ptl_control_rpt_pt); MPIR_ERR_CHKANDJUMP1(ret, mpi_errno, MPI_ERR_OTHER, "**ptlptalloc", "**ptlptalloc %s", MPID_nem_ptl_strerror(ret)); /* create an MD that covers all of memory */ md.start = 0; md.length = (ptl_size_t)-1; md.options = 0x0; md.eq_handle = MPIDI_nem_ptl_origin_eq; md.ct_handle = PTL_CT_NONE; ret = PtlMDBind(MPIDI_nem_ptl_ni, &md, &MPIDI_nem_ptl_global_md); MPIR_ERR_CHKANDJUMP1(ret, mpi_errno, MPI_ERR_OTHER, "**ptlmdbind", "**ptlmdbind %s", MPID_nem_ptl_strerror(ret)); /* currently, rportlas only works with a single NI and EQ */ ret = MPID_nem_ptl_rptl_init(MPIDI_Process.my_pg->size, ORIGIN_EVENTS, get_target_info); MPIR_ERR_CHKANDJUMP1(ret, mpi_errno, MPI_ERR_OTHER, "**ptlniinit", "**ptlniinit %s", MPID_nem_ptl_strerror(ret)); /* allow rportal to manage the primary portal and retransmit if needed */ ret = MPID_nem_ptl_rptl_ptinit(MPIDI_nem_ptl_ni, MPIDI_nem_ptl_origin_eq, MPIDI_nem_ptl_pt, MPIDI_nem_ptl_rpt_pt); MPIR_ERR_CHKANDJUMP1(ret, mpi_errno, MPI_ERR_OTHER, "**ptlptalloc", "**ptlptalloc %s", MPID_nem_ptl_strerror(ret)); /* allow rportal to manage the get and control portals, but we * don't expect retransmission to be needed on the get portal, so * we pass PTL_PT_ANY as the dummy portal. unfortunately, portals * does not have an "invalid" PT constant, which would have been * more appropriate to pass over here. */ ret = MPID_nem_ptl_rptl_ptinit(MPIDI_nem_ptl_ni, MPIDI_nem_ptl_origin_eq, MPIDI_nem_ptl_get_pt, MPIDI_nem_ptl_get_rpt_pt); MPIR_ERR_CHKANDJUMP1(ret, mpi_errno, MPI_ERR_OTHER, "**ptlptalloc", "**ptlptalloc %s", MPID_nem_ptl_strerror(ret)); ret = MPID_nem_ptl_rptl_ptinit(MPIDI_nem_ptl_ni, MPIDI_nem_ptl_origin_eq, MPIDI_nem_ptl_control_pt, MPIDI_nem_ptl_control_rpt_pt); MPIR_ERR_CHKANDJUMP1(ret, mpi_errno, MPI_ERR_OTHER, "**ptlptalloc", "**ptlptalloc %s", MPID_nem_ptl_strerror(ret)); /* create business card */ mpi_errno = get_business_card(pg_rank, bc_val_p, val_max_sz_p); if (mpi_errno) MPIR_ERR_POP(mpi_errno); /* init other modules */ mpi_errno = MPID_nem_ptl_poll_init(); if (mpi_errno) MPIR_ERR_POP(mpi_errno); mpi_errno = MPID_nem_ptl_nm_init(); if (mpi_errno) MPIR_ERR_POP(mpi_errno); fn_exit: MPIR_FUNC_VERBOSE_EXIT(MPID_STATE_PTL_INIT); return mpi_errno; fn_fail: goto fn_exit; }