2004-01-09 22:09:51 +00:00
|
|
|
/*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef LAM_GROUP_H
|
|
|
|
#define LAM_GROUP_H
|
|
|
|
|
|
|
|
#include "mpi.h"
|
2004-03-17 18:45:16 +00:00
|
|
|
#include "proc/proc.h"
|
|
|
|
#include "lfc/lam_pointer_array.h"
|
2004-03-15 02:25:49 +00:00
|
|
|
|
|
|
|
/* This must correspond to the fortran MPI_GROUP_NULL index */
|
|
|
|
#define LAM_GROUP_NULL_FORTRAN 0
|
|
|
|
|
|
|
|
/* This must correspond to the fortran MPI_GROUP_EMPTY index */
|
|
|
|
#define LAM_GROUP_EMPTY_FORTRAN 1
|
|
|
|
|
2004-02-12 23:23:03 +00:00
|
|
|
extern lam_class_t lam_group_t_class;
|
2004-01-09 22:09:51 +00:00
|
|
|
|
2004-01-10 17:10:29 +00:00
|
|
|
struct lam_group_t {
|
2004-02-11 22:55:06 +00:00
|
|
|
/* base class */
|
|
|
|
lam_object_t super;
|
|
|
|
/* number of processes in group */
|
|
|
|
int grp_proc_count;
|
|
|
|
/* rank in group */
|
|
|
|
int grp_my_rank;
|
|
|
|
/* index in Fortran <-> C translation array */
|
|
|
|
int grp_f_to_c_index;
|
|
|
|
/* list of pointers to lam_proc_t structures for each
|
|
|
|
* process in the group */
|
|
|
|
lam_proc_t **grp_proc_pointers;
|
2004-01-10 17:10:29 +00:00
|
|
|
};
|
|
|
|
typedef struct lam_group_t lam_group_t;
|
2004-01-09 22:09:51 +00:00
|
|
|
|
2004-02-12 23:23:03 +00:00
|
|
|
/*
|
|
|
|
* Table for Fortran <-> C group handle conversion
|
|
|
|
*/
|
|
|
|
extern lam_pointer_array_t *lam_group_f_to_c_table;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* function prototypes
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This routine is used to allocate a new group structure
|
|
|
|
*
|
|
|
|
* @param group_size Number of MPI processes in the group
|
|
|
|
*
|
|
|
|
* @return Pointer to new group structure
|
|
|
|
*/
|
2004-03-19 06:06:52 +00:00
|
|
|
lam_group_t *lam_group_allocate(int group_size);
|
2004-02-12 23:23:03 +00:00
|
|
|
|
2004-03-15 22:14:08 +00:00
|
|
|
/*
|
|
|
|
* increment the reference count of the proc structures
|
|
|
|
*/
|
|
|
|
void lam_group_increment_proc_count(lam_group_t *group);
|
|
|
|
|
2004-02-12 23:23:03 +00:00
|
|
|
/**
|
|
|
|
* Initialize LAM group infrastructure
|
|
|
|
*
|
|
|
|
* @return Error code
|
|
|
|
*/
|
|
|
|
int lam_group_init(void);
|
|
|
|
|
2004-02-13 16:23:29 +00:00
|
|
|
/**
|
|
|
|
* Clean up LAM group infrastructure
|
|
|
|
*
|
|
|
|
* @return Error code
|
|
|
|
*/
|
|
|
|
int lam_group_finalize(void);
|
|
|
|
|
2004-02-13 16:41:53 +00:00
|
|
|
/**
|
|
|
|
* Get group size
|
|
|
|
*
|
|
|
|
* @param group Pointer to lam_group_t structute (IN)
|
|
|
|
*
|
|
|
|
* @return Group size
|
|
|
|
*/
|
|
|
|
static inline int lam_group_size(lam_group_t *group){
|
|
|
|
return group->grp_proc_count;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get group rank
|
|
|
|
*
|
2004-02-27 19:22:14 +00:00
|
|
|
* @param group Pointer to lam_group_t structure (IN)
|
2004-02-13 16:41:53 +00:00
|
|
|
*
|
|
|
|
* @return Group rank
|
|
|
|
*/
|
|
|
|
static inline int lam_group_rank(lam_group_t *group){
|
|
|
|
return group->grp_proc_count;
|
|
|
|
}
|
2004-02-27 19:22:14 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set group rank in the input group structure
|
|
|
|
*
|
|
|
|
* @param group Group Pointer to lam_group_t structure (IN)
|
|
|
|
* @param proc_pointer Pointer to lam_proc_t structure for process.
|
|
|
|
* MPI_PROC_NULL may be used to indicate proc not
|
|
|
|
* in group
|
|
|
|
*
|
|
|
|
* @return Error code
|
|
|
|
*/
|
|
|
|
void lam_set_group_rank(lam_group_t *group, lam_proc_t *proc_pointer);
|
|
|
|
|
2004-01-09 22:09:51 +00:00
|
|
|
#endif /* LAM_GROUP_H */
|