Example #1
0
int OSPDI_GlobalBcast_initialize()
{
    int status = OSP_SUCCESS;
    DCMF_GlobalBcast_Configuration_t conf;

    OSPU_FUNC_ENTER();

    conf.protocol = DCMF_DEFAULT_GLOBALBCAST_PROTOCOL;
    status = DCMF_GlobalBcast_register(&OSPD_GlobalBcast_protocol,
                                       &conf);
    OSPU_ERR_POP(status != DCMF_SUCCESS,
                "DCMF_GlobalBcast_register returned with error %d \n",
                status);

    fn_exit:
    OSPU_FUNC_EXIT();
    return status;

    fn_fail:
    goto fn_exit;
}
void gasnete_coll_bcast_proto_register(void)
{
    DCMF_GlobalBcast_Configuration_t gbcast_conf;
    DCMF_Broadcast_Configuration_t bcast_conf;
    DCMF_AsyncBroadcast_Configuration_t a_bcast_conf;

    GASNETC_DCMF_LOCK(); /* for DCMF_SAFE */

    gasnete_use_dcmf_bcast =
        gasneti_getenv_yesno_withdefault("GASNET_USE_DCMF_BCAST", 1);

    /* tree broadcast registration */
    gasnete_dcmf_bcast_enabled[TREE_BROADCAST] =
        gasneti_getenv_yesno_withdefault("GASNET_DCMF_TREE_BCAST", 1);
    if (gasnete_dcmf_bcast_enabled[TREE_BROADCAST])
    {
        gbcast_conf.protocol = DCMF_TREE_GLOBALBCAST_PROTOCOL;
        DCMF_SAFE(DCMF_GlobalBcast_register(&gasnete_dcmf_globalbcast_proto,
                                            &gbcast_conf));
        bcast_conf.protocol = DCMF_TREE_BROADCAST_PROTOCOL;
        DCMF_SAFE(DCMF_Broadcast_register(&gasnete_dcmf_bcast_proto[TREE_BROADCAST],
                                          &bcast_conf));
    }

    /* torus broadcast registration */
    gasnete_dcmf_bcast_enabled[TORUS_RECTANGLE_BROADCAST] =
        gasneti_getenv_yesno_withdefault("GASNET_DCMF_TORUS_RECTANGLE_BCAST", 1);
    if (gasnete_dcmf_bcast_enabled[TORUS_RECTANGLE_BROADCAST])
    {
        bcast_conf.protocol = DCMF_TORUS_RECTANGLE_BROADCAST_PROTOCOL;
        DCMF_SAFE(DCMF_Broadcast_register(&gasnete_dcmf_bcast_proto[TORUS_RECTANGLE_BROADCAST],
                                          &bcast_conf));
    }

    gasnete_dcmf_bcast_enabled[TORUS_BINOMIAL_BROADCAST] =
        gasneti_getenv_yesno_withdefault("GASNET_DCMF_TORUS_BINOMIAL_BCAST", 1);
    if (gasnete_dcmf_bcast_enabled[TORUS_BINOMIAL_BROADCAST])
    {
        bcast_conf.protocol = DCMF_TORUS_BINOMIAL_BROADCAST_PROTOCOL;
        DCMF_SAFE(DCMF_Broadcast_register(&gasnete_dcmf_bcast_proto[TORUS_BINOMIAL_BROADCAST],
                                          &bcast_conf));
    }

    /* asynchronous broadcast registration */
    gasnete_dcmf_bcast_enabled[TORUS_ASYNCBROADCAST_RECTANGLE] =
        gasneti_getenv_yesno_withdefault("GASNET_DCMF_TORUS_ASYNCBROADCAST_RECTANGLE_BCAST", 1);
    if (gasnete_dcmf_bcast_enabled[TORUS_ASYNCBROADCAST_RECTANGLE])
    {
        a_bcast_conf.protocol = DCMF_TORUS_ASYNCBROADCAST_RECTANGLE_PROTOCOL;
        a_bcast_conf.isBuffered = 1;
        a_bcast_conf.cb_geometry = gasnete_dcmf_get_geometry;
        DCMF_SAFE(DCMF_AsyncBroadcast_register(&gasnete_dcmf_bcast_proto[TORUS_ASYNCBROADCAST_RECTANGLE],
                                               &a_bcast_conf));
    }

    gasnete_dcmf_bcast_enabled[TORUS_ASYNCBROADCAST_BINOMIAL] =
        gasneti_getenv_yesno_withdefault("GASNET_DCMF_TORUS_ASYNCBROADCAST_BINOMIAL_BCAST", 1);
    if (gasnete_dcmf_bcast_enabled[TORUS_ASYNCBROADCAST_BINOMIAL])
    {
        a_bcast_conf.protocol = DCMF_TORUS_ASYNCBROADCAST_BINOMIAL_PROTOCOL;
        a_bcast_conf.isBuffered = 1;
        a_bcast_conf.cb_geometry = gasnete_dcmf_get_geometry;
        DCMF_SAFE(DCMF_AsyncBroadcast_register(&gasnete_dcmf_bcast_proto[TORUS_ASYNCBROADCAST_BINOMIAL],
                                               &a_bcast_conf));
    }

    /* number of bcast streams used in the torus rectangle bcast */
    gasnete_dcmf_bcast_num_colors = gasneti_getenv_int_withdefault("GASNET_DCMF_BCAST_NUM_COLORS", 1, 0);
    if (gasnete_dcmf_bcast_num_colors < 1 || gasnete_dcmf_bcast_num_colors > 6)
        gasnete_dcmf_bcast_num_colors = 1;

    GASNETC_DCMF_UNLOCK();
}