adapting the structure of the comm-creation routines to call ompi_comm_nextcid explicitly.
This commit was SVN r1314.
Этот коммит содержится в:
родитель
c4fb4d7ef4
Коммит
4a15e7ce50
@ -21,7 +21,7 @@ int MPI_Comm_dup(MPI_Comm comm, MPI_Comm *newcomm) {
|
|||||||
|
|
||||||
/* local variables */
|
/* local variables */
|
||||||
ompi_communicator_t *comp, *newcomp;
|
ompi_communicator_t *comp, *newcomp;
|
||||||
int rsize, mode;
|
int rsize, mode, rc=MPI_SUCCESS;
|
||||||
ompi_proc_t **rprocs;
|
ompi_proc_t **rprocs;
|
||||||
|
|
||||||
/* argument checking */
|
/* argument checking */
|
||||||
@ -51,24 +51,33 @@ int MPI_Comm_dup(MPI_Comm comm, MPI_Comm *newcomm) {
|
|||||||
mode = OMPI_COMM_INTRA_INTRA;
|
mode = OMPI_COMM_INTRA_INTRA;
|
||||||
}
|
}
|
||||||
|
|
||||||
newcomp = ompi_comm_set ( mode, /* mode */
|
newcomp = ompi_comm_set ( comp, /* old comm */
|
||||||
comp, /* old comm */
|
comp->c_local_group->grp_proc_count, /* local_size */
|
||||||
NULL, /* bridge comm */
|
comp->c_local_group->grp_proc_pointers, /* local_procs*/
|
||||||
comp->c_local_group->grp_proc_count, /* local_size */
|
rsize, /* remote_size */
|
||||||
comp->c_local_group->grp_proc_pointers, /* local_procs*/
|
rprocs, /* remote_procs */
|
||||||
rsize, /* remote_size */
|
comp->c_keyhash, /* attrs */
|
||||||
rprocs, /* remote_procs */
|
comp->error_handler, /* error handler */
|
||||||
comp->c_keyhash, /* attrs */
|
NULL, /* coll module,t.b.d */
|
||||||
comp->error_handler, /* error handler */
|
NULL /* topo module, t.b.d */
|
||||||
NULL, /* coll module, to be modified */
|
|
||||||
NULL, /* topo module, to be modified */
|
|
||||||
MPI_UNDEFINED, /* local leader */
|
|
||||||
MPI_UNDEFINED /* remote leader */
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( newcomp == MPI_COMM_NULL )
|
if ( MPI_COMM_NULL == newcomp ) {
|
||||||
OMPI_ERRHANDLER_INVOKE (comm, MPI_ERR_INTERN, "MPI_Comm_dup");
|
OMPI_ERRHANDLER_INVOKE (comm, MPI_ERR_INTERN, "MPI_Comm_dup");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Determine context id. It is identical to f_2_c_handle */
|
||||||
|
rc = ompi_comm_nextcid ( newcomp, /* new communicator */
|
||||||
|
comp, /* old comm */
|
||||||
|
NULL, /* bridge comm */
|
||||||
|
MPI_UNDEFINED, /* local leader */
|
||||||
|
MPI_UNDEFINED, /* remote_leader */
|
||||||
|
mode ); /* mode */
|
||||||
|
if ( OMPI_SUCCESS != rc ) {
|
||||||
|
*newcomm = MPI_COMM_NULL;
|
||||||
|
OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_INTERN, "MPI_Comm_dup");
|
||||||
|
}
|
||||||
|
|
||||||
*newcomm = newcomp;
|
*newcomm = newcomp;
|
||||||
return ( MPI_SUCCESS );
|
return ( MPI_SUCCESS );
|
||||||
}
|
}
|
||||||
|
@ -30,10 +30,14 @@ int MPI_Comm_get_parent(MPI_Comm *parent)
|
|||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* ompi_mpi_comm_parent is MPI_COMM_NULL, in case this
|
* ompi_mpi_comm_parent is MPI_COMM_NULL, in case this
|
||||||
* world has not been spawned. This is also the return
|
* world has not been spawned by another MPI job.
|
||||||
* value required by MPI-2.
|
* This is also the return value required by MPI-2.
|
||||||
|
|
||||||
*parent = &ompi_mpi_comm_parent;
|
* check whether ompi_mpi_comm_parent has been disconnected.
|
||||||
|
if it has not been
|
||||||
|
*parent = &ompi_mpi_comm_parent;
|
||||||
|
else
|
||||||
|
*parent = &ompi_mpi_comm_null;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return MPI_SUCCESS;
|
return MPI_SUCCESS;
|
||||||
|
@ -23,6 +23,7 @@ int MPI_Comm_spawn(char *command, char **argv, int maxprocs, MPI_Info info,
|
|||||||
int *array_of_errcodes)
|
int *array_of_errcodes)
|
||||||
{
|
{
|
||||||
int rank;
|
int rank;
|
||||||
|
int i;
|
||||||
|
|
||||||
if ( MPI_PARAM_CHECK ) {
|
if ( MPI_PARAM_CHECK ) {
|
||||||
if ( ompi_mpi_finalized )
|
if ( ompi_mpi_finalized )
|
||||||
@ -76,7 +77,8 @@ int MPI_Comm_spawn(char *command, char **argv, int maxprocs, MPI_Info info,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* map potentially MPI_ARGV_NULL to the value required by the start-cmd */
|
/* map potentially MPI_ARGV_NULL to the value required by the start-cmd */
|
||||||
/* start processes */
|
/* start processes. if number of processes started != maxprocs
|
||||||
|
return MPI_ERR_SPAWN.*/
|
||||||
/* publish your name */
|
/* publish your name */
|
||||||
/* accept connection from other group.
|
/* accept connection from other group.
|
||||||
Root in the new application is rank 0 in their COMM_WORLD ? */
|
Root in the new application is rank 0 in their COMM_WORLD ? */
|
||||||
@ -94,7 +96,13 @@ int MPI_Comm_spawn(char *command, char **argv, int maxprocs, MPI_Info info,
|
|||||||
to enable the usage of fast communication devices
|
to enable the usage of fast communication devices
|
||||||
between the two worlds ? */
|
between the two worlds ? */
|
||||||
|
|
||||||
/* set array of errorcodes */
|
/* set error codes
|
||||||
|
if (MPI_ERRCODES_IGNORE != array_of_errcodes) {
|
||||||
|
for ( i=0; i < maxprocs; i++ ) {
|
||||||
|
array_of_errcodes[i]=MPI_SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
return MPI_SUCCESS;
|
return MPI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -102,29 +102,37 @@ int MPI_Intercomm_create(MPI_Comm local_comm, int local_leader,
|
|||||||
|
|
||||||
rprocs = ompi_comm_get_rprocs ( local_comm, bridge_comm, local_leader,
|
rprocs = ompi_comm_get_rprocs ( local_comm, bridge_comm, local_leader,
|
||||||
remote_leader, tag, rsize );
|
remote_leader, tag, rsize );
|
||||||
newcomp = ompi_comm_set ( OMPI_COMM_INTRA_INTER, /* mode */
|
newcomp = ompi_comm_set ( local_comm, /* old comm */
|
||||||
local_comm, /* old comm */
|
local_comm->c_local_group->grp_proc_count, /* local_size */
|
||||||
bridge_comm, /* bridge comm */
|
local_comm->c_local_group->grp_proc_pointers, /* local_procs*/
|
||||||
local_comm->c_local_group->grp_proc_count, /* local_size */
|
rsize, /* remote_size */
|
||||||
local_comm->c_local_group->grp_proc_pointers, /* local_procs*/
|
rprocs, /* remote_procs */
|
||||||
rsize, /* remote_size */
|
NULL, /* attrs */
|
||||||
rprocs, /* remote_procs */
|
local_comm->error_handler, /* error handler*/
|
||||||
NULL, /* attrs */
|
NULL, /* coll module */
|
||||||
local_comm->error_handler, /* error handler*/
|
NULL /* topo mpodule */
|
||||||
NULL, /* coll module */
|
);
|
||||||
NULL, /* topo mpodule */
|
|
||||||
local_leader, /* local leader */
|
|
||||||
remote_leader /* remote leader */
|
|
||||||
);
|
|
||||||
|
|
||||||
if ( newcomp == MPI_COMM_NULL ) {
|
if ( newcomp == MPI_COMM_NULL ) {
|
||||||
return OMPI_ERRHANDLER_INVOKE (local_comm, MPI_ERR_INTERN, "MPI_Intercomm_create");
|
return OMPI_ERRHANDLER_INVOKE (local_comm, MPI_ERR_INTERN, "MPI_Intercomm_create");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Determine context id. It is identical to f_2_c_handle */
|
||||||
|
rc = ompi_comm_nextcid ( newcomp, /* new comm */
|
||||||
|
local_comm, /* old comm */
|
||||||
|
bridge_comm, /* bridge comm */
|
||||||
|
local_leader, /* local leader */
|
||||||
|
remote_leader, /* remote_leader */
|
||||||
|
OMPI_COMM_INTRA_INTER); /* mode */
|
||||||
err_exit:
|
err_exit:
|
||||||
if ( NULL == rprocs ) {
|
if ( NULL == rprocs ) {
|
||||||
free ( rprocs );
|
free ( rprocs );
|
||||||
}
|
}
|
||||||
|
if ( OMPI_SUCCESS != rc ) {
|
||||||
|
*newintercomm = MPI_COMM_NULL;
|
||||||
|
return OMPI_ERRHANDLER_INVOKE(local_comm, MPI_ERR_INTERN,
|
||||||
|
"MPI_Intercom_create");
|
||||||
|
}
|
||||||
|
|
||||||
*newintercomm = newcomp;
|
*newintercomm = newcomp;
|
||||||
return MPI_SUCCESS;
|
return MPI_SUCCESS;
|
||||||
|
@ -28,6 +28,7 @@ int MPI_Intercomm_merge(MPI_Comm intercomm, int high,
|
|||||||
int local_rank;
|
int local_rank;
|
||||||
int first;
|
int first;
|
||||||
int total_size;
|
int total_size;
|
||||||
|
int rc=MPI_SUCCESS;
|
||||||
|
|
||||||
if ( MPI_PARAM_CHECK ) {
|
if ( MPI_PARAM_CHECK ) {
|
||||||
if ( ompi_mpi_finalized )
|
if ( ompi_mpi_finalized )
|
||||||
@ -67,28 +68,42 @@ int MPI_Intercomm_merge(MPI_Comm intercomm, int high,
|
|||||||
local_size * sizeof(ompi_proc_t *));
|
local_size * sizeof(ompi_proc_t *));
|
||||||
}
|
}
|
||||||
|
|
||||||
newcomp = ompi_comm_set ( OMPI_COMM_INTER_INTRA, /* mode */
|
newcomp = ompi_comm_set ( intercomm, /* old comm */
|
||||||
intercomm, /* old comm */
|
total_size, /* local_size */
|
||||||
NULL, /* bridge comm */
|
procs, /* local_procs*/
|
||||||
total_size, /* local_size */
|
0, /* remote_size */
|
||||||
procs, /* local_procs*/
|
NULL, /* remote_procs */
|
||||||
0, /* remote_size */
|
NULL, /* attrs */
|
||||||
NULL, /* remote_procs */
|
intercomm->error_handler, /* error handler*/
|
||||||
NULL, /* attrs */
|
NULL, /* coll module */
|
||||||
intercomm->error_handler, /* error handler*/
|
NULL /* topo mpodule */
|
||||||
NULL, /* coll module */
|
);
|
||||||
NULL, /* topo mpodule */
|
|
||||||
MPI_UNDEFINED, /* local leader */
|
|
||||||
MPI_UNDEFINED /* remote leader */
|
|
||||||
);
|
|
||||||
|
|
||||||
if ( newcomp == MPI_COMM_NULL ) {
|
if ( newcomp == MPI_COMM_NULL ) {
|
||||||
return OMPI_ERRHANDLER_INVOKE (intercomm, MPI_ERR_INTERN, "MPI_Intercomm_merge");
|
return OMPI_ERRHANDLER_INVOKE (intercomm, MPI_ERR_INTERN,
|
||||||
|
"MPI_Intercomm_merge");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Determine context id. It is identical to f_2_c_handle */
|
||||||
|
rc = ompi_comm_nextcid ( newcomp, /* new comm */
|
||||||
|
intercomm, /* old comm */
|
||||||
|
NULL, /* bridge comm */
|
||||||
|
MPI_UNDEFINED, /* local leader */
|
||||||
|
MPI_UNDEFINED, /* remote_leader */
|
||||||
|
OMPI_COMM_INTER_INTRA); /* mode */
|
||||||
|
if ( OMPI_SUCCESS != rc ) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
exit:
|
||||||
if ( NULL != procs ) {
|
if ( NULL != procs ) {
|
||||||
free ( procs );
|
free ( procs );
|
||||||
}
|
}
|
||||||
|
if ( OMPI_SUCCESS != rc ) {
|
||||||
|
*newcomm = MPI_COMM_NULL;
|
||||||
|
return OMPI_ERRHANDLER_INVOKE(intercomm, MPI_ERR_INTERN,
|
||||||
|
"MPI_Intercom_merge");
|
||||||
|
}
|
||||||
|
|
||||||
*newcomm = newcomp;
|
*newcomm = newcomp;
|
||||||
return MPI_SUCCESS;
|
return MPI_SUCCESS;
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user