2004-01-10 01:09:51 +03:00
|
|
|
/*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
#ifndef OMPI_COMMUNICATOR_H
|
|
|
|
#define OMPI_COMMUNICATOR_H
|
2004-01-10 01:09:51 +03:00
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
#include "class/ompi_object.h"
|
2004-11-05 10:52:30 +03:00
|
|
|
#include "class/ompi_hash_table.h"
|
2004-03-19 03:00:09 +03:00
|
|
|
#include "errhandler/errhandler.h"
|
2004-03-17 21:45:16 +03:00
|
|
|
#include "threads/mutex.h"
|
2004-11-05 10:52:30 +03:00
|
|
|
#include "threads/mutex.h"
|
2004-03-17 21:45:16 +03:00
|
|
|
#include "util/output.h"
|
2004-01-11 03:13:22 +03:00
|
|
|
#include "mpi.h"
|
2004-03-17 21:45:16 +03:00
|
|
|
#include "group/group.h"
|
|
|
|
#include "mca/coll/coll.h"
|
2004-04-17 00:54:48 +04:00
|
|
|
#include "mca/topo/topo.h"
|
2004-05-08 03:15:10 +04:00
|
|
|
#include "request/request.h"
|
2004-02-06 07:20:13 +03:00
|
|
|
|
2004-10-21 04:33:54 +04:00
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2004-10-22 20:06:05 +04:00
|
|
|
OMPI_DECLSPEC extern ompi_class_t ompi_communicator_t_class;
|
2004-02-13 16:56:55 +03:00
|
|
|
|
2004-10-26 15:37:58 +04:00
|
|
|
#define OMPI_COMM_INTER 0x00000001
|
|
|
|
#define OMPI_COMM_CART 0x00000002
|
|
|
|
#define OMPI_COMM_GRAPH 0x00000004
|
|
|
|
#define OMPI_COMM_NAMEISSET 0x00000008
|
|
|
|
#define OMPI_COMM_ISFREED 0x00000010
|
|
|
|
#define OMPI_COMM_INTRINSIC 0x00000020
|
|
|
|
#define OMPI_COMM_HIDDEN 0x00000040
|
|
|
|
#define OMPI_COMM_DYNAMIC 0x00000080
|
2004-10-26 21:25:49 +04:00
|
|
|
#define OMPI_COMM_INVALID 0x00000100
|
2004-02-13 16:56:55 +03:00
|
|
|
|
2004-04-21 04:16:05 +04:00
|
|
|
/* some utility #defines */
|
2004-06-07 19:33:53 +04:00
|
|
|
#define OMPI_COMM_IS_INTER(comm) ((comm)->c_flags & OMPI_COMM_INTER)
|
|
|
|
#define OMPI_COMM_IS_INTRA(comm) (!((comm)->c_flags & OMPI_COMM_INTER))
|
|
|
|
#define OMPI_COMM_IS_CART(comm) ((comm)->c_flags & OMPI_COMM_CART)
|
|
|
|
#define OMPI_COMM_IS_GRAPH(comm) ((comm)->c_flags & OMPI_COMM_GRAPH)
|
2004-06-15 04:09:40 +04:00
|
|
|
#define OMPI_COMM_IS_INTRINSIC(comm) ((comm)->c_flags & OMPI_COMM_INTRINSIC)
|
2004-08-06 18:33:23 +04:00
|
|
|
#define OMPI_COMM_IS_HIDDEN(comm) ((comm)->c_flags & OMPI_COMM_HIDDEN)
|
2004-08-13 22:55:07 +04:00
|
|
|
#define OMPI_COMM_IS_FREED(comm) ((comm)->c_flags & OMPI_COMM_ISFREED)
|
2004-10-26 15:37:58 +04:00
|
|
|
#define OMPI_COMM_IS_DYNAMIC(comm) ((comm)->c_flags &OMPI_COMM_DYNAMIC)
|
2004-10-26 21:25:49 +04:00
|
|
|
#define OMPI_COMM_IS_INVALID(comm) ((comm)->c_flags &OMPI_COMM_INVALID)
|
2004-08-06 18:33:23 +04:00
|
|
|
|
|
|
|
#define OMPI_COMM_SET_HIDDEN(comm) ((comm)->c_flags |= OMPI_COMM_HIDDEN)
|
2004-10-26 15:37:58 +04:00
|
|
|
#define OMPI_COMM_SET_DYNAMIC(comm) ((comm)->c_flags |= OMPI_COMM_DYNAMIC)
|
2004-10-26 21:25:49 +04:00
|
|
|
#define OMPI_COMM_SET_INVALID(comm) ((comm)->c_flags |= OMPI_COMM_INVALID)
|
2004-10-26 15:37:58 +04:00
|
|
|
|
2004-10-26 19:06:51 +04:00
|
|
|
/* a set of special tags: */
|
|
|
|
|
|
|
|
/* to recognize an MPI_Comm_join in the comm_connect_accept routine. */
|
2004-10-26 21:25:49 +04:00
|
|
|
#define OMPI_COMM_JOIN_TAG -32000
|
2004-10-26 19:06:51 +04:00
|
|
|
|
|
|
|
#define OMPI_COMM_ALLGATHER_TAG -31078
|
|
|
|
#define OMPI_COMM_BARRIER_TAG -31079
|
|
|
|
#define OMPI_COMM_ALLREDUCE_TAG -31080
|
|
|
|
|
2004-05-21 23:36:19 +04:00
|
|
|
/**
|
|
|
|
* Modes reqquired for accquiring the new comm-id.
|
|
|
|
* The first (INTER/INTRA) indicates whether the
|
|
|
|
* input comm was an inter/intra-comm, the second
|
|
|
|
* whether the new communicator will be an inter/intra
|
|
|
|
*comm
|
|
|
|
*/
|
2004-08-06 18:33:23 +04:00
|
|
|
#define OMPI_COMM_CID_INTRA 0x00000020
|
|
|
|
#define OMPI_COMM_CID_INTER 0x00000040
|
2004-06-17 02:37:03 +04:00
|
|
|
#define OMPI_COMM_CID_INTRA_BRIDGE 0x00000080
|
2004-08-06 18:33:23 +04:00
|
|
|
#define OMPI_COMM_CID_INTRA_OOB 0x00000100
|
2004-01-10 01:09:51 +03:00
|
|
|
|
2004-10-22 20:06:05 +04:00
|
|
|
OMPI_DECLSPEC extern ompi_pointer_array_t ompi_mpi_communicators;
|
2004-05-21 23:36:19 +04:00
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
struct ompi_communicator_t {
|
2004-08-04 23:46:29 +04:00
|
|
|
ompi_object_t c_base;
|
2004-10-26 21:25:49 +04:00
|
|
|
ompi_mutex_t c_lock; /* mutex for name and potentially
|
|
|
|
attributes */
|
2004-03-26 23:02:42 +03:00
|
|
|
char c_name[MPI_MAX_OBJECT_NAME];
|
|
|
|
uint32_t c_contextid;
|
|
|
|
int c_my_rank;
|
|
|
|
uint32_t c_flags; /* flags, e.g. intercomm,
|
|
|
|
topology, etc. */
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_group_t *c_local_group;
|
|
|
|
ompi_group_t *c_remote_group;
|
2004-01-10 01:09:51 +03:00
|
|
|
|
2004-01-10 11:20:15 +03:00
|
|
|
/* Attributes */
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_hash_table_t *c_keyhash;
|
2004-01-10 01:09:51 +03:00
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
/**< inscribing cube dimension */
|
2004-10-26 15:37:58 +04:00
|
|
|
int c_cube_dim;
|
2004-04-21 04:16:05 +04:00
|
|
|
|
2004-04-17 00:54:48 +04:00
|
|
|
/* Hooks for topo module to hang things */
|
2004-10-05 20:32:52 +04:00
|
|
|
mca_base_component_t *c_topo_component;
|
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
const mca_topo_base_module_1_0_0_t *c_topo;
|
|
|
|
/**< structure of function pointers */
|
2004-07-21 02:21:47 +04:00
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
mca_topo_base_comm_t *c_topo_comm;
|
|
|
|
/**< structure containing basic information about the topology */
|
2004-01-10 01:09:51 +03:00
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
struct mca_topo_base_module_comm_t *c_topo_module;
|
|
|
|
/**< module specific data */
|
2004-07-21 02:21:47 +04:00
|
|
|
|
2004-03-19 03:00:09 +03:00
|
|
|
/* index in Fortran <-> C translation array */
|
|
|
|
|
|
|
|
int c_f_to_c_index;
|
|
|
|
|
2004-03-19 09:12:43 +03:00
|
|
|
/* Error handling. This field does not have the "c_" prefix so
|
2004-06-07 19:33:53 +04:00
|
|
|
that the OMPI_ERRHDL_* macros can find it, regardless of whether
|
2004-03-19 09:12:43 +03:00
|
|
|
it's a comm, window, or file. */
|
2004-01-10 01:09:51 +03:00
|
|
|
|
2004-09-06 16:06:27 +04:00
|
|
|
ompi_errhandler_t *error_handler;
|
|
|
|
ompi_errhandler_type_t errhandler_type;
|
2004-01-10 01:09:51 +03:00
|
|
|
|
2004-01-10 11:20:15 +03:00
|
|
|
/* Hooks for PML to hang things */
|
2004-01-10 01:09:51 +03:00
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
struct mca_pml_comm_t *c_pml_comm;
|
2004-01-10 01:09:51 +03:00
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
mca_coll_base_module_1_0_0_t c_coll;
|
2004-06-29 04:02:25 +04:00
|
|
|
/**< Selected collective module, saved by value for speed (instead
|
|
|
|
of by reference) */
|
|
|
|
|
2004-10-16 02:32:48 +04:00
|
|
|
const mca_coll_base_component_1_0_0_t *c_coll_selected_component;
|
|
|
|
/**< Selected coll component */
|
2004-08-02 04:24:22 +04:00
|
|
|
const mca_coll_base_module_1_0_0_t *c_coll_selected_module;
|
|
|
|
/**< The selected module, but only when the selected module
|
|
|
|
is not* the basic module. Used during comm_unselect(). */
|
|
|
|
struct mca_coll_base_comm_t *c_coll_selected_data;
|
2004-06-29 04:02:25 +04:00
|
|
|
/**< Allow the selected module to cache data on the communicator */
|
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
const mca_coll_base_module_1_0_0_t *c_coll_basic_module;
|
2004-06-29 04:02:25 +04:00
|
|
|
/**< Save the basic module; only necessary when the selected
|
2004-08-02 04:24:22 +04:00
|
|
|
module is *not* the basic module, but was supplemented
|
|
|
|
with methods from the basic module. */
|
|
|
|
struct mca_coll_base_comm_t *c_coll_basic_data;
|
2004-06-29 04:02:25 +04:00
|
|
|
/**< Allow the basic module to cache data on the communicator */
|
2004-01-10 20:05:04 +03:00
|
|
|
};
|
2004-10-26 15:37:58 +04:00
|
|
|
typedef struct ompi_communicator_t ompi_communicator_t;
|
|
|
|
OMPI_DECLSPEC extern ompi_communicator_t *ompi_mpi_comm_parent;
|
2004-10-26 21:25:49 +04:00
|
|
|
OMPI_DECLSPEC extern ompi_communicator_t ompi_mpi_comm_null;
|
2004-05-21 23:36:19 +04:00
|
|
|
|
2004-03-12 01:02:01 +03:00
|
|
|
|
2004-10-26 15:37:58 +04:00
|
|
|
/**
|
|
|
|
* is this a valid communicator
|
|
|
|
*/
|
|
|
|
static inline int ompi_comm_invalid(ompi_communicator_t* comm)
|
|
|
|
{
|
|
|
|
if ((NULL == comm) || (MPI_COMM_NULL == comm) ||
|
2004-10-26 21:25:49 +04:00
|
|
|
(comm->c_flags & OMPI_COMM_ISFREED ) ||
|
|
|
|
(OMPI_COMM_IS_INVALID(comm)) )
|
2004-10-26 15:37:58 +04:00
|
|
|
return true;
|
|
|
|
else
|
|
|
|
return false;
|
|
|
|
}
|
2004-03-03 19:44:41 +03:00
|
|
|
|
2004-10-26 15:37:58 +04:00
|
|
|
/**
|
|
|
|
* rank w/in the communicator
|
|
|
|
*/
|
|
|
|
static inline int ompi_comm_rank(ompi_communicator_t* comm)
|
|
|
|
{
|
|
|
|
return comm->c_my_rank;
|
|
|
|
}
|
2004-01-11 02:12:43 +03:00
|
|
|
|
2004-10-26 15:37:58 +04:00
|
|
|
/**
|
|
|
|
* 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)
|
|
|
|
{
|
|
|
|
if ( comm->c_flags & OMPI_COMM_INTER )
|
|
|
|
return comm->c_remote_group->grp_proc_count;
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 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 */
|
|
|
|
OMPI_DECLSPEC extern ompi_pointer_array_t ompi_mpi_communicators;
|
|
|
|
return (ompi_communicator_t*)ompi_pointer_array_get_item(&ompi_mpi_communicators, cid);
|
2004-01-29 01:52:51 +03:00
|
|
|
}
|
2004-10-26 15:37:58 +04:00
|
|
|
|
|
|
|
static inline 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) {
|
|
|
|
ompi_output(0, "ompi_comm_lookup_peer: invalid peer index (%d)", peer_id);
|
|
|
|
return (ompi_proc_t *) NULL;
|
|
|
|
}
|
2004-01-12 21:47:12 +03:00
|
|
|
#endif
|
2004-10-26 15:37:58 +04:00
|
|
|
return comm->c_remote_group->grp_proc_pointers[peer_id];
|
2004-03-17 00:56:19 +03:00
|
|
|
}
|
2004-10-26 15:37:58 +04:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-03-26 23:02:42 +03:00
|
|
|
/**
|
|
|
|
* Initialise MPI_COMM_WORLD and MPI_COMM_SELF
|
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
int ompi_comm_init(void);
|
|
|
|
int ompi_comm_link_function(void);
|
2004-10-26 15:37:58 +04:00
|
|
|
|
2004-03-26 23:02:42 +03:00
|
|
|
/**
|
|
|
|
* extract the local group from a communicator
|
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
int ompi_comm_group ( ompi_communicator_t *comm, ompi_group_t **group );
|
2004-10-26 15:37:58 +04:00
|
|
|
|
2004-03-26 23:02:42 +03:00
|
|
|
/**
|
|
|
|
* create a communicator based on a group
|
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
int ompi_comm_create ( ompi_communicator_t* comm, ompi_group_t *group,
|
2004-10-26 15:37:58 +04:00
|
|
|
ompi_communicator_t** newcomm );
|
|
|
|
|
|
|
|
|
2004-07-21 02:21:47 +04:00
|
|
|
/**
|
|
|
|
* 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);
|
|
|
|
|
2004-03-26 23:02:42 +03:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*
|
|
|
|
* @
|
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
int ompi_comm_split ( ompi_communicator_t *comm, int color, int key,
|
2004-10-07 23:14:27 +04:00
|
|
|
ompi_communicator_t** newcomm, bool pass_on_topo);
|
2004-03-26 23:02:42 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* free a communicator
|
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
int ompi_comm_free ( ompi_communicator_t **comm );
|
2004-03-26 23:02:42 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_communicator_t* ompi_comm_allocate ( int local_group_size,
|
2004-08-04 02:07:45 +04:00
|
|
|
int remote_group_size );
|
2004-03-26 23:02:42 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* allocate new communicator ID
|
2004-06-16 19:40:52 +04:00
|
|
|
* @param newcomm: pointer to the new communicator
|
|
|
|
* @param oldcomm: original comm
|
2004-05-21 23:36:19 +04:00
|
|
|
* @param bridgecomm: bridge comm for intercomm_create
|
2004-06-17 02:37:03 +04:00
|
|
|
* @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.
|
2004-08-05 20:31:30 +04:00
|
|
|
* @param send_first: to avoid a potential deadlock for
|
|
|
|
* the OOB version.
|
2004-03-26 23:02:42 +03:00
|
|
|
* This routine has to be thread safe in the final version.
|
|
|
|
*/
|
2004-06-16 19:40:52 +04:00
|
|
|
int ompi_comm_nextcid ( ompi_communicator_t* newcomm,
|
|
|
|
ompi_communicator_t* oldcomm,
|
|
|
|
ompi_communicator_t* bridgecomm,
|
2004-06-17 02:37:03 +04:00
|
|
|
void* local_leader,
|
|
|
|
void* remote_leader,
|
2004-08-05 20:31:30 +04:00
|
|
|
int mode,
|
|
|
|
int send_first);
|
2004-06-16 19:40:52 +04:00
|
|
|
|
2004-03-26 23:02:42 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* shut down the communicator infrastructure.
|
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
int ompi_comm_finalize (void);
|
2004-05-21 23:36:19 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This is THE routine, where all the communicator stuff
|
|
|
|
* is really set.
|
|
|
|
*/
|
2004-08-04 02:07:45 +04:00
|
|
|
int ompi_comm_set ( ompi_communicator_t* newcomm,
|
|
|
|
ompi_communicator_t* oldcomm,
|
|
|
|
int local_size,
|
|
|
|
ompi_proc_t **local_procs,
|
|
|
|
int remote_size,
|
|
|
|
ompi_proc_t **remote_procs,
|
|
|
|
ompi_hash_table_t *attr,
|
|
|
|
ompi_errhandler_t *errh,
|
|
|
|
mca_base_component_t *topocomponent );
|
2004-05-21 23:36:19 +04:00
|
|
|
/**
|
|
|
|
* This is a short-hand routine used in intercomm_create.
|
|
|
|
* The routine makes sure, that all processes have afterwards
|
2004-06-07 19:33:53 +04:00
|
|
|
* a list of ompi_proc_t pointers for the remote group.
|
2004-05-21 23:36:19 +04:00
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_proc_t **ompi_comm_get_rprocs ( ompi_communicator_t *local_comm,
|
|
|
|
ompi_communicator_t *bridge_comm,
|
2004-05-21 23:36:19 +04:00
|
|
|
int local_leader,
|
|
|
|
int remote_leader,
|
|
|
|
int tag,
|
|
|
|
int rsize);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
int ompi_comm_determine_first ( ompi_communicator_t *intercomm,
|
2004-05-21 23:36:19 +04:00
|
|
|
int high );
|
|
|
|
|
2004-06-16 01:29:29 +04:00
|
|
|
|
2004-08-05 20:31:30 +04:00
|
|
|
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,
|
|
|
|
mca_base_component_t *collcomponent );
|
|
|
|
|
|
|
|
|
2004-06-16 01:29:29 +04:00
|
|
|
/**
|
|
|
|
* a simple function to dump the structure
|
|
|
|
*/
|
|
|
|
int ompi_comm_dump ( ompi_communicator_t *comm );
|
|
|
|
|
2004-09-17 14:11:22 +04:00
|
|
|
/**
|
|
|
|
* a simple function to determint a port number
|
|
|
|
*/
|
|
|
|
int ompi_open_port (char *port_name);
|
2004-06-17 01:34:42 +04:00
|
|
|
|
2004-09-17 14:11:22 +04:00
|
|
|
/**
|
|
|
|
* takes a port_name and returns the oob-contact information
|
|
|
|
* and the tag
|
|
|
|
*/
|
|
|
|
char * ompi_parse_port (char *port_name, int *tag) ;
|
2004-06-17 01:34:42 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* routines handling name publishing, lookup and unpublishing
|
|
|
|
*/
|
|
|
|
int ompi_comm_namepublish ( char *service_name, char *port_name );
|
|
|
|
char* ompi_comm_namelookup ( char *service_name );
|
|
|
|
int ompi_comm_nameunpublish ( char *service_name );
|
|
|
|
|
|
|
|
|
2004-08-04 23:46:29 +04:00
|
|
|
/* setting name */
|
|
|
|
int ompi_comm_set_name (ompi_communicator_t *comm, char *name );
|
|
|
|
|
2004-08-05 20:31:30 +04:00
|
|
|
/* THE routine for dynamic process management. This routine
|
|
|
|
sets the connection up between two independent applications.
|
|
|
|
*/
|
|
|
|
int ompi_comm_connect_accept ( ompi_communicator_t *comm, int root,
|
|
|
|
ompi_process_name_t *port, int send_first,
|
2004-09-17 14:11:22 +04:00
|
|
|
ompi_communicator_t **newcomm, int tag);
|
2004-08-05 20:31:30 +04:00
|
|
|
|
|
|
|
/* A helper routine for ompi_comm_connect_accept.
|
|
|
|
* This routine is necessary, since in the connect/accept case, the processes
|
|
|
|
* executing the connect operation have the OOB contact information of the
|
|
|
|
* leader of the remote group, however, the processes executing the
|
|
|
|
* accept get their own port_name = OOB contact information passed in as
|
|
|
|
* an argument. This is however useless.
|
|
|
|
*
|
|
|
|
* Therefore, the two root processes exchange this information at this point.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
ompi_process_name_t *ompi_comm_get_rport (ompi_process_name_t *port,
|
2004-09-17 14:11:22 +04:00
|
|
|
int send_first, ompi_proc_t *proc,
|
|
|
|
int tag);
|
2004-08-05 20:31:30 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
2004-09-21 22:39:06 +04:00
|
|
|
/*
|
|
|
|
* 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);
|
|
|
|
|
|
|
|
|
2004-09-29 16:41:55 +04:00
|
|
|
/* start the new processes from MPI_Comm_spawn. Initial version,
|
|
|
|
* a version for Comm_spawn_multiple still missing.
|
|
|
|
*/
|
|
|
|
int ompi_comm_start_processes (char *command, char **argv, int maxprocs,
|
|
|
|
MPI_Info info, char *port_name);
|
|
|
|
|
2004-10-26 18:54:23 +04:00
|
|
|
/*
|
|
|
|
* This routine checks, whether an application has been spawned
|
|
|
|
* by another MPI application, or has been independently started.
|
|
|
|
* If it has been spawned, it establishes the parent communicator.
|
|
|
|
* Since the routine has to communicate, it should be among the last
|
|
|
|
* steps in MPI_Init, to be sure that everything is already set up.
|
|
|
|
*/
|
2004-09-29 16:41:55 +04:00
|
|
|
int ompi_comm_dyn_init(void);
|
|
|
|
|
2004-10-26 18:54:23 +04:00
|
|
|
/**
|
|
|
|
* Executes internally a disconnect on all dynamic communicators
|
|
|
|
* in case the user did not disconnect them.
|
|
|
|
*/
|
|
|
|
int ompi_comm_dyn_finalize(void);
|
|
|
|
|
2004-10-26 15:37:58 +04:00
|
|
|
/* this routine counts the number of different jobids of the processes
|
|
|
|
given in a certain communicator. If there is more than one jobid,
|
|
|
|
we mark the communicator as 'dynamic'. This is especially relevant
|
|
|
|
for the MPI_Comm_disconnect *and* for MPI_Finalize, where we have
|
|
|
|
to wait for all still connected processes. */
|
|
|
|
extern int ompi_comm_num_dyncomm;
|
|
|
|
void ompi_comm_mark_dyncomm (ompi_communicator_t *comm);
|
|
|
|
|
|
|
|
/* the next two routines implement a kind of non-blocking barrier.
|
|
|
|
the only difference is, that you can wait for the completion
|
|
|
|
of more than one initiated ibarrier. This is required for waiting
|
|
|
|
for all still connected processes in MPI_Finalize.
|
|
|
|
|
|
|
|
ompi_comm_disconnect_init returns a handle, which has to be passed in
|
|
|
|
to ompi_comm_disconnect_waitall. The second routine blocks, until
|
|
|
|
all non-blocking barriers described by the handles are finished.
|
|
|
|
The communicators can than be released.
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct ompi_comm_disconnect_obj {
|
|
|
|
ompi_communicator_t *comm;
|
|
|
|
int size;
|
|
|
|
ompi_request_t **reqs;
|
|
|
|
int buf;
|
|
|
|
};
|
|
|
|
typedef struct ompi_comm_disconnect_obj ompi_comm_disconnect_obj;
|
|
|
|
|
|
|
|
ompi_comm_disconnect_obj *ompi_comm_disconnect_init (ompi_communicator_t *comm);
|
|
|
|
void ompi_comm_disconnect_waitall (int count, ompi_comm_disconnect_obj **objs );
|
|
|
|
|
2004-02-05 04:52:56 +03:00
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
#endif /* OMPI_COMMUNICATOR_H */
|