ssg-internal.h 1.48 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 <mercury.h>
#include <abt.h>
Jonathan Jenkins's avatar
Jonathan Jenkins committed
15
#include <margo.h>
16
#include <ssg.h>
17

18 19
#if USE_SWIM_FD
#include "swim-fd/swim-fd.h"
20
#endif
Jonathan Jenkins's avatar
Jonathan Jenkins committed
21

22 23 24 25
// define an identifier for an unknown group rank value
// TODO: move to SWIM? only used by the swim module so far
#define SSG_MEMBER_RANK_UNKNOWN (-1)

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

39 40 41 42 43 44 45 46 47 48 49 50 51
typedef struct ssg_view ssg_view_t;
typedef struct ssg_member_state ssg_member_state_t;

struct ssg_view
{
    int self_rank;
    int group_size;
    ssg_member_state_t *member_states;
};

struct ssg_member_state
{
    hg_addr_t addr;
52 53 54 55
#if USE_SWIM_FD
    int swim_susp_level;
    int swim_inc_nr;
#endif
56 57
};

Jonathan Jenkins's avatar
Jonathan Jenkins committed
58 59
struct ssg
{
60
    margo_instance_id mid;
Shane Snyder's avatar
Shane Snyder committed
61
    ssg_view_t view; // TODO: we probably need to protect access to this structure at very least
62 63 64
#if USE_SWIM_FD
    swim_context_t *swim_ctx;
#endif
Shane Snyder's avatar
Shane Snyder committed
65 66 67
#ifdef DEBUG
    FILE *dbg_strm;
#endif
68
#if 0
Jonathan Jenkins's avatar
Jonathan Jenkins committed
69 70 71 72 73 74
    hg_id_t barrier_rpc_id;
    int barrier_id;
    int barrier_count;
    ABT_mutex barrier_mutex;
    ABT_cond  barrier_cond;
    ABT_eventual barrier_eventual;
75
#endif
Jonathan Jenkins's avatar
Jonathan Jenkins committed
76
};
Shane Snyder's avatar
Shane Snyder committed
77 78 79 80

#ifdef __cplusplus
}
#endif