File: groups.h

package info (click to toggle)
ga 5.9.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 18,472 kB
  • sloc: ansic: 192,963; fortran: 53,761; f90: 11,218; cpp: 5,784; makefile: 2,248; sh: 1,945; python: 1,734; perl: 534; csh: 134; asm: 106
file content (44 lines) | stat: -rw-r--r-- 1,521 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
 * Private header file for comex groups backed by MPI_comm.
 *
 * The rest of the comex group functions are defined in the public comex.h.
 * These are the private group functions.
 *
 * @author Jeff Daily
 */
#ifndef _COMEX_GROUPS_H_
#define _COMEX_GROUPS_H_

#include <mpi.h>

#include "comex.h"

typedef struct group_link {
    struct group_link *next;
    comex_group_t id;
    MPI_Comm comm;
    MPI_Group group;
} comex_igroup_t;

extern void comex_group_init();
extern void comex_group_finalize();
extern comex_igroup_t* comex_get_igroup_from_group(comex_group_t group);

/* verify that proc is part of group
 * translate proc to world group
 * change group to world group */
#define CHECK_GROUP(GROUP,PROC) do {                            \
    int size;                                                   \
    int ierr = comex_group_size(GROUP,&size);                   \
    assert(COMEX_SUCCESS == ierr);                              \
    assert(PROC >= 0);                                          \
    assert(PROC < size);                                        \
    if (COMEX_GROUP_WORLD != GROUP) {                           \
        int world_proc;                                         \
        comex_group_translate_world(GROUP, PROC, &world_proc);  \
        PROC = world_proc;                                      \
        GROUP = COMEX_GROUP_WORLD;                              \
    }                                                           \
} while(0)

#endif /* _COMEX_GROUPS_H_ */