2004-01-10 01:09:51 +03:00
|
|
|
/*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2004-01-10 11:20:15 +03:00
|
|
|
#ifndef LAM_COMMUNICATOR_H
|
|
|
|
#define LAM_COMMUNICATOR_H
|
2004-01-10 01:09:51 +03:00
|
|
|
|
2004-01-10 11:20:15 +03:00
|
|
|
#include "lam/stdint.h"
|
2004-02-13 16:56:55 +03:00
|
|
|
#include "lam/lfc/lam_object.h"
|
2004-01-10 01:09:51 +03:00
|
|
|
#include "lam/threads/mutex.h"
|
2004-02-10 03:09:36 +03:00
|
|
|
#include "lam/util/output.h"
|
2004-01-11 03:13:22 +03:00
|
|
|
#include "mpi.h"
|
|
|
|
#include "mpi/group/group.h"
|
2004-01-10 01:09:51 +03:00
|
|
|
#include "mca/mpi/coll/coll.h"
|
|
|
|
|
2004-02-06 07:20:13 +03:00
|
|
|
|
2004-02-13 16:56:55 +03:00
|
|
|
extern lam_class_t lam_communicator_t_class;
|
|
|
|
|
|
|
|
|
2004-01-10 20:05:04 +03:00
|
|
|
struct lam_communicator_t {
|
2004-02-13 16:56:55 +03:00
|
|
|
lam_object_t c_base;
|
2004-01-10 01:09:51 +03:00
|
|
|
char c_name[MPI_MAX_OBJECT_NAME];
|
2004-01-10 11:20:15 +03:00
|
|
|
uint32_t c_contextid;
|
2004-02-13 16:56:55 +03:00
|
|
|
int c_my_rank;
|
2004-01-10 01:09:51 +03:00
|
|
|
|
2004-01-10 20:05:04 +03:00
|
|
|
lam_group_t *c_local_group;
|
|
|
|
lam_group_t *c_remote_group;
|
2004-01-10 01:09:51 +03:00
|
|
|
|
2004-01-10 11:20:15 +03:00
|
|
|
/* Attributes */
|
2004-01-10 01:09:51 +03:00
|
|
|
|
2004-01-10 11:20:15 +03:00
|
|
|
/* Topology information */
|
2004-01-10 01:09:51 +03:00
|
|
|
|
2004-01-10 11:20:15 +03:00
|
|
|
/* Error handling */
|
2004-01-10 01:09:51 +03:00
|
|
|
|
2004-01-10 11:20:15 +03:00
|
|
|
MPI_Errhandler c_error_handler;
|
2004-01-10 01:09:51 +03:00
|
|
|
|
2004-01-10 11:20:15 +03:00
|
|
|
/* Hooks for PML to hang things */
|
2004-01-14 20:40:12 +03:00
|
|
|
struct mca_pml_comm_t* c_pml_comm;
|
2004-01-10 01:09:51 +03:00
|
|
|
|
2004-01-10 11:20:15 +03:00
|
|
|
/* Hooks for collectives to hang things */
|
2004-01-10 01:09:51 +03:00
|
|
|
|
2004-01-12 00:32:57 +03:00
|
|
|
mca_coll_1_0_0_t c_coll;
|
2004-01-10 11:20:15 +03:00
|
|
|
struct mca_coll_comm_t* c_coll_comm;
|
2004-01-10 20:05:04 +03:00
|
|
|
};
|
|
|
|
typedef struct lam_communicator_t lam_communicator_t;
|
2004-01-10 01:09:51 +03:00
|
|
|
|
2004-01-11 02:12:43 +03:00
|
|
|
|
|
|
|
/* return pointer to communicator associated with context id cid,
|
|
|
|
* No error checking is done*/
|
2004-01-12 21:47:12 +03:00
|
|
|
static inline lam_communicator_t *lam_comm_lookup(uint32_t cid)
|
2004-01-11 02:12:43 +03:00
|
|
|
{
|
|
|
|
/* array of pointers to communicators, indexed by context ID */
|
2004-02-04 00:33:29 +03:00
|
|
|
extern lam_communicator_t **lam_mpi_comm_array;
|
2004-02-13 08:38:24 +03:00
|
|
|
#if LAM_ENABLE_DEBUG
|
2004-02-04 00:33:29 +03:00
|
|
|
extern uint32_t lam_mpi_comm_array_size;
|
2004-02-10 03:09:36 +03:00
|
|
|
if (cid >= lam_mpi_comm_array_size) {
|
2004-01-29 01:52:51 +03:00
|
|
|
lam_output(0, "lam_comm_lookup: invalid communicator index (%d)", cid);
|
2004-01-11 02:12:43 +03:00
|
|
|
return (lam_communicator_t *) NULL;
|
2004-01-29 01:52:51 +03:00
|
|
|
}
|
2004-01-11 02:12:43 +03:00
|
|
|
#endif
|
2004-02-04 00:33:29 +03:00
|
|
|
return lam_mpi_comm_array[cid];
|
2004-01-11 02:12:43 +03:00
|
|
|
}
|
|
|
|
|
2004-02-13 16:56:55 +03:00
|
|
|
static inline lam_proc_t* lam_comm_lookup_peer(lam_communicator_t* comm, int peer_id)
|
2004-01-12 21:47:12 +03:00
|
|
|
{
|
2004-02-13 08:38:24 +03:00
|
|
|
#if LAM_ENABLE_DEBUG
|
2004-02-12 01:55:06 +03:00
|
|
|
if(peer_id >= comm->c_remote_group->grp_proc_count) {
|
2004-01-29 01:52:51 +03:00
|
|
|
lam_output(0, "lam_comm_lookup_peer: invalid peer index (%d)", peer_id);
|
2004-01-12 21:47:12 +03:00
|
|
|
return (lam_proc_t *) NULL;
|
2004-01-29 01:52:51 +03:00
|
|
|
}
|
2004-01-12 21:47:12 +03:00
|
|
|
#endif
|
2004-02-12 01:55:06 +03:00
|
|
|
return comm->c_remote_group->grp_proc_pointers[peer_id];
|
2004-01-12 21:47:12 +03:00
|
|
|
}
|
|
|
|
|
2004-02-06 07:20:13 +03:00
|
|
|
|
2004-02-05 04:52:56 +03:00
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2004-02-13 16:56:55 +03:00
|
|
|
int lam_comm_init(void);
|
|
|
|
int lam_comm_link_function(void);
|
2004-02-05 04:52:56 +03:00
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2004-01-10 01:09:51 +03:00
|
|
|
#endif /* LAM_COMMUNICATOR_H */
|