示例#1
0
int MPI_Win_set_attr(MPI_Win win, int win_keyval, void *attribute_val) 
{
    int ret;

    if (MPI_PARAM_CHECK) {
        OMPI_ERR_INIT_FINALIZE(FUNC_NAME);

        if (ompi_win_invalid(win)) {
	    return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_WIN, FUNC_NAME);
	}
    }

    ret = ompi_attr_set_c(WIN_ATTR, win, &win->w_keyhash, 
                          win_keyval, attribute_val, false, true);
    OMPI_ERRHANDLER_RETURN(ret, win, MPI_ERR_OTHER, FUNC_NAME);  
}
示例#2
0
/*
 * Initialize module on the communicator
 */
static int mca_coll_hcoll_module_enable(mca_coll_base_module_t *module,
                                        struct ompi_communicator_t *comm)
{
    int ret;

    if (OMPI_SUCCESS != mca_coll_hcoll_save_coll_handlers((mca_coll_hcoll_module_t *)module)) {
        HCOL_ERROR("coll_hcol: mca_coll_hcoll_save_coll_handlers failed");
        return OMPI_ERROR;
    }

    ret = ompi_attr_set_c(COMM_ATTR, comm, &comm->c_keyhash, hcoll_comm_attr_keyval, (void *)module, false);
    if (OMPI_SUCCESS != ret) {
        HCOL_VERBOSE(1,"hcoll ompi_attr_set_c failed");
        return OMPI_ERROR;
    }

    return OMPI_SUCCESS;
}
示例#3
0
文件: win.c 项目: anandhis/ompi
static int
config_window(void *base, size_t size, int disp_unit,
              int flavor, int model, ompi_win_t *win)
{
    int ret;

    ret = ompi_attr_set_c(WIN_ATTR, win, &win->w_keyhash,
                          MPI_WIN_BASE, base, true);
    if (OMPI_SUCCESS != ret) return ret;

    ret = ompi_attr_set_aint(WIN_ATTR, win,
                             &win->w_keyhash,
                             MPI_WIN_SIZE, size, true);
    if (OMPI_SUCCESS != ret) return ret;

    ret = ompi_attr_set_int(WIN_ATTR, win,
                            &win->w_keyhash,
                            MPI_WIN_DISP_UNIT, disp_unit,
                            true);
    if (OMPI_SUCCESS != ret) return ret;

    ret = ompi_attr_set_int(WIN_ATTR, win,
                            &win->w_keyhash,
                            MPI_WIN_CREATE_FLAVOR, flavor, true);
    if (OMPI_SUCCESS != ret) return ret;

    ret = ompi_attr_set_int(WIN_ATTR, win,
                            &win->w_keyhash,
                            MPI_WIN_MODEL, model, true);
    if (OMPI_SUCCESS != ret) return ret;

    win->w_f_to_c_index = opal_pointer_array_add(&ompi_mpi_windows, win);
    if (-1 == win->w_f_to_c_index) return OMPI_ERR_OUT_OF_RESOURCE;

    return OMPI_SUCCESS;
}
示例#4
0
int
ompi_win_create(void *base, size_t size,
                int disp_unit, ompi_communicator_t *comm,
                ompi_info_t *info,
                ompi_win_t** newwin)
{
    ompi_win_t *win;
    ompi_group_t *group;
    int ret;

    /* create the object */
    win = OBJ_NEW(ompi_win_t);
    if (NULL == win) return OMPI_ERR_TEMP_OUT_OF_RESOURCE;

    /* setup data that is independent of osc component */
    group = comm->c_local_group;
    OBJ_RETAIN(group);
    ompi_group_increment_proc_count(group);
    win->w_group = group;

    win->w_baseptr = base;
    win->w_size = size;
    win->w_disp_unit = disp_unit;

    /* Fill in required attributes */
    ret = ompi_attr_set_c(WIN_ATTR, win, &win->w_keyhash,
                          MPI_WIN_BASE, win->w_baseptr, true, true);
    if (OMPI_SUCCESS != ret) {
        OBJ_RELEASE(win);
        return ret;
    }
    ret = ompi_attr_set_fortran_mpi2(WIN_ATTR, win,
                                     &win->w_keyhash,
                                     MPI_WIN_SIZE, win->w_size, true, true);
    if (OMPI_SUCCESS != ret) {
        OBJ_RELEASE(win);
        return ret;
    }
    ret = ompi_attr_set_fortran_mpi2(WIN_ATTR, win,
                                     &win->w_keyhash,
                                     MPI_WIN_DISP_UNIT, win->w_disp_unit,
                                     true, true);
    if (OMPI_SUCCESS != ret) {
        OBJ_RELEASE(win);
        return ret;
    }

    /* create backend onesided module for this window */
    ret = ompi_osc_base_select(win, (ompi_info_t*) info, comm);
    if (OMPI_SUCCESS != ret) {
        OBJ_RELEASE(win);
        return ret;
    }

    /* fill in Fortran index */
    win->w_f_to_c_index = ompi_pointer_array_add(&ompi_mpi_windows, win);
    if (-1 == win->w_f_to_c_index) {
        ompi_win_free(win);
        return OMPI_ERR_OUT_OF_RESOURCE;
    }

    *newwin = win;

    return OMPI_SUCCESS;
}