Skip to content

Commit

Permalink
Make explicit that the group ID is a rank. (#229)
Browse files Browse the repository at this point in the history
Signed-off-by: Samuel K. Gutierrez <[email protected]>
  • Loading branch information
samuelkgutierrez authored Jul 17, 2024
1 parent 9d06277 commit 346ccf2
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/qvi-group-mpi.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct qvi_group_mpi_s : public qvi_group_s {
}

virtual int
id(void)
rank(void)
{
return qvi_mpi_group_id(mpi_group);
}
Expand Down
2 changes: 1 addition & 1 deletion src/qvi-group-omp.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct qvi_group_omp_s : public qvi_group_s {
}

virtual int
id(void)
rank(void)
{
return qvi_omp_group_id(th_group);
}
Expand Down
2 changes: 1 addition & 1 deletion src/qvi-group-process.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct qvi_group_process_s : public qvi_group_s {
}

virtual int
id(void)
rank(void)
{
return qvi_process_group_id(proc_group);
}
Expand Down
4 changes: 2 additions & 2 deletions src/qvi-group.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ struct qvi_group_s {
{
return m_task;
}
/** Returns the caller's group ID. */
virtual int id(void) = 0;
/** Returns the caller's group rank. */
virtual int rank(void) = 0;
/** Returns the number of members in this group. */
virtual int size(void) = 0;
/** Performs node-local group barrier. */
Expand Down
24 changes: 12 additions & 12 deletions src/qvi-scope.cc
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ struct qvi_scope_split_coll_s {
int mycolor_a,
qv_hw_obj_type_t split_at_type_a
) {
const int myid = parent_scope_a->group->id();
const int myid = parent_scope_a->group->rank();
parent_scope = parent_scope_a;
mycolor = mycolor_a;
if (myid == qvi_scope_split_coll_s::rootid) {
Expand Down Expand Up @@ -245,15 +245,15 @@ gather_values(
rc = group->gather(txbuff, root, &shared, &bbuffs);
if (rc != QV_SUCCESS) goto out;

if (group->id() == root) {
if (group->rank() == root) {
outvals.resize(group_size);
// Unpack the values.
for (uint_t i = 0; i < group_size; ++i) {
outvals[i] = *(TYPE *)qvi_bbuff_data(bbuffs[i]);
}
}
out:
if (!shared || (shared && (group->id() == root))) {
if (!shared || (shared && (group->rank() == root))) {
if (bbuffs) {
for (uint_t i = 0; i < group_size; ++i) {
qvi_bbuff_free(&bbuffs[i]);
Expand Down Expand Up @@ -289,7 +289,7 @@ gather_hwpools(
rc = group->gather(txbuff, root, &shared, &bbuffs);
if (rc != QV_SUCCESS) goto out;

if (group->id() == root) {
if (group->rank() == root) {
rxpools.resize(group_size);
// Unpack the hwpools.
for (uint_t i = 0; i < group_size; ++i) {
Expand All @@ -300,7 +300,7 @@ gather_hwpools(
}
}
out:
if (!shared || (shared && (group->id() == root))) {
if (!shared || (shared && (group->rank() == root))) {
if (bbuffs) {
for (uint_t i = 0; i < group_size; ++i) {
qvi_bbuff_free(&bbuffs[i]);
Expand Down Expand Up @@ -330,7 +330,7 @@ scatter_values(
std::vector<qvi_bbuff_t *> txbuffs{};
qvi_bbuff_t *rxbuff = nullptr;

if (root == group->id()) {
if (root == group->rank()) {
const uint_t group_size = group->size();
txbuffs.resize(group_size);
// Pack the values.
Expand Down Expand Up @@ -373,7 +373,7 @@ scatter_hwpools(
std::vector<qvi_bbuff_t *> txbuffs{};
qvi_bbuff_t *rxbuff = nullptr;

if (root == group->id()) {
if (root == group->rank()) {
const uint_t group_size = group->size();
txbuffs.resize(group_size);
// Pack the hwpools.
Expand Down Expand Up @@ -413,7 +413,7 @@ bcast_value(

std::vector<TYPE> values{};

if (root == group->id()) {
if (root == group->rank()) {
values.resize(group->size());
std::fill(values.begin(), values.end(), *value);
}
Expand Down Expand Up @@ -450,7 +450,7 @@ scope_split_coll_gather(
);
if (rc != QV_SUCCESS) return rc;

const int myid = parent->group->id();
const int myid = parent->group->rank();
const uint_t group_size = parent->group->size();
if (myid == qvi_scope_split_coll_s::rootid) {
splitcoll.gsplit.affinities.resize(group_size);
Expand Down Expand Up @@ -573,7 +573,7 @@ qvi_scope_taskid(
int *taskid
) {
if (!scope) qvi_abort();
*taskid = scope->group->id();
*taskid = scope->group->rank();
return QV_SUCCESS;
}

Expand Down Expand Up @@ -1050,7 +1050,7 @@ coll_split_hardware_resources(
qvi_hwpool_s **result
) {
int rc = QV_SUCCESS, rc2 = QV_SUCCESS;
const int rootid = qvi_scope_split_coll_s::rootid, myid = parent->group->id();
const int rootid = qvi_scope_split_coll_s::rootid, myid = parent->group->rank();
// Information relevant to hardware resource splitting. Note that
// aggregated data are only valid for the task whose id is equal to
// qvi_global_split_t::rootid after gather has completed.
Expand Down Expand Up @@ -1106,7 +1106,7 @@ qvi_scope_split(
if (rc != QV_SUCCESS) goto out;
// Split underlying group. Notice the use of colorp here.
rc = parent->group->split(
colorp, parent->group->id(), &group
colorp, parent->group->rank(), &group
);
if (rc != QV_SUCCESS) goto out;
// Create and initialize the new scope.
Expand Down

0 comments on commit 346ccf2

Please sign in to comment.