1
1

ompi/group: release ompi_proc_t's at group destruction

This commit changes the way ompi_proc_t's are retained/released by
ompi_group_t's. Before this change ompi_proc_t's were retained once
for the group and then once for each retain of a group. This method
adds unnecessary overhead (need to traverse the group list each time
the group is retained) and causes problems when using an async
add_procs.

Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
Этот коммит содержится в:
Nathan Hjelm 2015-11-30 23:03:47 -07:00
родитель 324534b191
Коммит 5334d22a37
10 изменённых файлов: 5 добавлений и 31 удалений

Просмотреть файл

@ -172,7 +172,6 @@ int ompi_comm_set_nb ( ompi_communicator_t **ncomm,
} else { } else {
newcomm->c_local_group = local_group; newcomm->c_local_group = local_group;
OBJ_RETAIN(newcomm->c_local_group); OBJ_RETAIN(newcomm->c_local_group);
ompi_group_increment_proc_count(newcomm->c_local_group);
} }
newcomm->c_my_rank = newcomm->c_local_group->grp_my_rank; newcomm->c_my_rank = newcomm->c_local_group->grp_my_rank;
@ -189,7 +188,6 @@ int ompi_comm_set_nb ( ompi_communicator_t **ncomm,
} else { } else {
newcomm->c_remote_group = remote_group; newcomm->c_remote_group = remote_group;
OBJ_RETAIN(newcomm->c_remote_group); OBJ_RETAIN(newcomm->c_remote_group);
ompi_group_increment_proc_count(newcomm->c_remote_group);
} }
newcomm->c_flags |= OMPI_COMM_INTER; newcomm->c_flags |= OMPI_COMM_INTER;
@ -256,9 +254,6 @@ int ompi_comm_group ( ompi_communicator_t* comm, ompi_group_t **group )
/* increment reference counters for the group */ /* increment reference counters for the group */
OBJ_RETAIN(comm->c_local_group); OBJ_RETAIN(comm->c_local_group);
/* increase also the reference counter for the procs */
ompi_group_increment_proc_count(comm->c_local_group);
*group = comm->c_local_group; *group = comm->c_local_group;
return OMPI_SUCCESS; return OMPI_SUCCESS;
} }
@ -570,8 +565,6 @@ int ompi_comm_split( ompi_communicator_t* comm, int color, int key,
goto exit; goto exit;
} }
ompi_group_increment_proc_count(local_group);
mode = OMPI_COMM_CID_INTER; mode = OMPI_COMM_CID_INTER;
} else { } else {
rranks = NULL; rranks = NULL;
@ -603,7 +596,6 @@ int ompi_comm_split( ompi_communicator_t* comm, int color, int key,
} }
if ( inter ) { if ( inter ) {
ompi_group_decrement_proc_count (local_group);
OBJ_RELEASE(local_group); OBJ_RELEASE(local_group);
if (NULL != newcomp->c_local_comm) { if (NULL != newcomp->c_local_comm) {
snprintf(newcomp->c_local_comm->c_name, MPI_MAX_OBJECT_NAME, snprintf(newcomp->c_local_comm->c_name, MPI_MAX_OBJECT_NAME,
@ -2006,9 +1998,6 @@ static int ompi_comm_fill_rest(ompi_communicator_t *comm,
comm->c_remote_group = comm->c_local_group; comm->c_remote_group = comm->c_local_group;
OBJ_RETAIN( comm->c_remote_group ); OBJ_RETAIN( comm->c_remote_group );
/* retain these proc pointers */
ompi_group_increment_proc_count(comm->c_local_group);
/* set the rank information */ /* set the rank information */
comm->c_local_group->grp_my_rank = my_rank; comm->c_local_group->grp_my_rank = my_rank;
comm->c_my_rank = my_rank; comm->c_my_rank = my_rank;

Просмотреть файл

@ -425,7 +425,6 @@ static void ompi_comm_destruct(ompi_communicator_t* comm)
} }
if (NULL != comm->c_local_group) { if (NULL != comm->c_local_group) {
ompi_group_decrement_proc_count (comm->c_local_group);
OBJ_RELEASE ( comm->c_local_group ); OBJ_RELEASE ( comm->c_local_group );
comm->c_local_group = NULL; comm->c_local_group = NULL;
if ( OMPI_COMM_IS_INTRA(comm) ) { if ( OMPI_COMM_IS_INTRA(comm) ) {
@ -438,7 +437,6 @@ static void ompi_comm_destruct(ompi_communicator_t* comm)
} }
if (NULL != comm->c_remote_group) { if (NULL != comm->c_remote_group) {
ompi_group_decrement_proc_count (comm->c_remote_group);
OBJ_RELEASE ( comm->c_remote_group ); OBJ_RELEASE ( comm->c_remote_group );
comm->c_remote_group = NULL; comm->c_remote_group = NULL;
} }

Просмотреть файл

@ -441,12 +441,11 @@ int ompi_dpm_connect_accept(ompi_communicator_t *comm, int root,
i=0; i=0;
OPAL_LIST_FOREACH(cd, &rlist, ompi_dpm_proct_caddy_t) { OPAL_LIST_FOREACH(cd, &rlist, ompi_dpm_proct_caddy_t) {
new_group_pointer->grp_proc_pointers[i++] = cd->p; new_group_pointer->grp_proc_pointers[i++] = cd->p;
/* retain the proc */
OBJ_RETAIN(cd->p);
} }
OPAL_LIST_DESTRUCT(&rlist); OPAL_LIST_DESTRUCT(&rlist);
/* increment proc reference counters */
ompi_group_increment_proc_count(new_group_pointer);
/* set up communicator structure */ /* set up communicator structure */
rc = ompi_comm_set ( &newcomp, /* new comm */ rc = ompi_comm_set ( &newcomp, /* new comm */
comm, /* old comm */ comm, /* old comm */
@ -465,7 +464,6 @@ int ompi_dpm_connect_accept(ompi_communicator_t *comm, int root,
goto exit; goto exit;
} }
ompi_group_decrement_proc_count (new_group_pointer);
OBJ_RELEASE(new_group_pointer); OBJ_RELEASE(new_group_pointer);
new_group_pointer = MPI_GROUP_NULL; new_group_pointer = MPI_GROUP_NULL;

Просмотреть файл

@ -37,7 +37,6 @@ int ompi_group_free ( ompi_group_t **group )
ompi_group_t *l_group; ompi_group_t *l_group;
l_group = (ompi_group_t *) *group; l_group = (ompi_group_t *) *group;
ompi_group_decrement_proc_count (l_group);
OBJ_RELEASE(l_group); OBJ_RELEASE(l_group);
*group = MPI_GROUP_NULL; *group = MPI_GROUP_NULL;

Просмотреть файл

@ -266,6 +266,8 @@ static void ompi_group_destruct(ompi_group_t *group)
the proc counts are not increased during the constructor, the proc counts are not increased during the constructor,
either). */ either). */
ompi_group_decrement_proc_count (group);
/* release thegrp_proc_pointers memory */ /* release thegrp_proc_pointers memory */
if (NULL != group->grp_proc_pointers) { if (NULL != group->grp_proc_pointers) {
free(group->grp_proc_pointers); free(group->grp_proc_pointers);

Просмотреть файл

@ -193,7 +193,6 @@ int ompi_osc_rdma_post_atomic (ompi_group_t *group, int assert, ompi_win_t *win)
/* save the group */ /* save the group */
OBJ_RETAIN(group); OBJ_RETAIN(group);
ompi_group_increment_proc_count(group);
OPAL_THREAD_LOCK(&module->lock); OPAL_THREAD_LOCK(&module->lock);
@ -371,7 +370,6 @@ int ompi_osc_rdma_start_atomic (ompi_group_t *group, int assert, ompi_win_t *win
/* save the group */ /* save the group */
OBJ_RETAIN(group); OBJ_RETAIN(group);
ompi_group_increment_proc_count(group);
if (!(assert & MPI_MODE_NOCHECK)) { if (!(assert & MPI_MODE_NOCHECK)) {
/* look through list of pending posts */ /* look through list of pending posts */
@ -440,7 +438,6 @@ int ompi_osc_rdma_complete_atomic (ompi_win_t *win)
sync->epoch_active = false; sync->epoch_active = false;
/* phase 2 cleanup group */ /* phase 2 cleanup group */
ompi_group_decrement_proc_count(group);
OBJ_RELEASE(group); OBJ_RELEASE(group);
peers = sync->peer_list.peers; peers = sync->peer_list.peers;
@ -526,7 +523,6 @@ int ompi_osc_rdma_wait_atomic (ompi_win_t *win)
module->pw_group = NULL; module->pw_group = NULL;
OPAL_THREAD_UNLOCK(&module->lock); OPAL_THREAD_UNLOCK(&module->lock);
ompi_group_decrement_proc_count(group);
OBJ_RELEASE(group); OBJ_RELEASE(group);
OSC_RDMA_VERBOSE(MCA_BASE_VERBOSE_TRACE, "wait complete"); OSC_RDMA_VERBOSE(MCA_BASE_VERBOSE_TRACE, "wait complete");
@ -571,7 +567,6 @@ int ompi_osc_rdma_test_atomic (ompi_win_t *win, int *flag)
module->pw_group = NULL; module->pw_group = NULL;
OPAL_THREAD_UNLOCK(&(module->lock)); OPAL_THREAD_UNLOCK(&(module->lock));
ompi_group_decrement_proc_count(group);
OBJ_RELEASE(group); OBJ_RELEASE(group);
return OMPI_SUCCESS; return OMPI_SUCCESS;

Просмотреть файл

@ -69,6 +69,5 @@ int MPI_Comm_remote_group(MPI_Comm comm, MPI_Group *group)
} }
*group = (MPI_Group) comm->c_remote_group; *group = (MPI_Group) comm->c_remote_group;
ompi_group_increment_proc_count(*group);
return MPI_SUCCESS; return MPI_SUCCESS;
} }

Просмотреть файл

@ -171,10 +171,9 @@ int MPI_Intercomm_create(MPI_Comm local_comm, int local_leader,
/* put group elements in the list */ /* put group elements in the list */
for (j = 0; j < rsize; j++) { for (j = 0; j < rsize; j++) {
new_group_pointer->grp_proc_pointers[j] = rprocs[j]; new_group_pointer->grp_proc_pointers[j] = rprocs[j];
OBJ_RETAIN(rprocs[j]);
} }
ompi_group_increment_proc_count(new_group_pointer);
rc = ompi_comm_set ( &newcomp, /* new comm */ rc = ompi_comm_set ( &newcomp, /* new comm */
local_comm, /* old comm */ local_comm, /* old comm */
local_comm->c_local_group->grp_proc_count, /* local_size */ local_comm->c_local_group->grp_proc_count, /* local_size */
@ -196,7 +195,6 @@ int MPI_Intercomm_create(MPI_Comm local_comm, int local_leader,
goto err_exit; goto err_exit;
} }
ompi_group_decrement_proc_count (new_group_pointer);
OBJ_RELEASE(new_group_pointer); OBJ_RELEASE(new_group_pointer);
new_group_pointer = MPI_GROUP_NULL; new_group_pointer = MPI_GROUP_NULL;

Просмотреть файл

@ -114,7 +114,6 @@ int MPI_Intercomm_merge(MPI_Comm intercomm, int high,
goto exit; goto exit;
} }
ompi_group_decrement_proc_count(new_group_pointer);
OBJ_RELEASE(new_group_pointer); OBJ_RELEASE(new_group_pointer);
new_group_pointer = MPI_GROUP_NULL; new_group_pointer = MPI_GROUP_NULL;

Просмотреть файл

@ -145,7 +145,6 @@ static int alloc_window(struct ompi_communicator_t *comm, ompi_info_t *info, int
/* setup data that is independent of osc component */ /* setup data that is independent of osc component */
group = comm->c_local_group; group = comm->c_local_group;
OBJ_RETAIN(group); OBJ_RETAIN(group);
ompi_group_increment_proc_count(group);
win->w_group = group; win->w_group = group;
*win_out = win; *win_out = win;
@ -366,7 +365,6 @@ ompi_win_get_name(ompi_win_t *win, char *win_name, int *length)
int int
ompi_win_group(ompi_win_t *win, ompi_group_t **group) { ompi_win_group(ompi_win_t *win, ompi_group_t **group) {
OBJ_RETAIN(win->w_group); OBJ_RETAIN(win->w_group);
ompi_group_increment_proc_count(win->w_group);
*group = win->w_group; *group = win->w_group;
return OMPI_SUCCESS; return OMPI_SUCCESS;
@ -406,7 +404,6 @@ ompi_win_destruct(ompi_win_t *win)
} }
if (NULL != win->w_group) { if (NULL != win->w_group) {
ompi_group_decrement_proc_count(win->w_group);
OBJ_RELEASE(win->w_group); OBJ_RELEASE(win->w_group);
} }