Commit 4ddc1150 authored by Shane Snyder's avatar Shane Snyder

rank-based routines for accessing memberhip

parent 13cd911f
......@@ -184,7 +184,7 @@ int ssg_group_unobserve(
* Obtains the caller's member ID in the given SSG group.
*
* @param[in] mid Corresponding Margo instance identifier
* @returns caller's group ID on success, SSG_MEMBER_ID_INVALID otherwise
* @returns caller's member ID on success, SSG_MEMBER_ID_INVALID otherwise
*/
ssg_member_id_t ssg_get_self_id(
margo_instance_id mid);
......@@ -205,10 +205,59 @@ int ssg_get_group_size(
* @param[in] member_id SSG group member ID
* @returns HG address of given group member on success, HG_ADDR_NULL otherwise
*/
hg_addr_t ssg_get_group_addr(
hg_addr_t ssg_get_group_member_addr(
ssg_group_id_t group_id,
ssg_member_id_t member_id);
/**
* Obtains the rank of the caller in a given SSG group.
*
* @param[in] group_id SSG group ID
* @returns rank on success, -1 on failure
*/
int ssg_get_group_self_rank(
ssg_group_id_t group_id);
/**
* Obtains the rank of a member in a given SSG group.
*
* @param[in] group_id SSG group ID
* @param[in] member_id SSG group member ID
* @returns rank on success, -1 otherwise
*/
int ssg_get_group_member_rank(
ssg_group_id_t group_id,
ssg_member_id_t member_id);
/**
* Obtains the SSG member ID of the given group and rank.
*
* @param[in] group_id SSG group ID
* @param[in] rank SSG group rank
* @returns caller's member ID on success, SSG_MEMBER_ID_INVALID otherwise
*/
ssg_member_id_t ssg_get_group_member_id_from_rank(
ssg_group_id_t group_id,
int rank);
/**
* Obtains an array of SSG member IDs for a given rank range.
*
* @param[in] group_id SSG group ID
* @param[in] rank_start Rank of range start
* @param[in] rank_end Rank of range end
* @param[in,out] range_ids Buffer to store member IDs of requested range
* @returns number of member IDs returned in range_ids on success, 0 otherwise
*
* NOTE: range_ids must be allocated by caller and must be large enough to hold
* requested range.
*/
int ssg_get_group_member_ids_from_range(
ssg_group_id_t group_id,
int rank_start,
int rank_end,
ssg_member_id_t *range_ids);
/**
* Retrieves the HG address string associated with an SSG group identifier.
*
......
......@@ -20,6 +20,7 @@
#include "swim-fd/swim-fd.h"
#include "uthash.h"
#include "utlist.h"
#include "utarray.h"
#ifdef __cplusplus
extern "C" {
......@@ -88,6 +89,7 @@ typedef struct ssg_group_view
{
unsigned int size;
ssg_member_state_t *member_map;
UT_array *rank_array;
} ssg_group_view_t;
typedef struct ssg_group
......@@ -162,6 +164,8 @@ void ssg_apply_member_updates(
hg_return_t hg_proc_ssg_member_update_t(
hg_proc_t proc, void *data);
static const UT_icd ut_ssg_member_id_t_icd = {sizeof(ssg_member_id_t),NULL,NULL,NULL};
extern ssg_instance_t *ssg_inst;
#ifdef __cplusplus
......
This diff is collapsed.
......@@ -97,14 +97,14 @@ int swim_init(
margo_get_handler_pool(swim_ctx->mid, &swim_ctx->swim_pool);
ABT_rwlock_create(&swim_ctx->swim_lock);
swim_ctx->target_list.targets = malloc(group->view.size *
swim_ctx->target_list.targets = malloc((group->view.size-1) *
sizeof(*swim_ctx->target_list.targets));
if (swim_ctx->target_list.targets == NULL)
{
free(swim_ctx);
return(SSG_FAILURE);
}
swim_ctx->target_list.nslots = swim_ctx->target_list.len = group->view.size;
swim_ctx->target_list.nslots = swim_ctx->target_list.len = group->view.size-1;
swim_ctx->target_list.dping_ndx = 0;
i = 0;
HASH_ITER(hh, group->view.member_map, ms, tmp_ms)
......
......@@ -538,7 +538,7 @@ static int run_benchmark(hg_id_t id, ssg_member_id_t target,
for(i=0; i<(g_buffer_size/sizeof(i)); i++)
((hg_size_t*)buffer)[i] = i;
target_addr = ssg_get_group_addr(gid, target);
target_addr = ssg_get_group_member_addr(gid, target);
assert(target_addr != HG_ADDR_NULL);
ret = margo_create(mid, target_addr, id, &handle);
......
......@@ -332,7 +332,7 @@ static int run_benchmark(int iterations, hg_id_t id, ssg_member_id_t target,
int ret;
double tm1, tm2;
target_addr = ssg_get_group_addr(gid, target);
target_addr = ssg_get_group_member_addr(gid, target);
assert(target_addr != HG_ADDR_NULL);
ret = margo_create(mid, target_addr, id, &handle);
......
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