Commit d989fbb5 authored by Shane Snyder's avatar Shane Snyder
Browse files

implement group access routines

parent 5461898e
......@@ -28,6 +28,7 @@ extern "C" {
#define SSG_SUCCESS 0
#define SSG_FAILURE (-1)
#define SSG_MEMBER_ID_INVALID UINT64_MAX
typedef uint64_t ssg_member_id_t;
/* SSG group identifier datatype */
......@@ -157,16 +158,16 @@ int ssg_group_detach(
*********************************/
/**
* Obtains the caller's group rank in an SSG group.
* Obtains the caller's member ID in the given SSG group.
*
* @param[in] group_id SSG group ID
* @returns caller's group rank on success, SSG_RANK_UNKNOWN otherwise
* @returns caller's group ID on success, SSG_MEMBER_ID_INVALID otherwise
*/
ssg_member_id_t ssg_get_group_self_id(
ssg_group_id_t group_id);
/**
* Obtains the size of an SSG group.
* Obtains the size of a given SSG group.
*
* @param[in] group_id SSG group ID
* @returns size of the group on success, 0 otherwise
......@@ -175,11 +176,11 @@ int ssg_get_group_size(
ssg_group_id_t group_id);
/**
* Obtains the HG address of a given rank in an SSG group.
* Obtains the HG address of a member in a given SSG group.
*
* @param[in] group_id SSG group ID
* @param[in] rank SSG group rank
* @returns HG address of given group rank on success, HG_ADDR_NULL otherwise
* @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_addr(
ssg_group_id_t group_id,
......
......@@ -469,24 +469,50 @@ int ssg_group_detach(
*** SSG group access routines ***
*********************************/
ssg_member_id_t ssg_get_group_rank(
ssg_member_id_t ssg_get_group_self_id(
ssg_group_id_t group_id)
{
return 0;
ssg_group_t *g;
if (!ssg_inst)
return SSG_MEMBER_ID_INVALID;
HASH_FIND(hh, ssg_inst->group_table, &group_id.name_hash, sizeof(uint64_t), g);
if (!g)
return SSG_MEMBER_ID_INVALID;
return g->self_id;
}
int ssg_get_group_size(
ssg_group_id_t group_id)
{
return 0;
ssg_group_t *g;
if (!ssg_inst)
return 0;
HASH_FIND(hh, ssg_inst->group_table, &group_id.name_hash, sizeof(uint64_t), g);
if (!g)
return 0;
return g->group_view.size;
}
hg_addr_t ssg_get_addr(
ssg_group_id_t group_id,
ssg_member_id_t member_id)
{
//if (rank >= 0 && rank < s->view.group_size)
return HG_ADDR_NULL;
ssg_group_t *g;
if (!ssg_inst)
return HG_ADDR_NULL;
HASH_FIND(hh, ssg_inst->group_table, &group_id.name_hash, sizeof(uint64_t), g);
if (!g)
return HG_ADDR_NULL;
return g->group_view.member_states[g->self_id].addr;
}
/************************************
......
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