1
1

adapting the structure of the comm-creation routines to call ompi_comm_nextcid explicitly.

This commit was SVN r1314.
Этот коммит содержится в:
Edgar Gabriel 2004-06-16 15:41:36 +00:00
родитель c4fb4d7ef4
Коммит 4a15e7ce50
5 изменённых файлов: 93 добавлений и 49 удалений

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

@ -21,7 +21,7 @@ int MPI_Comm_dup(MPI_Comm comm, MPI_Comm *newcomm) {
/* local variables */
ompi_communicator_t *comp, *newcomp;
int rsize, mode;
int rsize, mode, rc=MPI_SUCCESS;
ompi_proc_t **rprocs;
/* argument checking */
@ -51,23 +51,32 @@ int MPI_Comm_dup(MPI_Comm comm, MPI_Comm *newcomm) {
mode = OMPI_COMM_INTRA_INTRA;
}
newcomp = ompi_comm_set ( mode, /* mode */
comp, /* old comm */
NULL, /* bridge comm */
newcomp = ompi_comm_set ( comp, /* old comm */
comp->c_local_group->grp_proc_count, /* local_size */
comp->c_local_group->grp_proc_pointers, /* local_procs*/
rsize, /* remote_size */
rprocs, /* remote_procs */
comp->c_keyhash, /* attrs */
comp->error_handler, /* error handler */
NULL, /* coll module, to be modified */
NULL, /* topo module, to be modified */
MPI_UNDEFINED, /* local leader */
MPI_UNDEFINED /* remote leader */
NULL, /* coll module,t.b.d */
NULL /* topo module, t.b.d */
);
if ( newcomp == MPI_COMM_NULL )
if ( MPI_COMM_NULL == newcomp ) {
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;
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
* world has not been spawned. This is also the return
* value required by MPI-2.
* world has not been spawned by another MPI job.
* This is also the return value required by MPI-2.
* 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;

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

@ -23,6 +23,7 @@ int MPI_Comm_spawn(char *command, char **argv, int maxprocs, MPI_Info info,
int *array_of_errcodes)
{
int rank;
int i;
if ( MPI_PARAM_CHECK ) {
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 */
/* start processes */
/* start processes. if number of processes started != maxprocs
return MPI_ERR_SPAWN.*/
/* publish your name */
/* accept connection from other group.
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
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;
}

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

@ -102,9 +102,7 @@ int MPI_Intercomm_create(MPI_Comm local_comm, int local_leader,
rprocs = ompi_comm_get_rprocs ( local_comm, bridge_comm, local_leader,
remote_leader, tag, rsize );
newcomp = ompi_comm_set ( OMPI_COMM_INTRA_INTER, /* mode */
local_comm, /* old comm */
bridge_comm, /* bridge comm */
newcomp = ompi_comm_set ( local_comm, /* old comm */
local_comm->c_local_group->grp_proc_count, /* local_size */
local_comm->c_local_group->grp_proc_pointers, /* local_procs*/
rsize, /* remote_size */
@ -112,19 +110,29 @@ int MPI_Intercomm_create(MPI_Comm local_comm, int local_leader,
NULL, /* attrs */
local_comm->error_handler, /* error handler*/
NULL, /* coll module */
NULL, /* topo mpodule */
local_leader, /* local leader */
remote_leader /* remote leader */
NULL /* topo mpodule */
);
if ( newcomp == MPI_COMM_NULL ) {
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:
if ( NULL == 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;
return MPI_SUCCESS;

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

@ -28,6 +28,7 @@ int MPI_Intercomm_merge(MPI_Comm intercomm, int high,
int local_rank;
int first;
int total_size;
int rc=MPI_SUCCESS;
if ( MPI_PARAM_CHECK ) {
if ( ompi_mpi_finalized )
@ -67,9 +68,7 @@ int MPI_Intercomm_merge(MPI_Comm intercomm, int high,
local_size * sizeof(ompi_proc_t *));
}
newcomp = ompi_comm_set ( OMPI_COMM_INTER_INTRA, /* mode */
intercomm, /* old comm */
NULL, /* bridge comm */
newcomp = ompi_comm_set ( intercomm, /* old comm */
total_size, /* local_size */
procs, /* local_procs*/
0, /* remote_size */
@ -77,18 +76,34 @@ int MPI_Intercomm_merge(MPI_Comm intercomm, int high,
NULL, /* attrs */
intercomm->error_handler, /* error handler*/
NULL, /* coll module */
NULL, /* topo mpodule */
MPI_UNDEFINED, /* local leader */
MPI_UNDEFINED /* remote leader */
NULL /* topo mpodule */
);
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 ) {
free ( procs );
}
if ( OMPI_SUCCESS != rc ) {
*newcomm = MPI_COMM_NULL;
return OMPI_ERRHANDLER_INVOKE(intercomm, MPI_ERR_INTERN,
"MPI_Intercom_merge");
}
*newcomm = newcomp;
return MPI_SUCCESS;