int ompi_win_finalize(void) { size_t size = opal_pointer_array_get_size (&ompi_mpi_windows); /* start at 1 to skip win null */ for (size_t i = 1 ; i < size ; ++i) { ompi_win_t *win = (ompi_win_t *) opal_pointer_array_get_item (&ompi_mpi_windows, i); if (NULL != win) { if (ompi_debug_show_handle_leaks && !ompi_win_invalid(win)){ opal_output(0,"WARNING: MPI_Win still allocated in MPI_Finalize\n"); ompi_win_dump (win); } ompi_win_free (win); } } OBJ_DESTRUCT(&ompi_mpi_win_null.win); OBJ_DESTRUCT(&ompi_mpi_windows); OBJ_RELEASE(ompi_win_accumulate_ops); return OMPI_SUCCESS; }
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; }