OpenMPI  0.1.1
group.h File Reference

Infrastructure for MPI group support. More...

#include "ompi_config.h"
#include "ompi/proc/proc.h"
#include "mpi.h"
#include "opal/class/opal_pointer_array.h"
#include "opal/util/output.h"
#include "group_dbg.h"

Go to the source code of this file.

Data Structures

struct  ompi_group_sporadic_list_t
 
struct  ompi_group_sporadic_data_t
 
struct  ompi_group_strided_data_t
 
struct  ompi_group_bitmap_data_t
 
struct  ompi_group_t
 Group structure Currently we have four formats for storing the process pointers that are members of the group. More...
 
struct  ompi_predefined_group_t
 

Macros

#define BSIZE   ((int)sizeof(unsigned char)*8)
 
#define PREDEFINED_GROUP_PAD   (sizeof(void*) * 32)
 Padded struct to maintain back compatibiltiy. More...
 
#define OMPI_GROUP_IS_INTRINSIC(_group)   ((_group)->grp_flags&OMPI_GROUP_INTRINSIC)
 
#define OMPI_GROUP_IS_DENSE(_group)   ((_group)->grp_flags & OMPI_GROUP_DENSE)
 
#define OMPI_GROUP_IS_SPORADIC(_group)   ((_group)->grp_flags & OMPI_GROUP_SPORADIC)
 
#define OMPI_GROUP_IS_STRIDED(_group)   ((_group)->grp_flags & OMPI_GROUP_STRIDED)
 
#define OMPI_GROUP_IS_BITMAP(_group)   ((_group)->grp_flags & OMPI_GROUP_BITMAP)
 
#define OMPI_GROUP_SET_INTRINSIC(_group)   ( (_group)->grp_flags |= OMPI_GROUP_INTRINSIC)
 
#define OMPI_GROUP_SET_DENSE(_group)   ( (_group)->grp_flags |= OMPI_GROUP_DENSE)
 
#define OMPI_GROUP_SET_SPORADIC(_group)   ( (_group)->grp_flags |= OMPI_GROUP_SPORADIC)
 
#define OMPI_GROUP_SET_STRIDED(_group)   ( (_group)->grp_flags |= OMPI_GROUP_STRIDED)
 
#define OMPI_GROUP_SET_BITMAP(_group)   ( (_group)->grp_flags |= OMPI_GROUP_BITMAP)
 

Typedefs

typedef struct ompi_group_t ompi_group_t
 
typedef struct
ompi_predefined_group_t 
ompi_predefined_group_t
 

Functions

OMPI_DECLSPEC OBJ_CLASS_DECLARATION (ompi_group_t)
 
OMPI_DECLSPEC ompi_group_tompi_group_allocate (int group_size)
 Allocate a new group structure. More...
 
ompi_group_tompi_group_allocate_sporadic (int group_size)
 
ompi_group_tompi_group_allocate_strided (void)
 
ompi_group_tompi_group_allocate_bmap (int orig_group_size, int group_size)
 
OMPI_DECLSPEC void ompi_group_increment_proc_count (ompi_group_t *group)
 Increment the reference count of the proc structures. More...
 
OMPI_DECLSPEC void ompi_group_decrement_proc_count (ompi_group_t *group)
 Decrement the reference count of the proc structures. More...
 
int ompi_group_init (void)
 Initialize OMPI group infrastructure. More...
 
int ompi_group_finalize (void)
 Clean up OMPI group infrastructure. More...
 
static int ompi_group_size (ompi_group_t *group)
 Get group size. More...
 
static int ompi_group_rank (ompi_group_t *group)
 Get group rank. More...
 
void ompi_set_group_rank (ompi_group_t *group, struct ompi_proc_t *proc_pointer)
 Set group rank in the input group structure. More...
 
OMPI_DECLSPEC int ompi_group_translate_ranks (ompi_group_t *group1, int n_ranks, int *ranks1, ompi_group_t *group2, int *ranks2)
 Abstracting MPI_Group_translate_ranks to an ompi function for internal use.
 
OMPI_DECLSPEC int ompi_group_compare (ompi_group_t *group1, ompi_group_t *group2, int *result)
 Abstracting MPI_Group_compare to an ompi function for internal use.
 
int ompi_group_free (ompi_group_t **group)
 Abstracting MPI_Group_free, since it is required by some internal functions...
 
OMPI_DECLSPEC ompi_proc_tompi_group_get_proc_ptr (ompi_group_t *group, int rank)
 Functions to handle process pointers for sparse group formats.
 
int ompi_group_translate_ranks_sporadic (ompi_group_t *group1, int n_ranks, int *ranks1, ompi_group_t *group2, int *ranks2)
 
int ompi_group_translate_ranks_sporadic_reverse (ompi_group_t *group1, int n_ranks, int *ranks1, ompi_group_t *group2, int *ranks2)
 
int ompi_group_translate_ranks_strided (ompi_group_t *group1, int n_ranks, int *ranks1, ompi_group_t *group2, int *ranks2)
 
int ompi_group_translate_ranks_strided_reverse (ompi_group_t *group1, int n_ranks, int *ranks1, ompi_group_t *group2, int *ranks2)
 
int ompi_group_translate_ranks_bmap (ompi_group_t *group1, int n_ranks, int *ranks1, ompi_group_t *group2, int *ranks2)
 
int ompi_group_translate_ranks_bmap_reverse (ompi_group_t *group1, int n_ranks, int *ranks1, ompi_group_t *group2, int *ranks2)
 
OMPI_DECLSPEC int ompi_group_incl (ompi_group_t *group, int n, int *ranks, ompi_group_t **new_group)
 Prototypes for the group back-end functions. More...
 
int ompi_group_excl (ompi_group_t *group, int n, int *ranks, ompi_group_t **new_group)
 
int ompi_group_range_incl (ompi_group_t *group, int n_triplets, int ranges[][3], ompi_group_t **new_group)
 
int ompi_group_range_excl (ompi_group_t *group, int n_triplets, int ranges[][3], ompi_group_t **new_group)
 
int ompi_group_union (ompi_group_t *group1, ompi_group_t *group2, ompi_group_t **new_group)
 
int ompi_group_intersection (ompi_group_t *group1, ompi_group_t *group2, ompi_group_t **new_group)
 
int ompi_group_difference (ompi_group_t *group1, ompi_group_t *group2, ompi_group_t **new_group)
 
int ompi_group_incl_plist (ompi_group_t *group, int n, int *ranks, ompi_group_t **new_group)
 Include Functions to handle Sparse storage formats.
 
int ompi_group_incl_spor (ompi_group_t *group, int n, int *ranks, ompi_group_t **new_group)
 
int ompi_group_incl_strided (ompi_group_t *group, int n, int *ranks, ompi_group_t **new_group)
 
int ompi_group_incl_bmap (ompi_group_t *group, int n, int *ranks, ompi_group_t **new_group)
 
int ompi_group_calc_plist (int n, int *ranks)
 Functions to calculate storage spaces.
 
int ompi_group_calc_strided (int n, int *ranks)
 
int ompi_group_calc_sporadic (int n, int *ranks)
 
int ompi_group_calc_bmap (int n, int orig_size, int *ranks)
 
int ompi_group_minloc (int list[], int length)
 Function to return the minimum value in an array.
 
static struct ompi_proc_tompi_group_peer_lookup (ompi_group_t *group, int peer_id)
 Inline function to check if sparse groups are enabled and return the direct access to the proc pointer, otherwise the lookup function.
 
OMPI_DECLSPEC int ompi_group_peer_lookup_id (ompi_group_t *group, ompi_proc_t *proc)
 Determine the rank of the specified process in this group.
 
int ompi_group_dump (ompi_group_t *group)
 Function to print the group info.
 
int ompi_group_div_ceil (int num, int den)
 Ceil Function so not to include the math.h lib.
 

Variables

OMPI_DECLSPEC struct
opal_pointer_array_t 
ompi_group_f_to_c_table
 Table for Fortran <-> C group handle conversion.
 
OMPI_DECLSPEC struct
ompi_predefined_group_t 
ompi_mpi_group_null
 

Detailed Description

Infrastructure for MPI group support.

Macro Definition Documentation

#define PREDEFINED_GROUP_PAD   (sizeof(void*) * 32)

Padded struct to maintain back compatibiltiy.

See ompi/communicator/communicator.h comments with struct ompi_communicator_t for full explanation why we chose the following padding construct for predefines.

Function Documentation

OMPI_DECLSPEC ompi_group_t* ompi_group_allocate ( int  group_size)

Allocate a new group structure.

Parameters
group_sizeNumber of MPI processes in the group
Returns
Pointer to new group structure

References ompi_group_t::grp_f_to_c_index, ompi_group_t::grp_my_rank, ompi_group_t::grp_proc_count, ompi_group_t::grp_proc_pointers, and OBJ_RELEASE.

Referenced by ompi_group_incl_plist().

OMPI_DECLSPEC void ompi_group_decrement_proc_count ( ompi_group_t group)

Decrement the reference count of the proc structures.

Parameters
groupPointer to ompi_group_t structute (IN)

References ompi_group_t::grp_proc_count, OBJ_RELEASE, and ompi_group_peer_lookup().

Referenced by ompi_group_free().

int ompi_group_finalize ( void  )

Clean up OMPI group infrastructure.

Returns
Error code

References ompi_group_t::grp_flags, OBJ_DESTRUCT, and OBJ_RELEASE.

Referenced by ompi_mpi_finalize().

OMPI_DECLSPEC int ompi_group_incl ( ompi_group_t group,
int  n,
int *  ranks,
ompi_group_t **  new_group 
)

Prototypes for the group back-end functions.

Argument lists are similar to the according C MPI functions.

References ompi_group_t::grp_proc_count, ompi_group_calc_plist(), ompi_group_incl_plist(), and ompi_group_minloc().

OMPI_DECLSPEC void ompi_group_increment_proc_count ( ompi_group_t group)

Increment the reference count of the proc structures.

Parameters
groupPointer to ompi_group_t structute (IN)

References ompi_group_t::grp_proc_count, OBJ_RETAIN, and ompi_group_peer_lookup().

Referenced by ompi_group_incl_plist().

int ompi_group_init ( void  )
static int ompi_group_rank ( ompi_group_t group)
inlinestatic

Get group rank.

Parameters
groupPointer to ompi_group_t structure (IN)
Returns
Group rank

References ompi_group_t::grp_my_rank.

static int ompi_group_size ( ompi_group_t group)
inlinestatic

Get group size.

Parameters
groupPointer to ompi_group_t structute (IN)
Returns
Group size

References ompi_group_t::grp_proc_count.

void ompi_set_group_rank ( ompi_group_t group,
struct ompi_proc_t proc_pointer 
)

Set group rank in the input group structure.

Parameters
groupGroup Pointer to ompi_group_t structure (INOUT)
proc_pointerPointer to ompi_proc_t structure for process. MPI_PROC_NULL may be used to indicate proc not in group
Returns
Error code

References ompi_group_t::grp_my_rank, ompi_group_t::grp_proc_count, and ompi_group_peer_lookup().

Referenced by ompi_group_incl_plist().