ssg-internal.h 1.15 KB
Newer Older
1 2 3 4 5
/*
 * Copyright (c) 2016 UChicago Argonne, LLC
 *
 * See COPYRIGHT in top-level directory.
 */
Shane Snyder's avatar
Shane Snyder committed
6

Jonathan Jenkins's avatar
Jonathan Jenkins committed
7
#pragma once
Shane Snyder's avatar
Shane Snyder committed
8

Shane Snyder's avatar
Shane Snyder committed
9 10 11 12
#ifdef __cplusplus
extern "C" {
#endif

Shane Snyder's avatar
Shane Snyder committed
13 14
#include <stdint.h>
#include <inttypes.h>
15

Shane Snyder's avatar
Shane Snyder committed
16 17
#include <mercury.h>
#include <abt.h>
Jonathan Jenkins's avatar
Jonathan Jenkins committed
18
#include <margo.h>
19

20
#include <ssg.h>
21 22
#if USE_SWIM_FD
#include "swim-fd/swim-fd.h"
23
#endif
Jonathan Jenkins's avatar
Jonathan Jenkins committed
24

25 26
/* debug printing macro for SSG */
/* TODO: direct debug output to file? */
Shane Snyder's avatar
Shane Snyder committed
27
#ifdef DEBUG
28
#define SSG_DEBUG(__g, __fmt, ...) do { \
Shane Snyder's avatar
Shane Snyder committed
29
    double __now = ABT_get_wtime(); \
Shane Snyder's avatar
Shane Snyder committed
30 31
    fprintf(stdout, "%.6lf <%s:%d>: " __fmt, __now, \
        __g->name, __g->self_rank, ## __VA_ARGS__); \
32
    fflush(stdout); \
Shane Snyder's avatar
Shane Snyder committed
33 34
} while(0)
#else
35
#define SSG_DEBUG(__g, __fmt, ...) do { \
Shane Snyder's avatar
Shane Snyder committed
36 37 38
} while(0)
#endif

39 40
typedef struct ssg_group ssg_group_t;
typedef struct ssg_group_view ssg_group_view_t;
41
typedef struct ssg_member_state ssg_member_state_t;
42 43 44 45 46 47

struct ssg_member_state
{
    hg_addr_t addr;
    int is_member;
};
48

49
struct ssg_group_view
50 51 52 53 54
{
    int group_size;
    ssg_member_state_t *member_states;
};

55
struct ssg_group
Jonathan Jenkins's avatar
Jonathan Jenkins committed
56
{
57 58 59 60
    char *name;
    ssg_group_id_t id;
    int self_rank;
    ssg_group_view_t view;
61 62 63
#if USE_SWIM_FD
    swim_context_t *swim_ctx;
#endif
Jonathan Jenkins's avatar
Jonathan Jenkins committed
64
};
Shane Snyder's avatar
Shane Snyder committed
65 66 67 68

#ifdef __cplusplus
}
#endif