Commit 204f14c7 authored by Shane Snyder's avatar Shane Snyder

implement group_create fns for ssg api

parent 07775bdc
......@@ -28,7 +28,7 @@ extern "C" {
#define SSG_SUCCESS 0
/* TODO: define some errors? */
#define SSG_GROUP_NULL 0
#define SSG_GROUP_ID_NULL 0
/* XXX: actually define what these are */
typedef int ssg_group_id_t;
......@@ -57,17 +57,19 @@ void ssg_finalize(
/**
* Creates an SSG group from a given list of HG address strings.
* @params[in] group_name Name of the SSG group
* @params[in] hg_addr_strs Array of HG address strings for each group member
* @returns SSG group ID on success, SSG_GROUP_NULL otherwise
* @params[in] group_name Name of the SSG group
* @params[in] group_addr_strs Array of HG address strings for each group member
* @params[in] group_size Number of group members
* @returns SSG group ID on success, SSG_GROUP_ID_NULL otherwise
*
* NOTE: The HG address string of the caller of this function must be present in
* the list of address strings given in 'hg_addr_strs'. That is, the caller of
* this function is required to be a member of the SSG group that is created.
* the list of address strings given in 'group_addr_strs'. That is, the caller
* of this function is required to be a member of the SSG group that is created.
*/
ssg_group_id_t ssg_group_create(
const char *group_name,
const char * const hg_addr_strs[]);
const char * group_name,
const char * const group_addr_strs[],
int group_size);
/**
* Creates an SSG group from a given config file containing the HG address strings
......@@ -75,25 +77,25 @@ ssg_group_id_t ssg_group_create(
* @params[in] group_name Name of the SSG group
* @params[in] file_name Name of the config file containing the corresponding
* HG address strings for this group
* @returns SSG group ID on success, SSG_GROUP_NULL otherwise
* @returns SSG group ID on success, SSG_GROUP_ID_NULL otherwise
*
* NOTE: The HG address string of the caller of this function must be present in
* the list of address strings given in the config file. That is, the caller of
* this function is required to be a member of the SSG group that is created.
*/
ssg_group_id_t ssg_group_create_config(
const char *group_name,
const char *file_name);
const char * group_name,
const char * file_name);
#ifdef HAVE_MPI
/**
* Creates an SSG group from a given MPI communicator.
* @params[in] group_name Name of the SSG group
* @params[in] comm MPI communicator containing group members
* @returns SSG group ID on success, SSG_GROUP_NULL otherwise
* @returns SSG group ID on success, SSG_GROUP_ID_NULL otherwise
*/
ssg_group_id_t ssg_group_create_mpi(
const char *group_name,
const char * group_name,
MPI_Comm comm);
#endif
......
......@@ -12,29 +12,33 @@ extern "C" {
#include <stdint.h>
#include <inttypes.h>
#include <mercury.h>
#include <abt.h>
#include <margo.h>
#include <ssg.h>
#if USE_SWIM_FD
#include "swim-fd/swim-fd.h"
#endif
// debug printing macro for SSG
/* debug printing macro for SSG */
/* TODO: direct debug output to file? */
#ifdef DEBUG
#define SSG_DEBUG(__s, __fmt, ...) do { \
#define SSG_DEBUG(__g, __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); \
fprintf(stdout, "%.6lf <%d>: " __fmt, \
__now, __g->self_rank, ## __VA_ARGS__); \
fflush(stdout); \
} while(0)
#else
#define SSG_DEBUG(__s, __fmt, ...) do { \
#define SSG_DEBUG(__g, __fmt, ...) do { \
} while(0)
#endif
typedef struct ssg_group ssg_group_t;
typedef struct ssg_group_view ssg_group_view_t;
typedef struct ssg_member_state ssg_member_state_t;
typedef struct ssg_view ssg_view_t;
struct ssg_member_state
{
......@@ -42,23 +46,21 @@ struct ssg_member_state
int is_member;
};
struct ssg_view
struct ssg_group_view
{
int self_rank;
int group_size;
ssg_member_state_t *member_states;
};
struct ssg
struct ssg_group
{
margo_instance_id mid;
ssg_view_t view;
char *name;
ssg_group_id_t id;
int self_rank;
ssg_group_view_t view;
#if USE_SWIM_FD
swim_context_t *swim_ctx;
#endif
#ifdef DEBUG
FILE *dbg_strm;
#endif
};
#ifdef __cplusplus
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment