1
1

The patch for "Unexpected message queue for unknown CID's required" ticket #1460.

I'm unable to split it in two parts, my patch and Edgar's one. So I just update
copyright information for both of us.
What this patch do:
- it use the unexpected queue create by commit r19562 to dispatch the
  unexpected message to the right communicator (once this communicator
  is created and initialized).
- delay the PML comm_add until we have the context_id for the new communicator.
- only do the PML comm_add on processes that really belong to the new
  communicator. Please read the lengthy comment in the source code for the
  reason behind this.

This commit was SVN r19929.

The following SVN revision numbers were found above:
  r19562 --> open-mpi/ompi@acd3406aa7
Этот коммит содержится в:
George Bosilca 2008-11-04 21:58:06 +00:00
родитель 412a7852bc
Коммит 82d1d5d785
11 изменённых файлов: 343 добавлений и 445 удалений

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

@ -2,7 +2,7 @@
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2006 The University of Tennessee and The University
* Copyright (c) 2004-2008 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@ -103,6 +103,8 @@ int ompi_comm_set ( ompi_communicator_t **ncomm,
newcomm = OBJ_NEW(ompi_communicator_t);
/* fill in the inscribing hyper-cube dimensions */
newcomm->c_cube_dim = opal_cube_dim(local_size);
newcomm->c_id_available = MPI_UNDEFINED;
newcomm->c_id_start_index = MPI_UNDEFINED;
if (NULL == local_group) {
/* determine how the list of local_rank can be stored most
@ -130,9 +132,9 @@ int ompi_comm_set ( ompi_communicator_t **ncomm,
}
newcomm->c_flags |= OMPI_COMM_INTER;
if ( OMPI_COMM_IS_INTRA(oldcomm) ) {
ompi_comm_dup(oldcomm, &newcomm->c_local_comm,0);
ompi_comm_dup(oldcomm, &newcomm->c_local_comm);
} else {
ompi_comm_dup(oldcomm->c_local_comm, &newcomm->c_local_comm,0);
ompi_comm_dup(oldcomm->c_local_comm, &newcomm->c_local_comm);
}
}
else {
@ -214,14 +216,7 @@ int ompi_comm_set ( ompi_communicator_t **ncomm,
}
}
/* Initialize the PML stuff in the newcomm */
if ( OMPI_SUCCESS != (ret = MCA_PML_CALL(add_comm(newcomm))) ) {
OBJ_RELEASE(newcomm);
return ret;
}
OMPI_COMM_SET_PML_ADDED(newcomm);
*ncomm = newcomm;
*ncomm = newcomm;
return (OMPI_SUCCESS);
}
@ -354,15 +349,7 @@ 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, /* new communicator */
comm, /* old comm */
NULL, /* bridge comm */
NULL, /* local leader */
NULL, /* remote_leader */
mode, /* mode */
-1, /* send first */
0); /* sync_flag */
rc = ompi_comm_activate( &newcomp ); /* new communicator */
if ( OMPI_SUCCESS != rc ) {
goto exit;
}
@ -585,20 +572,11 @@ 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 */
rc = ompi_comm_activate ( newcomp, /* new communicator */
comm, /* old comm */
NULL, /* bridge comm */
NULL, /* local leader */
NULL, /* remote_leader */
mode, /* mode */
-1, /* send first */
0); /* sync_flag */
rc = ompi_comm_activate( &newcomp ); /* new communicator */
if ( OMPI_SUCCESS != rc ) {
goto exit;
}
exit:
if ( NULL != results ) {
free ( results );
@ -619,7 +597,6 @@ int ompi_comm_split ( ompi_communicator_t* comm, int color, int key,
free ( rranks );
}
/* Step 4: if we are not part of the comm, free the struct */
/* --------------------------------------------------------- */
if ( NULL != newcomp && MPI_UNDEFINED == color ) {
@ -632,8 +609,7 @@ int ompi_comm_split ( ompi_communicator_t* comm, int color, int key,
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
int ompi_comm_dup ( ompi_communicator_t * comm, ompi_communicator_t **newcomm,
int sync_flag)
int ompi_comm_dup ( ompi_communicator_t * comm, ompi_communicator_t **newcomm )
{
ompi_communicator_t *comp=NULL;
ompi_communicator_t *newcomp=NULL;
@ -661,8 +637,7 @@ int ompi_comm_dup ( ompi_communicator_t * comm, ompi_communicator_t **newcomm,
(mca_base_component_t *) comp->c_topo_component,
/* topo component */
comp->c_local_group, /* local group */
comp ->c_remote_group /* remote group */
);
comp ->c_remote_group ); /* remote group */
if ( NULL == newcomm ) {
rc = MPI_ERR_INTERN;
return rc;
@ -688,15 +663,7 @@ 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, /* new communicator */
comp, /* old comm */
NULL, /* bridge comm */
NULL, /* local leader */
NULL, /* remote_leader */
mode, /* mode */
-1, /* send_first */
sync_flag /* sync_flag (1 means no processes synchronization) */
);
rc = ompi_comm_activate( &newcomp ); /* new communicator */
if ( OMPI_SUCCESS != rc ) {
return rc;
}
@ -1533,18 +1500,9 @@ int ompi_topo_create (ompi_communicator_t *old_comm,
return ret;
}
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 */
0); /* sync_flag */
ret = ompi_comm_activate( &new_comm ); /* new communicator */
if (OMPI_SUCCESS != ret) {
/* something wrong happened during setting the communicator */
ompi_comm_free (&new_comm);
*comm_topo = new_comm;
return ret;
}
@ -1568,8 +1526,6 @@ static int ompi_comm_fill_rest (ompi_communicator_t *comm,
int my_rank,
ompi_errhandler_t *errh )
{
int ret;
/* properly decrement the ref counts on the groups.
We are doing this because this function is sort of a redo
of what is done in comm.c.. No need to decrement the ref
@ -1617,14 +1573,7 @@ static int ompi_comm_fill_rest (ompi_communicator_t *comm,
/* determine the cube dimensions */
comm->c_cube_dim = opal_cube_dim(comm->c_local_group->grp_proc_count);
/* initialize PML stuff on the communicator */
if (OMPI_SUCCESS != (ret = MCA_PML_CALL(add_comm(comm)))) {
/* some error has happened */
return ret;
}
OMPI_COMM_SET_PML_ADDED(comm);
return OMPI_SUCCESS;
return OMPI_SUCCESS;
}
static int ompi_comm_copy_topo (ompi_communicator_t *oldcomm,
@ -1692,3 +1641,4 @@ static int ompi_comm_copy_topo (ompi_communicator_t *oldcomm,
return OMPI_SUCCESS;
}

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

@ -3,16 +3,16 @@
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2007 The University of Tennessee and The University
* Copyright (c) 2004-2008 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006-2007 University of Houston. All rights reserved.
* Copyright (c) 2007 Cisco, Inc. All rights reserved.
* Copyright (c) 2007 Voltaire All rights reserved.
* Copyright (c) 2006-2008 University of Houston. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -411,88 +411,54 @@ 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,
ompi_communicator_t* comm,
ompi_communicator_t* bridgecomm,
void* local_leader,
void* remote_leader,
int mode,
int send_first,
int sync_flag)
int ompi_comm_activate ( ompi_communicator_t** newcomm )
{
int ok=0, gok=0;
ompi_comm_cid_allredfct* allredfnct;
int ret = 0;
if (0 == sync_flag) {
/* 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_THREAD_MULTIPLE != ompi_mpi_thread_provided) {
/* Only execute the synchronization for single-threaded scenarios.
For multi-threaded cases, the synchronization has already
been executed in the cid-allocation loop */
(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.
*
* Specifically, this function is invoked by all proceses in the
* old communicator, regardless of whether they are in the new
* communicator or not. This is because it is far simpler to use
* MPI collective functions on the old communicator to determine
* some data for the new communicator (e.g., remote_leader) than
* to kludge up our own pseudo-collective routines over just the
* processes in the new communicator. Hence, *all* processes in
* the old communicator need to invoke this function.
*
* That being said, only processes in the new communicator need to
* select a coll module for the new communicator. More
* specifically, proceses who are not in the new communicator
* should *not* select a coll module -- for example,
* ompi_comm_rank(newcomm) returns MPI_UNDEFINED for processes who
* are not in the new communicator. This can cause errors in the
* selection / initialization of a coll module. Plus, it's
* wasteful -- processes in the new communicator will end up
* freeing the new communicator anyway, so we might as well leave
* the coll selection as NULL (the coll base comm unselect code
* handles that case properly).
*/
if (MPI_UNDEFINED == (*newcomm)->c_local_group->grp_my_rank) {
return OMPI_SUCCESS;
}
/* Check to see if this process is in the new communicator.
Specifically, this function is invoked by all proceses in the
old communicator, regardless of whether they are in the new
communicator or not. This is because it is far simpler to use
MPI collective functions on the old communicator to determine
some data for the new communicator (e.g., remote_leader) than
to kludge up our own pseudo-collective routines over just the
processes in the new communicator. Hence, *all* processes in
the old communicator need to invoke this function.
That being said, only processes in the new communicator need to
select a coll module for the new communicator. More
specifically, proceses who are not in the new communicator
should *not* select a coll module -- for example,
ompi_comm_rank(newcomm) returns MPI_UNDEFINED for processes who
are not in the new communicator. This can cause errors in the
selection / initialization of a coll module. Plus, it's
wasteful -- processes in the new communicator will end up
freeing the new communicator anyway, so we might as well leave
the coll selection as NULL (the coll base comm unselect code
handles that case properly). */
if (MPI_UNDEFINED != newcomm->c_local_group->grp_my_rank) {
/* Step 2: call all functions, which might use the new
communicator already. */
/* Initialize the coll components */
/* Let the collectives components fight over who will do
collective on this new comm. */
if (OMPI_SUCCESS !=
(ok = mca_coll_base_comm_select(newcomm))) {
return ok;
}
/* 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 (OMPI_SUCCESS != (ret = mca_coll_base_comm_select(*newcomm))) {
goto bail_on_error;
}
return OMPI_SUCCESS;
bail_on_error:
OBJ_RELEASE(*newcomm);
*newcomm = MPI_COMM_NULL;
return ret;
}
/**************************************************************************/
@ -850,3 +816,4 @@ static int ompi_comm_allreduce_intra_oob (int *inbuf, int *outbuf,
}
END_C_DECLS

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

@ -3,7 +3,7 @@
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2007 The University of Tennessee and The University
* Copyright (c) 2004-2008 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@ -11,7 +11,7 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2006-2007 University of Houston. All rights reserved.
* Copyright (c) 2006-2008 University of Houston. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -155,292 +155,281 @@ struct ompi_communicator_t {
/* Collectives module interface and data */
mca_coll_base_comm_coll_t c_coll;
};
typedef struct ompi_communicator_t ompi_communicator_t;
OMPI_DECLSPEC extern ompi_communicator_t *ompi_mpi_comm_parent;
OMPI_DECLSPEC extern ompi_communicator_t ompi_mpi_comm_null;
typedef struct ompi_communicator_t ompi_communicator_t;
OMPI_DECLSPEC extern ompi_communicator_t *ompi_mpi_comm_parent;
OMPI_DECLSPEC extern ompi_communicator_t ompi_mpi_comm_null;
/**
* Is this a valid communicator? This is a complicated question.
* :-)
*
* According to MPI-1:5.2.4 (p137):
*
* "The predefined constant MPI_COMM_NULL is the value used for
* invalid communicator handles."
*
* Hence, MPI_COMM_NULL is not valid. However, MPI-2:4.12.4 (p50)
* clearly states that the MPI_*_C2F and MPI_*_F2C functions
* should treat MPI_COMM_NULL as a valid communicator -- it
* distinctly differentiates between "invalid" handles and
* "MPI_*_NULL" handles. Some feel that the MPI-1 definition
* still holds for all other MPI functions; others feel that the
* MPi-2 definitions trump the MPI-1 definition. Regardless of
* who is right, there is ambiguity here. So we have left
* ompi_comm_invalid() as originally coded -- per the MPI-1
* definition, where MPI_COMM_NULL is an invalid communicator.
* The MPI_Comm_c2f() function, therefore, calls
* ompi_comm_invalid() but also explictily checks to see if the
* handle is MPI_COMM_NULL.
*/
static inline int ompi_comm_invalid(ompi_communicator_t* comm)
{
if ((NULL == comm) || (MPI_COMM_NULL == comm) ||
(OMPI_COMM_IS_FREED(comm)) || (OMPI_COMM_IS_INVALID(comm)) )
return true;
else
return false;
}
/**
* rank w/in the communicator
*/
static inline int ompi_comm_rank(ompi_communicator_t* comm)
{
return comm->c_my_rank;
}
/**
* size of the communicator
*/
static inline int ompi_comm_size(ompi_communicator_t* comm)
{
return comm->c_local_group->grp_proc_count;
}
/**
* size of the remote group for inter-communicators.
* returns zero for an intra-communicator
*/
static inline int ompi_comm_remote_size(ompi_communicator_t* comm)
{
return (comm->c_flags & OMPI_COMM_INTER ? comm->c_remote_group->grp_proc_count : 0);
}
/**
* Context ID for the communicator, suitable for passing to
* ompi_comm_lookup for getting the communicator back
*/
static inline uint32_t ompi_comm_get_cid(ompi_communicator_t* comm)
{
return comm->c_contextid;
}
/* return pointer to communicator associated with context id cid,
* No error checking is done*/
static inline ompi_communicator_t *ompi_comm_lookup(uint32_t cid)
{
/* array of pointers to communicators, indexed by context ID */
return (ompi_communicator_t*)opal_pointer_array_get_item(&ompi_mpi_communicators, cid);
}
static inline struct ompi_proc_t* ompi_comm_peer_lookup(ompi_communicator_t* comm, int peer_id)
{
#if OMPI_ENABLE_DEBUG
if(peer_id >= comm->c_remote_group->grp_proc_count) {
opal_output(0, "ompi_comm_lookup_peer: invalid peer index (%d)", peer_id);
return (struct ompi_proc_t *) NULL;
}
#endif
/*return comm->c_remote_group->grp_proc_pointers[peer_id];*/
return ompi_group_peer_lookup(comm->c_remote_group,peer_id);
}
static inline bool ompi_comm_peer_invalid(ompi_communicator_t* comm, int peer_id)
{
if(peer_id < 0 || peer_id >= comm->c_remote_group->grp_proc_count) {
return true;
}
/**
* Is this a valid communicator? This is a complicated question.
* :-)
*
* According to MPI-1:5.2.4 (p137):
*
* "The predefined constant MPI_COMM_NULL is the value used for
* invalid communicator handles."
*
* Hence, MPI_COMM_NULL is not valid. However, MPI-2:4.12.4 (p50)
* clearly states that the MPI_*_C2F and MPI_*_F2C functions
* should treat MPI_COMM_NULL as a valid communicator -- it
* distinctly differentiates between "invalid" handles and
* "MPI_*_NULL" handles. Some feel that the MPI-1 definition
* still holds for all other MPI functions; others feel that the
* MPi-2 definitions trump the MPI-1 definition. Regardless of
* who is right, there is ambiguity here. So we have left
* ompi_comm_invalid() as originally coded -- per the MPI-1
* definition, where MPI_COMM_NULL is an invalid communicator.
* The MPI_Comm_c2f() function, therefore, calls
* ompi_comm_invalid() but also explictily checks to see if the
* handle is MPI_COMM_NULL.
*/
static inline int ompi_comm_invalid(ompi_communicator_t* comm)
{
if ((NULL == comm) || (MPI_COMM_NULL == comm) ||
(OMPI_COMM_IS_FREED(comm)) || (OMPI_COMM_IS_INVALID(comm)) )
return true;
else
return false;
}
/**
* rank w/in the communicator
*/
static inline int ompi_comm_rank(ompi_communicator_t* comm)
{
return comm->c_my_rank;
}
/**
* size of the communicator
*/
static inline int ompi_comm_size(ompi_communicator_t* comm)
{
return comm->c_local_group->grp_proc_count;
}
/**
* size of the remote group for inter-communicators.
* returns zero for an intra-communicator
*/
static inline int ompi_comm_remote_size(ompi_communicator_t* comm)
{
return (comm->c_flags & OMPI_COMM_INTER ? comm->c_remote_group->grp_proc_count : 0);
}
/**
* Context ID for the communicator, suitable for passing to
* ompi_comm_lookup for getting the communicator back
*/
static inline uint32_t ompi_comm_get_cid(ompi_communicator_t* comm)
{
return comm->c_contextid;
}
/* return pointer to communicator associated with context id cid,
* No error checking is done*/
static inline ompi_communicator_t *ompi_comm_lookup(uint32_t cid)
{
/* array of pointers to communicators, indexed by context ID */
return (ompi_communicator_t*)opal_pointer_array_get_item(&ompi_mpi_communicators, cid);
}
static inline struct ompi_proc_t* ompi_comm_peer_lookup(ompi_communicator_t* comm, int peer_id)
{
#if OMPI_ENABLE_DEBUG
if(peer_id >= comm->c_remote_group->grp_proc_count) {
opal_output(0, "ompi_comm_lookup_peer: invalid peer index (%d)", peer_id);
return (struct ompi_proc_t *) NULL;
}
#endif
/*return comm->c_remote_group->grp_proc_pointers[peer_id];*/
return ompi_group_peer_lookup(comm->c_remote_group,peer_id);
}
static inline bool ompi_comm_peer_invalid(ompi_communicator_t* comm, int peer_id)
{
if(peer_id < 0 || peer_id >= comm->c_remote_group->grp_proc_count) {
return true;
}
return false;
}
/**
* Initialise MPI_COMM_WORLD and MPI_COMM_SELF
*/
int ompi_comm_init(void);
OMPI_DECLSPEC int ompi_comm_link_function(void);
/**
* Initialise MPI_COMM_WORLD and MPI_COMM_SELF
*/
int ompi_comm_init(void);
OMPI_DECLSPEC int ompi_comm_link_function(void);
/**
* extract the local group from a communicator
*/
OMPI_DECLSPEC int ompi_comm_group (ompi_communicator_t *comm, ompi_group_t **group);
/**
* extract the local group from a communicator
*/
OMPI_DECLSPEC int ompi_comm_group (ompi_communicator_t *comm, ompi_group_t **group);
/**
* create a communicator based on a group
*/
int ompi_comm_create (ompi_communicator_t* comm, ompi_group_t *group,
ompi_communicator_t** newcomm);
/**
* create a communicator based on a group
*/
int ompi_comm_create (ompi_communicator_t* comm, ompi_group_t *group,
ompi_communicator_t** newcomm);
/**
* create a cartesian communicator
*/
int ompi_topo_create (ompi_communicator_t *old_comm,
int ndims_or_nnodes,
int *dims_or_index,
int *periods_or_edges,
bool reorder,
ompi_communicator_t **comm_cart,
int cart_or_graph);
/**
* create a cartesian communicator
*/
int ompi_topo_create (ompi_communicator_t *old_comm,
int ndims_or_nnodes,
int *dims_or_index,
int *periods_or_edges,
bool reorder,
ompi_communicator_t **comm_cart,
int cart_or_graph);
/**
* split a communicator based on color and key. Parameters
* are identical to the MPI-counterpart of the function.
*
* @param comm: input communicator
* @param color
* @param key
*
* @
*/
OMPI_DECLSPEC int ompi_comm_split (ompi_communicator_t *comm, int color, int key,
ompi_communicator_t** newcomm, bool pass_on_topo);
/**
* split a communicator based on color and key. Parameters
* are identical to the MPI-counterpart of the function.
*
* @param comm: input communicator
* @param color
* @param key
*
* @
*/
OMPI_DECLSPEC int ompi_comm_split (ompi_communicator_t *comm, int color, int key,
ompi_communicator_t** newcomm, bool pass_on_topo);
/**
* dup a communicator. Parameter are identical to the MPI-counterpart
* of the function. It has been extracted, since we need to be able
* to dup a communicator internally as well.
*
* @param comm: input communicator
* sync_flag: 0 if processes need to synchronize in activate
* 1 if the do not (optimization to c_local_comm creation)
*
*/
OMPI_DECLSPEC int ompi_comm_dup (ompi_communicator_t *comm, ompi_communicator_t **newcomm,
int sync_flag);
/**
* dup a communicator. Parameter are identical to the MPI-counterpart
* of the function. It has been extracted, since we need to be able
* to dup a communicator internally as well.
*
* @param comm: input communicator
* @param newcomm: the new communicator or MPI_COMM_NULL if any error is detected.
*/
OMPI_DECLSPEC int ompi_comm_dup (ompi_communicator_t *comm, ompi_communicator_t **newcomm);
/**
* compare two communicators.
*
* @param comm1,comm2: input communicators
*
*/
int ompi_comm_compare(ompi_communicator_t *comm1, ompi_communicator_t *comm2, int *result);
/**
* compare two communicators.
*
* @param comm1,comm2: input communicators
*
*/
int ompi_comm_compare(ompi_communicator_t *comm1, ompi_communicator_t *comm2, int *result);
/**
* free a communicator
*/
OMPI_DECLSPEC int ompi_comm_free (ompi_communicator_t **comm);
/**
* free a communicator
*/
OMPI_DECLSPEC int ompi_comm_free (ompi_communicator_t **comm);
/**
* allocate a new communicator structure
* @param local_group_size
* @param remote_group_size
*
* This routine allocates the structure, the according local and
* remote groups, the proc-arrays in the local and remote group.
* It furthermore sets the fortran index correctly,
* and sets all other elements to zero.
*/
ompi_communicator_t* ompi_comm_allocate (int local_group_size,
int remote_group_size);
/**
* allocate a new communicator structure
* @param local_group_size
* @param remote_group_size
*
* This routine allocates the structure, the according local and
* remote groups, the proc-arrays in the local and remote group.
* It furthermore sets the fortran index correctly,
* and sets all other elements to zero.
*/
ompi_communicator_t* ompi_comm_allocate (int local_group_size,
int remote_group_size);
/**
* allocate new communicator ID
* @param newcomm: pointer to the new communicator
* @param oldcomm: original comm
* @param bridgecomm: bridge comm for intercomm_create
* @param mode: combination of input
* OMPI_COMM_CID_INTRA: intra-comm
* OMPI_COMM_CID_INTER: inter-comm
* OMPI_COMM_CID_INTRA_BRIDGE: 2 intracomms connected by
* a bridge comm. local_leader
* and remote leader are in this
* case an int (rank in bridge-comm).
* OMPI_COMM_CID_INTRA_OOB: 2 intracomms, leaders talk
* through OOB. lleader and rleader
* are the required contact information.
* @param send_first: to avoid a potential deadlock for
* the OOB version.
* This routine has to be thread safe in the final version.
*/
/**
* allocate new communicator ID
* @param newcomm: pointer to the new communicator
* @param oldcomm: original comm
* @param bridgecomm: bridge comm for intercomm_create
* @param mode: combination of input
* OMPI_COMM_CID_INTRA: intra-comm
* OMPI_COMM_CID_INTER: inter-comm
* OMPI_COMM_CID_INTRA_BRIDGE: 2 intracomms connected by
* a bridge comm. local_leader
* and remote leader are in this
* case an int (rank in bridge-comm).
* OMPI_COMM_CID_INTRA_OOB: 2 intracomms, leaders talk
* through OOB. lleader and rleader
* are the required contact information.
* @param send_first: to avoid a potential deadlock for
* the OOB version.
* This routine has to be thread safe in the final version.
*/
OMPI_DECLSPEC int ompi_comm_nextcid ( ompi_communicator_t* newcomm,
ompi_communicator_t* oldcomm,
ompi_communicator_t* bridgecomm,
void* local_leader,
void* remote_leader,
int mode,
int send_first);
ompi_communicator_t* oldcomm,
ompi_communicator_t* bridgecomm,
void* local_leader,
void* remote_leader,
int mode,
int send_first);
/**
* shut down the communicator infrastructure.
*/
int ompi_comm_finalize (void);
/**
* shut down the communicator infrastructure.
*/
int ompi_comm_finalize (void);
/**
* This is THE routine, where all the communicator stuff
* is really set.
*/
/**
* This is THE routine, where all the communicator stuff
* is really set.
*/
OMPI_DECLSPEC int ompi_comm_set ( ompi_communicator_t** newcomm,
ompi_communicator_t* oldcomm,
int local_size,
int *local_ranks,
int remote_size,
int *remote_ranks,
opal_hash_table_t *attr,
ompi_errhandler_t *errh,
mca_base_component_t *topocomponent,
ompi_group_t *local_group,
ompi_group_t *remote_group );
/**
* This is a short-hand routine used in intercomm_create.
* The routine makes sure, that all processes have afterwards
* a list of ompi_proc_t pointers for the remote group.
*/
struct ompi_proc_t **ompi_comm_get_rprocs ( ompi_communicator_t *local_comm,
ompi_communicator_t *bridge_comm,
int local_leader,
int remote_leader,
orte_rml_tag_t tag,
int rsize);
ompi_communicator_t* oldcomm,
int local_size,
int *local_ranks,
int remote_size,
int *remote_ranks,
opal_hash_table_t *attr,
ompi_errhandler_t *errh,
mca_base_component_t *topocomponent,
ompi_group_t *local_group,
ompi_group_t *remote_group );
/**
* This is a short-hand routine used in intercomm_create.
* The routine makes sure, that all processes have afterwards
* a list of ompi_proc_t pointers for the remote group.
*/
struct ompi_proc_t **ompi_comm_get_rprocs ( ompi_communicator_t *local_comm,
ompi_communicator_t *bridge_comm,
int local_leader,
int remote_leader,
orte_rml_tag_t tag,
int rsize);
/**
* This routine verifies, whether local_group and remote group are overlapping
* in intercomm_create
*/
int ompi_comm_overlapping_groups (int size, struct ompi_proc_t ** lprocs,
int rsize, struct ompi_proc_t ** rprocs);
/**
* This routine verifies, whether local_group and remote group are overlapping
* in intercomm_create
*/
int ompi_comm_overlapping_groups (int size, struct ompi_proc_t ** lprocs,
int rsize, struct ompi_proc_t ** rprocs);
/**
* This is a routine determining whether the local or the
* remote group will be first in the new intra-comm.
* Just used from within MPI_Intercomm_merge.
*/
int ompi_comm_determine_first ( ompi_communicator_t *intercomm,
int high );
/**
* This is a routine determining whether the local or the
* remote group will be first in the new intra-comm.
* Just used from within MPI_Intercomm_merge.
*/
int ompi_comm_determine_first ( ompi_communicator_t *intercomm,
int high );
OMPI_DECLSPEC int ompi_comm_activate ( ompi_communicator_t* newcomm,
ompi_communicator_t* oldcomm,
ompi_communicator_t* bridgecomm,
void* local_leader,
void* remote_leader,
int mode,
int send_first,
int sync_flag );
OMPI_DECLSPEC int ompi_comm_activate ( ompi_communicator_t** newcomm );
/**
* a simple function to dump the structure
*/
int ompi_comm_dump ( ompi_communicator_t *comm );
/**
* a simple function to dump the structure
*/
int ompi_comm_dump ( ompi_communicator_t *comm );
/* setting name */
int ompi_comm_set_name (ompi_communicator_t *comm, char *name );
/* setting name */
int ompi_comm_set_name (ompi_communicator_t *comm, char *name );
/*
* these are the init and finalize functions for the comm_reg
* stuff. These routines are necessary for handling multi-threading
* scenarious in the communicator_cid allocation
*/
void ompi_comm_reg_init(void);
void ompi_comm_reg_finalize(void);
/*
* these are the init and finalize functions for the comm_reg
* stuff. These routines are necessary for handling multi-threading
* scenarious in the communicator_cid allocation
*/
void ompi_comm_reg_init(void);
void ompi_comm_reg_finalize(void);
/* global variable to save the number od dynamic communicators */
extern int ompi_comm_num_dyncomm;
/* global variable to save the number od dynamic communicators */
extern int ompi_comm_num_dyncomm;
END_C_DECLS
#endif /* OMPI_COMMUNICATOR_H */

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

@ -10,6 +10,7 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2007 Cisco, Inc. All rights reserved.
* Copyright (c) 2006-2008 University of Houston. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -440,14 +441,7 @@ static int connect_accept ( ompi_communicator_t *comm, int root,
}
/* activate comm and init coll-component */
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 */
0); /* sync_flag */
rc = ompi_comm_activate ( &newcomp ); /* new communicator */
if ( OMPI_SUCCESS != rc ) {
goto exit;
}
@ -457,7 +451,6 @@ static int connect_accept ( ompi_communicator_t *comm, int root,
between the two worlds ?
*/
exit:
/* done with OOB and such - slow our tick rate again */
opal_progress();
@ -1035,3 +1028,4 @@ static void process_cb(int fd, short event, void *data)
/* flag complete */
recv_completed = true;
}

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

@ -1,8 +1,9 @@
/*
* Copyright (c) 2004-2007 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2006 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2004-2008 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
@ -10,6 +11,7 @@
* Copyright (c) 2007 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2006-2008 University of Houston. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -290,7 +292,7 @@ ompi_osc_pt2pt_component_select(ompi_win_t *win,
module->p2p_win = win;
ret = ompi_comm_dup(comm, &(module->p2p_comm), 0);
ret = ompi_comm_dup(comm, &(module->p2p_comm));
if (ret != OMPI_SUCCESS) goto cleanup;
opal_output_verbose(1, ompi_osc_base_output,
@ -744,7 +746,6 @@ ompi_osc_pt2pt_component_progress(void)
return done;
}
#if OMPI_ENABLE_PROGRESS_THREADS
static void*
component_thread_fn(opal_object_t *obj)
@ -765,3 +766,4 @@ component_thread_fn(opal_object_t *obj)
return NULL;
}
#endif

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

@ -1,14 +1,16 @@
/*
* Copyright (c) 2004-2007 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2006 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2004-2008 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2007 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2006-2008 University of Houston. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -321,7 +323,7 @@ ompi_osc_rdma_component_select(ompi_win_t *win,
module->m_sequence_number = (mca_osc_rdma_component.c_sequence_number++);
OPAL_THREAD_UNLOCK(&mca_osc_rdma_component.c_lock);
ret = ompi_comm_dup(comm, &module->m_comm, 0);
ret = ompi_comm_dup(comm, &module->m_comm);
if (ret != OMPI_SUCCESS) goto cleanup;
opal_output_verbose(1, ompi_osc_base_output,
@ -1367,3 +1369,4 @@ setup_rdma(ompi_osc_rdma_module_t *module)
return ret;
}

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

@ -10,6 +10,7 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008 UT-Battelle, LLC. All rights reserved.
* Copyright (c) 2006-2008 University of Houston. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -173,7 +174,7 @@ int mca_pml_ob1_add_comm(ompi_communicator_t* comm)
{
/* allocate pml specific comm data */
mca_pml_ob1_comm_t* pml_comm = OBJ_NEW(mca_pml_ob1_comm_t);
opal_list_item_t* item;
opal_list_item_t *item, *next_item;
mca_pml_ob1_recv_frag_t* frag;
mca_pml_ob1_comm_proc_t* pml_proc;
mca_pml_ob1_match_hdr_t* hdr;
@ -191,8 +192,9 @@ int mca_pml_ob1_add_comm(ompi_communicator_t* comm)
/* Grab all related messages from the non_existing_communicator pending queue */
for( item = opal_list_get_first(&mca_pml_ob1.non_existing_communicator_pending);
item != opal_list_get_end(&mca_pml_ob1.non_existing_communicator_pending);
item = opal_list_get_next(item) ) {
item = next_item ) {
frag = (mca_pml_ob1_recv_frag_t*)item;
next_item = opal_list_get_next(item);
hdr = &frag->hdr.hdr_match;
/* Is this fragment for the current communicator ? */
@ -206,6 +208,7 @@ int mca_pml_ob1_add_comm(ompi_communicator_t* comm)
item = opal_list_remove_item( &mca_pml_ob1.non_existing_communicator_pending, item );
add_fragment_to_unexpected:
/* We generate the MSG_ARRIVED event as soon as the PML is aware
* of a matching fragment arrival. Independing if it is received
* on the correct order or not. This will allow the tools to

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

@ -10,6 +10,7 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008 UT-Battelle, LLC. All rights reserved.
* Copyright (c) 2006-2008 University of Houston. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -110,7 +111,7 @@ void mca_pml_ob1_recv_frag_callback_match(mca_btl_base_module_t* btl,
if( OPAL_UNLIKELY(segments->seg_len < OMPI_PML_OB1_MATCH_HDR_LEN) ) {
return;
}
}
ob1_hdr_ntoh(((mca_pml_ob1_hdr_t*) hdr), MCA_PML_OB1_HDR_TYPE_MATCH);
/* communicator pointer */
@ -677,3 +678,4 @@ wrong_seq:
OPAL_THREAD_UNLOCK(&comm->matching_lock);
return OMPI_SUCCESS;
}

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

@ -2,7 +2,7 @@
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* Copyright (c) 2004-2008 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
@ -10,6 +10,7 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2006-2008 University of Houston. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -55,6 +56,7 @@ int MPI_Comm_dup(MPI_Comm comm, MPI_Comm *newcomm)
OPAL_CR_ENTER_LIBRARY();
rc = ompi_comm_dup ( comm, newcomm, 0);
rc = ompi_comm_dup ( comm, newcomm );
OMPI_ERRHANDLER_RETURN ( rc, comm, rc, FUNC_NAME);
}

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

@ -2,15 +2,15 @@
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* Copyright (c) 2004-2008 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006-2007 University of Houston. All rights reserved.
* Copyright (c) 2006-2007 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2006-2008 University of Houston. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -210,19 +210,11 @@ int MPI_Intercomm_create(MPI_Comm local_comm, int local_leader,
}
/* activate comm and init coll-module */
rc = ompi_comm_activate ( newcomp, /* new comm */
local_comm, /* old comm */
bridge_comm, /* bridge comm */
&lleader, /* local leader */
&rleader, /* remote_leader */
OMPI_COMM_CID_INTRA_BRIDGE, /* mode */
-1, /* send_first */
0); /* sync_flag */
rc = ompi_comm_activate ( &newcomp );
if ( MPI_SUCCESS != rc ) {
goto err_exit;
}
err_exit:
OPAL_CR_EXIT_LIBRARY();
@ -241,3 +233,4 @@ int MPI_Intercomm_create(MPI_Comm local_comm, int local_leader,
*newintercomm = newcomp;
return MPI_SUCCESS;
}

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

@ -2,15 +2,15 @@
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* Copyright (c) 2004-2008 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006-2007 University of Houston. All rights reserved.
* Copyright (c) 2006-2007 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2006-2008 University of Houston. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -131,18 +131,10 @@ int MPI_Intercomm_merge(MPI_Comm intercomm, int high,
}
/* activate communicator and init coll-module */
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 */
0); /* sync_flag */
rc = ompi_comm_activate( &newcomp ); /* new comm */
if ( OMPI_SUCCESS != rc ) {
goto exit;
}
exit:
OPAL_CR_EXIT_LIBRARY();
@ -164,3 +156,4 @@ int MPI_Intercomm_merge(MPI_Comm intercomm, int high,
*newcomm = newcomp;
return MPI_SUCCESS;
}