Exemplo n.º 1
0
int mca_pml_yalla_close(void)
{
    PML_YALLA_VERBOSE(1, "mca_pml_yalla_close");

    if (ompi_pml_yalla.ctx_opts != NULL) {
        mxm_config_free_context_opts(ompi_pml_yalla.ctx_opts);
    }
    if (ompi_pml_yalla.ep_opts != NULL) {
        mxm_config_free_ep_opts(ompi_pml_yalla.ep_opts);
    }
    if (ompi_pml_yalla.mxm_context != NULL) {
        mxm_cleanup(ompi_pml_yalla.mxm_context);
        ompi_pml_yalla.mxm_context = NULL;
    }
    return 0;
}
Exemplo n.º 2
0
static mxm_error_t
ompi_mtl_mxm_create_ep(mxm_h ctx, mxm_ep_h *ep, unsigned ptl_bitmap, int lr,
                         uint32_t jobid, uint64_t mxlr, int nlps)
{
    mxm_error_t err;

#if MXM_API < MXM_VERSION(1,5)
    mxm_ep_opts_t ep_opt;
    struct sockaddr_mxm_local_proc sa_bind_self;
    struct sockaddr_mxm_ib_local sa_bind_rdma;
    struct sockaddr_mxm_shm_proc sa_bind_shm;

    mxm_fill_ep_opts(&ep_opt);

    sa_bind_self.sa_family = AF_MXM_LOCAL_PROC;
    sa_bind_self.context_id = lr;

    sa_bind_rdma.sa_family = AF_MXM_IB_LOCAL;
    sa_bind_rdma.lid = 0;
    sa_bind_rdma.pkey = 0;
    sa_bind_rdma.qp_num = 0;
    sa_bind_rdma.sl = 0;

    sa_bind_shm.sa_family = AF_MXM_SHM_PROC;
    sa_bind_shm.jobid = jobid;
    sa_bind_shm.process_id = lr;
    sa_bind_shm.context_id = mxlr;
    sa_bind_shm.num_procs = nlps;

    ep_opt.ptl_bind_addr[MXM_PTL_SELF] =
            (ptl_bitmap & MXM_BIT(MXM_PTL_SELF)) ?
                    (struct sockaddr*) &sa_bind_self : NULL;
    ep_opt.ptl_bind_addr[MXM_PTL_RDMA] =
            (ptl_bitmap & MXM_BIT(MXM_PTL_RDMA)) ?
                    (struct sockaddr*) &sa_bind_rdma : NULL;
    ep_opt.ptl_bind_addr[MXM_PTL_SHM] =
            (ptl_bitmap & MXM_BIT(MXM_PTL_SHM)) ?
                    (struct sockaddr*) &sa_bind_shm : NULL;

    MXM_VERBOSE(1, "MXM version is old, consider to upgrade");
    err = mxm_ep_create(ctx, &ep_opt, ep);
#elif MXM_API < MXM_VERSION(2,0)
    mxm_ep_opts_t *ep_opts;
    err = mxm_config_read_ep_opts(&ep_opts);
    if (err != MXM_OK) {
        MXM_ERROR("Failed to parse MXM configuration");
        return err;
    }

    ep_opts->job_id          = jobid;
    ep_opts->local_rank      = lr;
    ep_opts->num_local_procs = nlps;
    err = mxm_ep_create(ctx, ep_opts, ep);
    mxm_config_free(ep_opts);
#else
    mxm_ep_opts_t *ep_opts;
    err = mxm_config_read_ep_opts(&ep_opts);
    if (err != MXM_OK) {
        MXM_ERROR("Failed to parse MXM configuration");
        return err;
    }

    err = mxm_ep_create(ctx, ep_opts, ep);
    mxm_config_free_ep_opts(ep_opts);
#endif
    return err;
}
Exemplo n.º 3
0
int mca_pml_yalla_init(void)
{
    mxm_context_opts_t *ctx_opts;
    mxm_ep_opts_t *ep_opts;
    mxm_error_t error;
    int rc;

    PML_YALLA_VERBOSE(1, "mca_pml_yalla_init");

    /* Set memory hooks */
    if ((OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT) ==
        ((OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT) &
         opal_mem_hooks_support_level()))
    {
        PML_YALLA_VERBOSE(1, "enabling on-demand memory mapping");
        opal_setenv("MXM_PML_MEM_ON_DEMAND_MAP", "y", false, &environ);
        ompi_pml_yalla.using_mem_hooks = 1;
    } else {
        PML_YALLA_VERBOSE(1, "disabling on-demand memory mapping");
        ompi_pml_yalla.using_mem_hooks = 0;
    }
    opal_setenv("MXM_PML_SINGLE_THREAD", ompi_mpi_thread_multiple ? "n" : "y",
                false, &environ);

    /* Read options */
    error = mxm_config_read_opts(&ctx_opts, &ep_opts, "PML", NULL, 0);
    if (MXM_OK != error) {
        return OMPI_ERROR;
    }

    error = mxm_init(ctx_opts, &ompi_pml_yalla.mxm_context);
    if (MXM_OK != error) {
        return OMPI_ERROR;
    }

    if (ompi_pml_yalla.using_mem_hooks) {
        opal_mem_hooks_register_release(mca_pml_yalla_mem_release_cb, NULL);
    }

    error = mxm_ep_create(ompi_pml_yalla.mxm_context, ep_opts, &ompi_pml_yalla.mxm_ep);
    if (MXM_OK != error) {
        return OMPI_ERROR;
    }

    mxm_config_free_context_opts(ctx_opts);
    mxm_config_free_ep_opts(ep_opts);

    rc = send_ep_address();
    if (rc < 0) {
        return rc;
    }

    OBJ_CONSTRUCT(&ompi_pml_yalla.send_reqs, mca_pml_yalla_freelist_t);
    OBJ_CONSTRUCT(&ompi_pml_yalla.bsend_reqs, mca_pml_yalla_freelist_t);
    OBJ_CONSTRUCT(&ompi_pml_yalla.recv_reqs, mca_pml_yalla_freelist_t);
    OBJ_CONSTRUCT(&ompi_pml_yalla.convs, mca_pml_yalla_freelist_t);

    opal_progress_register(mca_pml_yalla_progress);

    PML_YALLA_VERBOSE(2, "created mxm context %p ep %p", ompi_pml_yalla.mxm_context,
                      ompi_pml_yalla.mxm_ep);
    return OMPI_SUCCESS;
}