ssg-internal.h 1.2 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"
Jonathan Jenkins's avatar
Jonathan Jenkins committed
21

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

36 37
typedef struct ssg_group ssg_group_t;
typedef struct ssg_group_view ssg_group_view_t;
38
typedef struct ssg_member_state ssg_member_state_t;
39 40 41 42 43 44

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

46
struct ssg_group_view
47 48 49 50 51
{
    int group_size;
    ssg_member_state_t *member_states;
};

52
struct ssg_group
Jonathan Jenkins's avatar
Jonathan Jenkins committed
53
{
54 55 56 57
    char *name;
    ssg_group_id_t id;
    int self_rank;
    ssg_group_view_t view;
58
    void *fd_ctx; /* failure detector context (currently just SWIM) */
Jonathan Jenkins's avatar
Jonathan Jenkins committed
59
};
Shane Snyder's avatar
Shane Snyder committed
60

61 62 63
/* XXX: is this right? can this be a global? */
extern margo_instance_id ssg_mid; 

Shane Snyder's avatar
Shane Snyder committed
64 65 66
#ifdef __cplusplus
}
#endif