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; }