1
1

Remove unique_id which wasn't used anymore. Instead use the recv_context which

is set to the cid of the communicator (unique id for each communicator).
Make sure each communicator have a group attached to it. The MPI_COMM_NULL
should have the MPI_GROUP_NULL as a group, in all circumstances.

This commit was SVN r16177.
Этот коммит содержится в:
George Bosilca 2007-09-21 14:30:40 +00:00
родитель d3b376a340
Коммит 8bdd14ba40
2 изменённых файлов: 25 добавлений и 15 удалений

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

@ -259,8 +259,7 @@ enum mqs_status
/* A structure to represent a communicator */ /* A structure to represent a communicator */
typedef struct typedef struct
{ {
mqs_taddr_t unique_id; /* A unique tag for the communicator */ mqs_tword_t local_rank; /* The rank of this process Comm_rank */
mqs_tword_t local_rank; /* The rank of this process Comm_rank */
mqs_tword_t size; /* Comm_size */ mqs_tword_t size; /* Comm_size */
char name[64]; /* the name if it has one */ char name[64]; /* the name if it has one */
} mqs_communicator; } mqs_communicator;

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

@ -367,8 +367,11 @@ static group_t * find_or_create_group( mqs_process *proc,
DEBUG(VERBOSE_GROUP, ("Create a new group 0x%p with %d members\n", DEBUG(VERBOSE_GROUP, ("Create a new group 0x%p with %d members\n",
(void*)group, np) ); (void*)group, np) );
if (mqs_ok != mqs_fetch_data (proc, table, np * p_info->sizes.pointer_size, if( (0 != np) &&
trbuffer) ) { (mqs_ok != mqs_fetch_data(proc, table, np * p_info->sizes.pointer_size,
trbuffer)) ) {
DEBUG(VERBOSE_GROUP,("Failed to read the proc data. Destroy group %p\n",
(void*)group));
mqs_free (group); mqs_free (group);
mqs_free (tr); mqs_free (tr);
mqs_free (trbuffer); mqs_free (trbuffer);
@ -416,8 +419,11 @@ static group_t * find_or_create_group( mqs_process *proc,
/***********************************************************************/ /***********************************************************************/
static void group_decref (group_t * group) static void group_decref (group_t * group)
{ {
DEBUG(VERBOSE_GROUP, ("Decrement reference count for group %p to %d\n", (void*)group,
(group->ref_count - 1)));
if (--(group->ref_count) == 0) { if (--(group->ref_count) == 0) {
mqs_free (group->local_to_global); mqs_free (group->local_to_global);
DEBUG(VERBOSE_GROUP, ("Destroy group %p\n", (void*)group));
mqs_free (group); mqs_free (group);
} }
} /* group_decref */ } /* group_decref */
@ -961,8 +967,8 @@ static int rebuild_communicator_list (mqs_process *proc)
old->recv_context = context_id; old->recv_context = context_id;
old->comm_info.local_rank = local_rank; old->comm_info.local_rank = local_rank;
DEBUG(VERBOSE_COMM,("Create new communicator 0x%llx with context_id %d and local_rank %d\n", DEBUG(VERBOSE_COMM,("Create new communicator 0x%lx with context_id %d and local_rank %d\n",
(long long)old, context_id, local_rank)); (long)old, context_id, local_rank));
/* Now get the information about the group */ /* Now get the information about the group */
group_base = group_base =
fetch_pointer( proc, comm_ptr + i_info->ompi_communicator_t.offset.c_local_group, fetch_pointer( proc, comm_ptr + i_info->ompi_communicator_t.offset.c_local_group,
@ -976,9 +982,10 @@ static int rebuild_communicator_list (mqs_process *proc)
old->comm_info.size = old->group->entries; old->comm_info.size = old->group->entries;
} }
old->present = TRUE; old->present = TRUE;
DEBUG(VERBOSE_COMM,("Communicator 0x%llx %d local_rank %d name %s\n", DEBUG(VERBOSE_COMM,("Communicator 0x%llx %d local_rank %d name %s group %p\n",
(long long)old->comm_ptr, (int)old->comm_info.unique_id, (long long)old->comm_ptr, (int)old->recv_context,
(int)old->comm_info.local_rank, old->comm_info.name)); (int)old->comm_info.local_rank, old->comm_info.name,
(void*)old->group));
} }
/* Now iterate over the list tidying up any communicators which /* Now iterate over the list tidying up any communicators which
@ -986,16 +993,20 @@ static int rebuild_communicator_list (mqs_process *proc)
*/ */
commp = &p_info->communicator_list; commp = &p_info->communicator_list;
commcount = 0; commcount = 0;
while (*commp) { for (; *commp; ) {
communicator_t *comm = *commp; communicator_t *comm = *commp;
if (comm->present) { if (comm->present) {
comm->present = FALSE; comm->present = FALSE;
commcount++; commcount++;
commp = &(*commp)->next; DEBUG(VERBOSE_COMM, ("Keep communicator 0x%llx name %s\n",
(long long)comm->comm_ptr, comm->comm_info.name));
commp = &(*commp)->next; /* go to the next communicator */
} else { /* It needs to be deleted */ } else { /* It needs to be deleted */
*commp = comm->next; /* Remove from the list */ *commp = comm->next; /* Remove from the list, *commp now points to the next */
if (NULL != comm->group) /* comm group can be NULL for MPI_COMM_NULL */ DEBUG(VERBOSE_COMM, ("Remove communicator 0x%llx name %s (group %p)\n",
group_decref (comm->group); /* Group is no longer referenced from here */ (long long)comm->comm_ptr, comm->comm_info.name,
(void*)comm->group));
group_decref (comm->group); /* Group is no longer referenced from here */
mqs_free (comm); mqs_free (comm);
} }
} }
@ -1066,7 +1077,7 @@ int mqs_get_communicator (mqs_process *proc, mqs_communicator *comm)
if (p_info->current_communicator) { if (p_info->current_communicator) {
*comm = p_info->current_communicator->comm_info; *comm = p_info->current_communicator->comm_info;
DEBUG(VERBOSE_COMM,("mqs_get_communicator %d local_rank %d name %s\n", DEBUG(VERBOSE_COMM,("mqs_get_communicator %d local_rank %d name %s\n",
(int)comm->unique_id, (int)comm->local_rank, p_info->current_communicator->recv_context, (int)comm->local_rank,
comm->name)); comm->name));
return mqs_ok; return mqs_ok;
} }