extracting the creation of comm_cid from the comm_set routine.
The reason is, that we had to pass four arguments to comm_sdet, which were just passed to comm_cid. However, for the dynamic case, even these four arguments are not enough. So I extracted it. A typical sequence for a comm-creation will therefore be: newcomm = ompi_comm_set (...); ompi_comm_nextcid (newcomm, oldcomm,...); This commit was SVN r1312.
Этот коммит содержится в:
родитель
2eb37a7c43
Коммит
f8294ab099
@ -51,20 +51,15 @@ static int ompi_comm_allgather_emulate_intra (void* inbuf, int incount, MPI_Data
|
|||||||
* This is the function setting all elements of a communicator.
|
* This is the function setting all elements of a communicator.
|
||||||
* All other routines are just used to determine these elements.
|
* All other routines are just used to determine these elements.
|
||||||
*/
|
*/
|
||||||
ompi_communicator_t * ompi_comm_set ( int mode,
|
ompi_communicator_t * ompi_comm_set ( ompi_communicator_t* oldcomm,
|
||||||
ompi_communicator_t* oldcomm,
|
int local_size,
|
||||||
ompi_communicator_t* bridgecomm,
|
ompi_proc_t **local_procs,
|
||||||
int local_size,
|
int remote_size,
|
||||||
ompi_proc_t **local_procs,
|
ompi_proc_t **remote_procs,
|
||||||
int remote_size,
|
ompi_hash_table_t *attr,
|
||||||
ompi_proc_t **remote_procs,
|
ompi_errhandler_t *errh,
|
||||||
ompi_hash_table_t *attr,
|
mca_base_module_t *collmodule,
|
||||||
ompi_errhandler_t *errh,
|
mca_base_module_t *topomodule )
|
||||||
mca_base_module_t *collmodule,
|
|
||||||
mca_base_module_t *topomodule,
|
|
||||||
int local_leader,
|
|
||||||
int remote_leader
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
ompi_communicator_t *newcomm;
|
ompi_communicator_t *newcomm;
|
||||||
ompi_proc_t *my_gpointer;
|
ompi_proc_t *my_gpointer;
|
||||||
@ -93,21 +88,6 @@ ompi_communicator_t * ompi_comm_set ( int mode,
|
|||||||
newcomm->c_flags |= OMPI_COMM_INTER;
|
newcomm->c_flags |= OMPI_COMM_INTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Determine context id. It is identical to f_2_c_handle */
|
|
||||||
#ifdef HAVE_COLLECTIVES
|
|
||||||
newcomm->c_contextid = ompi_comm_nextcid ( oldcomm,
|
|
||||||
bridgecomm,
|
|
||||||
local_leader,
|
|
||||||
remote_leader,
|
|
||||||
mode );
|
|
||||||
#else
|
|
||||||
/* just for now */
|
|
||||||
newcomm->c_contextid = oldcomm->c_contextid + 10;
|
|
||||||
ompi_pointer_array_set_item ( &ompi_mpi_communicators, newcomm->c_contextid,
|
|
||||||
newcomm );
|
|
||||||
#endif
|
|
||||||
newcomm->c_f_to_c_index = newcomm->c_contextid;
|
|
||||||
|
|
||||||
/* Set error handler */
|
/* Set error handler */
|
||||||
newcomm->error_handler = errh;
|
newcomm->error_handler = errh;
|
||||||
OBJ_RETAIN ( newcomm->error_handler );
|
OBJ_RETAIN ( newcomm->error_handler );
|
||||||
@ -257,26 +237,33 @@ int ompi_comm_create ( ompi_communicator_t *comm, ompi_group_t *group,
|
|||||||
mode = OMPI_COMM_INTRA_INTRA;
|
mode = OMPI_COMM_INTRA_INTRA;
|
||||||
}
|
}
|
||||||
|
|
||||||
newcomp = ompi_comm_set ( mode, /* mode */
|
newcomp = ompi_comm_set ( comm, /* old comm */
|
||||||
comm, /* old comm */
|
group->grp_proc_count, /* local_size */
|
||||||
NULL, /* bridge comm */
|
group->grp_proc_pointers, /* local_procs*/
|
||||||
group->grp_proc_count, /* local_size */
|
rsize, /* remote_size */
|
||||||
group->grp_proc_pointers, /* local_procs*/
|
rprocs, /* remote_procs */
|
||||||
rsize, /* remote_size */
|
NULL, /* attrs */
|
||||||
rprocs, /* remote_procs */
|
comm->error_handler, /* error handler */
|
||||||
NULL, /* attrs */
|
NULL, /* coll module */
|
||||||
comm->error_handler, /* error handler */
|
NULL /* topo module */
|
||||||
NULL, /* coll module */
|
);
|
||||||
NULL, /* topo module */
|
|
||||||
MPI_UNDEFINED, /* local leader */
|
|
||||||
MPI_UNDEFINED /* remote leader */
|
|
||||||
);
|
|
||||||
|
|
||||||
if ( newcomp == MPI_COMM_NULL ) {
|
if ( MPI_COMM_NULL == newcomp ) {
|
||||||
rc = MPI_ERR_INTERN;
|
rc = MPI_ERR_INTERN;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Determine context id. It is identical to f_2_c_handle */
|
||||||
|
rc = ompi_comm_nextcid ( newcomp, /* new communicator */
|
||||||
|
comm, /* old comm */
|
||||||
|
NULL, /* bridge comm */
|
||||||
|
MPI_UNDEFINED, /* local leader */
|
||||||
|
MPI_UNDEFINED, /* remote_leader */
|
||||||
|
mode ); /* mode */
|
||||||
|
if ( OMPI_SUCCESS != rc ) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
/* Check whether we are part of the new comm.
|
/* Check whether we are part of the new comm.
|
||||||
If not, we have to free the structure again.
|
If not, we have to free the structure again.
|
||||||
However, we could not avoid the comm_nextcid step, since
|
However, we could not avoid the comm_nextcid step, since
|
||||||
@ -463,21 +450,31 @@ int ompi_comm_split ( ompi_communicator_t* comm, int color, int key,
|
|||||||
/* Step 3: set up the communicator */
|
/* Step 3: set up the communicator */
|
||||||
/* --------------------------------------------------------- */
|
/* --------------------------------------------------------- */
|
||||||
/* Create the communicator finally */
|
/* Create the communicator finally */
|
||||||
newcomp = ompi_comm_set ( mode, /* mode */
|
newcomp = ompi_comm_set ( comm, /* old comm */
|
||||||
comm, /* old comm */
|
my_size, /* local_size */
|
||||||
NULL, /* bridge comm */
|
procs, /* local_procs*/
|
||||||
my_size, /* local_size */
|
my_rsize, /* remote_size */
|
||||||
procs, /* local_procs*/
|
rprocs, /* remote_procs */
|
||||||
my_rsize, /* remote_size */
|
NULL, /* attrs */
|
||||||
rprocs, /* remote_procs */
|
comm->error_handler,/* error handler */
|
||||||
NULL, /* attrs */
|
NULL, /* coll module */
|
||||||
comm->error_handler,/* error handler */
|
NULL /* topo module */
|
||||||
NULL, /* coll module */
|
);
|
||||||
NULL, /* topo module */
|
if ( MPI_COMM_NULL == newcomp ) {
|
||||||
MPI_UNDEFINED, /* local leader */
|
rc = MPI_ERR_INTERN;
|
||||||
MPI_UNDEFINED /* remote leader */
|
goto exit;
|
||||||
);
|
}
|
||||||
if ( MPI_COMM_NULL == newcomp ) rc = MPI_ERR_INTERN;
|
|
||||||
|
/* Determine context id. It is identical to f_2_c_handle */
|
||||||
|
rc = ompi_comm_nextcid ( newcomp, /* new communicator */
|
||||||
|
comm, /* old comm */
|
||||||
|
NULL, /* bridge comm */
|
||||||
|
MPI_UNDEFINED, /* local leader */
|
||||||
|
MPI_UNDEFINED, /* remote_leader */
|
||||||
|
mode ); /* mode */
|
||||||
|
if ( OMPI_SUCCESS != rc ) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
if ( NULL != results ) {
|
if ( NULL != results ) {
|
||||||
|
@ -21,7 +21,23 @@
|
|||||||
#define OMPI_COMM_CID_TAG 1011
|
#define OMPI_COMM_CID_TAG 1011
|
||||||
#define OMPI_MAX_COMM 32768
|
#define OMPI_MAX_COMM 32768
|
||||||
|
|
||||||
|
#ifndef HAVE_COLLECTIVES
|
||||||
|
int ompi_comm_nextcid ( ompi_communicator_t* newcomm,
|
||||||
|
ompi_communicator_t* comm,
|
||||||
|
ompi_communicator_t* bridgecomm,
|
||||||
|
int local_leader,
|
||||||
|
int remote_leader,
|
||||||
|
int mode )
|
||||||
|
{
|
||||||
|
/* set the according values to the newcomm */
|
||||||
|
newcomm->c_contextid = comm->c_contextid + 10;
|
||||||
|
ompi_pointer_array_set_item (&ompi_mpi_communicators,
|
||||||
|
newcomm->c_contextid,
|
||||||
|
newcomm);
|
||||||
|
|
||||||
|
return ( MPI_SUCCESS );
|
||||||
|
}
|
||||||
|
#else
|
||||||
/**
|
/**
|
||||||
* These functions make sure, that we determine the global result over
|
* These functions make sure, that we determine the global result over
|
||||||
* an intra communicators (simple), an inter-communicator and a
|
* an intra communicators (simple), an inter-communicator and a
|
||||||
@ -50,11 +66,12 @@ static int ompi_comm_allreduce_intra ( int *inbuf, int* outbuf, int count,
|
|||||||
int local_leader, int remote_ledaer );
|
int local_leader, int remote_ledaer );
|
||||||
|
|
||||||
|
|
||||||
int ompi_comm_nextcid ( ompi_communicator_t* comm,
|
int ompi_comm_nextcid ( ompi_communicator_t* newcomm,
|
||||||
ompi_communicator_t* bridgecomm,
|
ompi_communicator_t* comm,
|
||||||
int local_leader,
|
ompi_communicator_t* bridgecomm,
|
||||||
int remote_leader,
|
int local_leader,
|
||||||
int mode )
|
int remote_leader,
|
||||||
|
int mode )
|
||||||
{
|
{
|
||||||
|
|
||||||
int nextlocal_cid;
|
int nextlocal_cid;
|
||||||
@ -127,7 +144,11 @@ int ompi_comm_nextcid ( ompi_communicator_t* comm,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (nextcid);
|
/* set the according values to the newcomm */
|
||||||
|
newcomm->c_contextid = nextcid;
|
||||||
|
ompi_pointer_array_set_item (&ompi_mpi_communicators, nextcid, newcomm);
|
||||||
|
|
||||||
|
return (MPI_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************************/
|
/********************************************************************************/
|
||||||
@ -353,4 +374,4 @@ static int ompi_comm_allreduce_emulate_inter (int *inbuf, int *outbuf, int count
|
|||||||
return (rc);
|
return (rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -25,15 +25,16 @@ ompi_pointer_array_t ompi_mpi_communicators;
|
|||||||
ompi_communicator_t ompi_mpi_comm_world;
|
ompi_communicator_t ompi_mpi_comm_world;
|
||||||
ompi_communicator_t ompi_mpi_comm_self;
|
ompi_communicator_t ompi_mpi_comm_self;
|
||||||
ompi_communicator_t ompi_mpi_comm_null;
|
ompi_communicator_t ompi_mpi_comm_null;
|
||||||
|
ompi_communicator_t *ompi_mpi_comm_parent;
|
||||||
|
|
||||||
static void ompi_comm_construct(ompi_communicator_t* comm);
|
static void ompi_comm_construct(ompi_communicator_t* comm);
|
||||||
static void ompi_comm_destruct(ompi_communicator_t* comm);
|
static void ompi_comm_destruct(ompi_communicator_t* comm);
|
||||||
|
|
||||||
OBJ_CLASS_INSTANCE(ompi_communicator_t, ompi_object_t,ompi_comm_construct, ompi_comm_destruct );
|
OBJ_CLASS_INSTANCE(ompi_communicator_t,ompi_object_t,ompi_comm_construct,ompi_comm_destruct);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize comm world/self/null.
|
* Initialize comm world/self/null/parent.
|
||||||
*/
|
*/
|
||||||
int ompi_comm_init(void)
|
int ompi_comm_init(void)
|
||||||
{
|
{
|
||||||
@ -143,6 +144,13 @@ int ompi_comm_init(void)
|
|||||||
ompi_mpi_comm_null.bcast_lin_reqs = NULL;
|
ompi_mpi_comm_null.bcast_lin_reqs = NULL;
|
||||||
ompi_mpi_comm_null.bcast_log_reqs = NULL;
|
ompi_mpi_comm_null.bcast_log_reqs = NULL;
|
||||||
|
|
||||||
|
/* Initialize the parent communicator to MPI_COMM_NULL */
|
||||||
|
ompi_mpi_comm_parent = &ompi_mpi_comm_null;
|
||||||
|
OBJ_RETAIN(&ompi_mpi_comm_null);
|
||||||
|
OBJ_RETAIN(&ompi_mpi_group_null);
|
||||||
|
OBJ_RETAIN(&ompi_mpi_group_null);
|
||||||
|
OBJ_RETAIN(&ompi_mpi_errors_are_fatal);
|
||||||
|
|
||||||
return OMPI_SUCCESS;
|
return OMPI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,6 +92,7 @@ struct ompi_communicator_t {
|
|||||||
|
|
||||||
};
|
};
|
||||||
typedef struct ompi_communicator_t ompi_communicator_t;
|
typedef struct ompi_communicator_t ompi_communicator_t;
|
||||||
|
extern ompi_communicator_t *ompi_mpi_comm_parent;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -225,7 +226,8 @@ extern "C" {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* allocate new communicator ID
|
* allocate new communicator ID
|
||||||
* @param comm: original comm
|
* @param newcomm: pointer to the new communicator
|
||||||
|
* @param oldcomm: original comm
|
||||||
* @param bridgecomm: bridge comm for intercomm_create
|
* @param bridgecomm: bridge comm for intercomm_create
|
||||||
* @param mode: combination of input and output communicator
|
* @param mode: combination of input and output communicator
|
||||||
* OMPI_COMM_INTRA_INTRA, OMPI_COMM_INTRA_INTER,
|
* OMPI_COMM_INTRA_INTRA, OMPI_COMM_INTRA_INTER,
|
||||||
@ -233,12 +235,13 @@ extern "C" {
|
|||||||
*
|
*
|
||||||
* This routine has to be thread safe in the final version.
|
* This routine has to be thread safe in the final version.
|
||||||
*/
|
*/
|
||||||
int ompi_comm_nextcid ( ompi_communicator_t* comm,
|
int ompi_comm_nextcid ( ompi_communicator_t* newcomm,
|
||||||
ompi_communicator_t* bridgecomm,
|
ompi_communicator_t* oldcomm,
|
||||||
int local_leader,
|
ompi_communicator_t* bridgecomm,
|
||||||
int remote_leader,
|
int local_leader,
|
||||||
int mode);
|
int remote_leader,
|
||||||
|
int mode);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* shut down the communicator infrastructure.
|
* shut down the communicator infrastructure.
|
||||||
@ -249,19 +252,15 @@ extern "C" {
|
|||||||
* This is THE routine, where all the communicator stuff
|
* This is THE routine, where all the communicator stuff
|
||||||
* is really set.
|
* is really set.
|
||||||
*/
|
*/
|
||||||
ompi_communicator_t* ompi_comm_set ( int mode,
|
ompi_communicator_t* ompi_comm_set ( ompi_communicator_t* oldcomm,
|
||||||
ompi_communicator_t* oldcomm,
|
int local_size,
|
||||||
ompi_communicator_t* bridgecomm,
|
ompi_proc_t **local_procs,
|
||||||
int local_size,
|
int remote_size,
|
||||||
ompi_proc_t **local_procs,
|
ompi_proc_t **remote_procs,
|
||||||
int remote_size,
|
ompi_hash_table_t *attr,
|
||||||
ompi_proc_t **remote_procs,
|
ompi_errhandler_t *errh,
|
||||||
ompi_hash_table_t *attr,
|
mca_base_module_t *collmodule,
|
||||||
ompi_errhandler_t *errh,
|
mca_base_module_t *topomodule );
|
||||||
mca_base_module_t *collmodule,
|
|
||||||
mca_base_module_t *topomodule,
|
|
||||||
int local_leader,
|
|
||||||
int remote_leader);
|
|
||||||
/**
|
/**
|
||||||
* This is a short-hand routine used in intercomm_create.
|
* This is a short-hand routine used in intercomm_create.
|
||||||
* The routine makes sure, that all processes have afterwards
|
* The routine makes sure, that all processes have afterwards
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user