Ejemplo n.º 1
0
int mca_coll_hcoll_progress(void)
{
    if (ompi_mpi_finalized) {
        hcoll_rte_p2p_disabled_notify();
    }

    (*hcoll_progress_fn)();
    return OMPI_SUCCESS;
}
Ejemplo n.º 2
0
int mca_coll_hcoll_progress(void)
{
    opal_list_item_t  *item, *item_next;
    opal_list_t *am;
    mca_coll_hcoll_module_t *module;
    ompi_communicator_t *comm;
    int context_destroyed;
    OPAL_THREAD_ADD32(&mca_coll_hcoll_component.progress_lock,1);

    am = &mca_coll_hcoll_component.active_modules;

    if (mca_coll_hcoll_component.progress_lock){
        OPAL_THREAD_ADD32(&mca_coll_hcoll_component.progress_lock,-1);
        (*hcoll_progress_fn)();
        return OMPI_SUCCESS;
    }
    if (ompi_mpi_finalized){
        hcoll_rte_p2p_disabled_notify();
    }

    item = opal_list_get_first(am);
    while (item != opal_list_get_end(am)){
        item_next = opal_list_get_next(item);
        module = ((mca_coll_hcoll_module_list_item_wrapper_t *)item)->module;
        comm = module->comm;
        if (((opal_object_t*)comm)->obj_reference_count == 1){
            /* Ok, if we are here then nobody owns a communicator pointed with comm except
             * for coll_hcoll. Hence, it is safe to remove the hcoll context firstly and
             * call release on the communicator.
             *
             * The call to hcoll_destroy_context is not blocking. The last parameter on the return
             * indicates whether the context has been destroyd (1) or not (0). In the latter
             * case one should call destroy again after some progressing
             */
            context_destroyed = 0;
            hcoll_destroy_context(module->hcoll_context,
                                  (rte_grp_handle_t)comm,
                                  &context_destroyed);
            if (context_destroyed){
                module->hcoll_context = NULL;
                OBJ_RELEASE(comm);
                opal_list_remove_item(am,item);
                OBJ_RELEASE(item);
            }
        }
        item = item_next;
    }

    (*hcoll_progress_fn)();
    OPAL_THREAD_ADD32(&mca_coll_hcoll_component.progress_lock,-1);
    return OMPI_SUCCESS;
}