1
1
in the v1.2 series the cid's could never go above the max. allowed for a
particular pml. Because of that, pml_add_comm never checked for the cid, and
in fact pml_add_comm was called in comm_set, which is *before* we knew the
cid.

in the v1.3 series (and trunk) we check now the cid to detect overflow, and
because of that pml_add_comm has been moved *after* the cid allocation
routine, namely into the comm_activate routine.

in the v1.2 series, the comm_activate contained a synchronization step of the
old communicator in order to prevent incoming fragments on the new
communicator, with the main problem being that the allreduce in the
communicator allocation finished at different times on different processes,
and thus, this scenario could and did really occur.

in the v1.3 series, the comm_activate does not contain the synchronization
step anymore, since we introduced the new queue for fragments with unknown
cid. The problem is however, that whether a fragment is known or not is
decided by using ompi_comm_lookup(), which will return something useful as
soon as the cid allocation finished, even before pml_add_comm has been
called. So there is a small time gap where we will not post a message into
queue for unknown cid's, but we can also not look up the process structure
belonging to the rank in that comm ( that is in pml_ob1_match_recv_frag or
something like that). 


The current fix reintroduces the synchronization step in comm_activate, and
ensures that no fragment can be received for a new communicator before the
synchronization occurs , and thus comm_nextcid() and pml_add_comm has been
called. It seems to be the safest and easiest way for now. Welcome back, v1.2.

This commit was SVN r21970.
Этот коммит содержится в:
Edgar Gabriel 2009-09-17 14:37:02 +00:00
родитель 98a4450df6
Коммит 9abeaad6e2
6 изменённых файлов: 108 добавлений и 33 удалений

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

@ -350,7 +350,13 @@ int ompi_comm_create ( ompi_communicator_t *comm, ompi_group_t *group,
newcomp->c_contextid, comm->c_contextid );
/* Activate the communicator and init coll-component */
rc = ompi_comm_activate( &newcomp, 1 ); /* new communicator */
rc = ompi_comm_activate( &newcomp, /* new communicator */
comm,
NULL,
NULL,
NULL,
mode,
-1 );
if ( OMPI_SUCCESS != rc ) {
goto exit;
}
@ -573,17 +579,13 @@ int ompi_comm_split ( ompi_communicator_t* comm, int color, int key,
newcomp->c_contextid, comm->c_contextid );
/* Activate the communicator and init coll-component */
if ( MPI_UNDEFINED != color ) {
rc = ompi_comm_activate( &newcomp, 1 ); /* new communicator */
}
else {
/*
** this should prevent creating the subcommunicators
** of the hierarch module for the cases where we
** know that they will be freed anyway (e.g. color = MPI_UNDEFINED
*/
rc = ompi_comm_activate( &newcomp, 0 ); /* new communicator */
}
rc = ompi_comm_activate( &newcomp, /* new communicator */
comm,
NULL,
NULL,
NULL,
mode,
-1 );
if ( OMPI_SUCCESS != rc ) {
goto exit;
}
@ -674,7 +676,13 @@ int ompi_comm_dup ( ompi_communicator_t * comm, ompi_communicator_t **newcomm )
newcomp->c_contextid, comm->c_contextid );
/* activate communicator and init coll-module */
rc = ompi_comm_activate( &newcomp, 1 ); /* new communicator */
rc = ompi_comm_activate( &newcomp, /* new communicator */
comp,
NULL,
NULL,
NULL,
mode,
-1 );
if ( OMPI_SUCCESS != rc ) {
return rc;
}
@ -1511,12 +1519,15 @@ int ompi_topo_create (ompi_communicator_t *old_comm,
return ret;
}
if ( MPI_UNDEFINED != new_rank ) {
ret = ompi_comm_activate( &new_comm, 1 ); /* new communicator */
}
else {
ret = ompi_comm_activate( &new_comm, 0 ); /* new communicator */
}
ret = ompi_comm_activate( &new_comm, /* new communicator */
old_comm, /* old comm */
NULL, /* bridge comm */
NULL, /* local leader */
NULL, /* remote_leader */
OMPI_COMM_CID_INTRA, /* mode */
-1 ); /* send first, doesn't matter */
if (OMPI_SUCCESS != ret) {
/* something wrong happened during setting the communicator */
*comm_topo = new_comm;

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

@ -473,10 +473,56 @@ static uint32_t ompi_comm_lowest_cid (void)
* comm.c is, that this file contains the allreduce implementations
* which are required, and thus we avoid having duplicate code...
*/
int ompi_comm_activate ( ompi_communicator_t** newcomm, int do_coll_select )
int ompi_comm_activate ( ompi_communicator_t** newcomm,
ompi_communicator_t* comm,
ompi_communicator_t* bridgecomm,
void* local_leader,
void* remote_leader,
int mode,
int send_first )
{
int ret = 0;
int ok=0, gok=0;
ompi_comm_cid_allredfct* allredfnct;
/* Step 1: the barrier, after which it is allowed to
* send messages over the new communicator
*/
switch (mode)
{
case OMPI_COMM_CID_INTRA:
allredfnct=(ompi_comm_cid_allredfct*)ompi_comm_allreduce_intra;
break;
case OMPI_COMM_CID_INTER:
allredfnct=(ompi_comm_cid_allredfct*)ompi_comm_allreduce_inter;
break;
case OMPI_COMM_CID_INTRA_BRIDGE:
allredfnct=(ompi_comm_cid_allredfct*)ompi_comm_allreduce_intra_bridge;
break;
case OMPI_COMM_CID_INTRA_OOB:
allredfnct=(ompi_comm_cid_allredfct*)ompi_comm_allreduce_intra_oob;
break;
default:
return MPI_UNDEFINED;
break;
}
if (MPI_UNDEFINED != (*newcomm)->c_local_group->grp_my_rank) {
/* Initialize the PML stuff in the newcomm */
if ( OMPI_SUCCESS != (ret = MCA_PML_CALL(add_comm(*newcomm))) ) {
goto bail_on_error;
}
OMPI_COMM_SET_PML_ADDED(*newcomm);
}
(allredfnct)(&ok, &gok, 1, MPI_MIN, comm, bridgecomm,
local_leader, remote_leader, send_first );
/**
* Check to see if this process is in the new communicator.
*
@ -504,18 +550,11 @@ int ompi_comm_activate ( ompi_communicator_t** newcomm, int do_coll_select )
if (MPI_UNDEFINED == (*newcomm)->c_local_group->grp_my_rank) {
return OMPI_SUCCESS;
}
/* Initialize the PML stuff in the newcomm */
if ( OMPI_SUCCESS != (ret = MCA_PML_CALL(add_comm(*newcomm))) ) {
goto bail_on_error;
}
OMPI_COMM_SET_PML_ADDED(*newcomm);
/* Let the collectives components fight over who will do
collective on this new comm. */
if ( do_coll_select ) {
if (OMPI_SUCCESS != (ret = mca_coll_base_comm_select(*newcomm))) {
goto bail_on_error;
}
if (OMPI_SUCCESS != (ret = mca_coll_base_comm_select(*newcomm))) {
goto bail_on_error;
}
return OMPI_SUCCESS;

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

@ -482,7 +482,14 @@ int ompi_comm_determine_first ( ompi_communicator_t *intercomm,
int high );
OMPI_DECLSPEC int ompi_comm_activate ( ompi_communicator_t** newcomm, int do_coll_select );
OMPI_DECLSPEC int ompi_comm_activate ( ompi_communicator_t** newcomm,
ompi_communicator_t* comm,
ompi_communicator_t* bridgecomm,
void* local_leader,
void* remote_leader,
int mode,
int send_first );
/**
* a simple function to dump the structure

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

@ -441,7 +441,13 @@ static int connect_accept ( ompi_communicator_t *comm, int root,
}
/* activate comm and init coll-component */
rc = ompi_comm_activate ( &newcomp, 1 ); /* new communicator */
rc = ompi_comm_activate ( &newcomp, /* new communicator */
comm, /* old communicator */
NULL, /* bridge comm */
&root, /* local leader */
&carport, /* remote leader */
OMPI_COMM_CID_INTRA_OOB, /* mode */
send_first ); /* send or recv first */
if ( OMPI_SUCCESS != rc ) {
goto exit;
}

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

@ -212,7 +212,13 @@ int MPI_Intercomm_create(MPI_Comm local_comm, int local_leader,
}
/* activate comm and init coll-module */
rc = ompi_comm_activate ( &newcomp, 1 );
rc = ompi_comm_activate ( &newcomp,
local_comm, /* old comm */
bridge_comm, /* bridge comm */
&lleader, /* local leader */
&rleader, /* remote_leader */
OMPI_COMM_CID_INTRA_BRIDGE, /* mode */
-1 ); /* send_first */
if ( MPI_SUCCESS != rc ) {
goto err_exit;
}

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

@ -132,7 +132,13 @@ int MPI_Intercomm_merge(MPI_Comm intercomm, int high,
}
/* activate communicator and init coll-module */
rc = ompi_comm_activate( &newcomp, 1 ); /* new comm */
rc = ompi_comm_activate( &newcomp, /* new comm */
intercomm, /* old comm */
NULL, /* bridge comm */
NULL, /* local leader */
NULL, /* remote_leader */
OMPI_COMM_CID_INTER, /* mode */
-1 ); /* send_first */
if ( OMPI_SUCCESS != rc ) {
goto exit;
}