2004-01-10 01:09:51 +03:00
|
|
|
/*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2004-04-14 03:42:31 +04:00
|
|
|
/**
|
|
|
|
* @file:
|
|
|
|
*
|
|
|
|
* Infrastructure for MPI group support.
|
|
|
|
*/
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
#ifndef OMPI_GROUP_H
|
|
|
|
#define OMPI_GROUP_H
|
2004-01-10 01:09:51 +03:00
|
|
|
|
2004-06-15 04:08:57 +04:00
|
|
|
#include "util/output.h"
|
2004-01-10 01:09:51 +03:00
|
|
|
#include "mpi.h"
|
2004-03-17 21:45:16 +03:00
|
|
|
#include "proc/proc.h"
|
2004-06-07 19:33:53 +04:00
|
|
|
#include "class/ompi_pointer_array.h"
|
2004-03-15 05:25:49 +03:00
|
|
|
|
2004-04-14 03:42:31 +04:00
|
|
|
/**
|
|
|
|
* Group structure
|
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
struct ompi_group_t {
|
2004-06-15 04:08:57 +04:00
|
|
|
ompi_object_t super; /**< base class */
|
2004-04-14 03:42:31 +04:00
|
|
|
int grp_proc_count; /**< number of processes in group */
|
|
|
|
int grp_my_rank; /**< rank in group */
|
|
|
|
int grp_f_to_c_index; /**< index in Fortran <-> C translation array */
|
2004-06-15 04:08:57 +04:00
|
|
|
uint32_t grp_flags; /**< flags, e.g. freed, cannot be freed etc.*/
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_proc_t **grp_proc_pointers;
|
|
|
|
/**< list of pointers to ompi_proc_t structures
|
2004-06-15 04:08:57 +04:00
|
|
|
for each process in the group */
|
2004-01-10 20:10:29 +03:00
|
|
|
};
|
2004-06-07 19:33:53 +04:00
|
|
|
typedef struct ompi_group_t ompi_group_t;
|
|
|
|
OBJ_CLASS_DECLARATION(ompi_group_t);
|
2004-01-10 01:09:51 +03:00
|
|
|
|
2004-04-14 03:42:31 +04:00
|
|
|
|
2004-06-15 04:08:57 +04:00
|
|
|
/* Some definitions for the flags */
|
|
|
|
#define OMPI_GROUP_ISFREED 0x00000001
|
|
|
|
#define OMPI_GROUP_INTRINSIC 0x00000002
|
|
|
|
|
|
|
|
#define OMPI_GROUP_IS_INTRINSIC(_group) ((_group)->grp_flags&OMPI_GROUP_INTRINSIC)
|
|
|
|
|
2004-04-14 03:42:31 +04:00
|
|
|
/**
|
2004-02-13 02:23:03 +03:00
|
|
|
* Table for Fortran <-> C group handle conversion
|
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
extern ompi_pointer_array_t *ompi_group_f_to_c_table;
|
2004-02-13 02:23:03 +03:00
|
|
|
|
2004-04-14 03:42:31 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* function prototypes
|
2004-02-13 02:23:03 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2004-04-14 03:42:31 +04:00
|
|
|
* Allocate a new group structure.
|
2004-02-13 02:23:03 +03:00
|
|
|
*
|
|
|
|
* @param group_size Number of MPI processes in the group
|
|
|
|
*
|
|
|
|
* @return Pointer to new group structure
|
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_group_t *ompi_group_allocate(int group_size);
|
2004-02-13 02:23:03 +03:00
|
|
|
|
2004-04-14 03:42:31 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Increment the reference count of the proc structures.
|
|
|
|
*
|
2004-06-07 19:33:53 +04:00
|
|
|
* @param group Pointer to ompi_group_t structute (IN)
|
2004-04-14 03:42:31 +04:00
|
|
|
*
|
2004-03-16 01:14:08 +03:00
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
void ompi_group_increment_proc_count(ompi_group_t *group);
|
2004-03-16 01:14:08 +03:00
|
|
|
|
2004-04-14 03:42:31 +04:00
|
|
|
|
2004-02-13 02:23:03 +03:00
|
|
|
/**
|
2004-06-07 19:33:53 +04:00
|
|
|
* Initialize OMPI group infrastructure.
|
2004-02-13 02:23:03 +03:00
|
|
|
*
|
|
|
|
* @return Error code
|
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
int ompi_group_init(void);
|
2004-02-13 02:23:03 +03:00
|
|
|
|
2004-04-14 03:42:31 +04:00
|
|
|
|
2004-02-13 19:23:29 +03:00
|
|
|
/**
|
2004-06-07 19:33:53 +04:00
|
|
|
* Clean up OMPI group infrastructure.
|
2004-02-13 19:23:29 +03:00
|
|
|
*
|
|
|
|
* @return Error code
|
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
int ompi_group_finalize(void);
|
2004-02-13 19:23:29 +03:00
|
|
|
|
2004-04-14 03:42:31 +04:00
|
|
|
|
2004-02-13 19:41:53 +03:00
|
|
|
/**
|
2004-04-14 03:42:31 +04:00
|
|
|
* Get group size.
|
2004-02-13 19:41:53 +03:00
|
|
|
*
|
2004-06-07 19:33:53 +04:00
|
|
|
* @param group Pointer to ompi_group_t structute (IN)
|
2004-02-13 19:41:53 +03:00
|
|
|
*
|
|
|
|
* @return Group size
|
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
static inline int ompi_group_size(ompi_group_t *group)
|
2004-04-14 03:42:31 +04:00
|
|
|
{
|
2004-02-13 19:41:53 +03:00
|
|
|
return group->grp_proc_count;
|
|
|
|
}
|
|
|
|
|
2004-04-14 03:42:31 +04:00
|
|
|
|
2004-02-13 19:41:53 +03:00
|
|
|
/**
|
|
|
|
* Get group rank
|
|
|
|
*
|
2004-06-07 19:33:53 +04:00
|
|
|
* @param group Pointer to ompi_group_t structure (IN)
|
2004-02-13 19:41:53 +03:00
|
|
|
*
|
|
|
|
* @return Group rank
|
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
static inline int ompi_group_rank(ompi_group_t *group)
|
2004-04-14 03:42:31 +04:00
|
|
|
{
|
2004-06-15 04:08:57 +04:00
|
|
|
return group->grp_my_rank;
|
2004-02-13 19:41:53 +03:00
|
|
|
}
|
2004-02-27 22:22:14 +03:00
|
|
|
|
2004-04-14 03:42:31 +04:00
|
|
|
|
2004-02-27 22:22:14 +03:00
|
|
|
/**
|
|
|
|
* Set group rank in the input group structure
|
|
|
|
*
|
2004-06-07 19:33:53 +04:00
|
|
|
* @param group Group Pointer to ompi_group_t structure (IN)
|
|
|
|
* @param proc_pointer Pointer to ompi_proc_t structure for process.
|
2004-02-27 22:22:14 +03:00
|
|
|
* MPI_PROC_NULL may be used to indicate proc not
|
|
|
|
* in group
|
|
|
|
*
|
|
|
|
* @return Error code
|
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
void ompi_set_group_rank(ompi_group_t *group, ompi_proc_t *proc_pointer);
|
2004-02-27 22:22:14 +03:00
|
|
|
|
2004-08-04 02:06:49 +04:00
|
|
|
/**
|
|
|
|
* Abstracting MPI_Group_translate_ranks to an ompi function for internal use
|
|
|
|
*/
|
|
|
|
int ompi_group_translate_ranks ( ompi_group_t *group1,
|
|
|
|
int n_ranks, int *ranks1,
|
|
|
|
ompi_group_t *group2,
|
|
|
|
int *ranks2);
|
|
|
|
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
#endif /* OMPI_GROUP_H */
|