ssg-internal.h 1.35 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 38 39 40
extern void hashlittle2(const void *key, size_t length, uint32_t *pc, uint32_t *pb);
#define ssg_hashlittle2 hashlittle2

#define SSG_MAGIC_NR 17321588

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

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

51
struct ssg_group_view
52 53 54 55 56
{
    int group_size;
    ssg_member_state_t *member_states;
};

57
struct ssg_group
Jonathan Jenkins's avatar
Jonathan Jenkins committed
58
{
59 60 61 62
    char *name;
    ssg_group_id_t id;
    int self_rank;
    ssg_group_view_t view;
63
    void *fd_ctx; /* failure detector context (currently just SWIM) */
Jonathan Jenkins's avatar
Jonathan Jenkins committed
64
};
Shane Snyder's avatar
Shane Snyder committed
65

66 67 68
/* XXX: is this right? can this be a global? */
extern margo_instance_id ssg_mid; 

Shane Snyder's avatar
Shane Snyder committed
69 70 71
#ifdef __cplusplus
}
#endif