From 346ccf224149d75debbc78a7ae6fa5f69ff0da83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20K=2E=20Guti=C3=A9rrez?= Date: Wed, 17 Jul 2024 13:03:17 -0600 Subject: [PATCH] Make explicit that the group ID is a rank. (#229) Signed-off-by: Samuel K. Gutierrez --- src/qvi-group-mpi.h | 2 +- src/qvi-group-omp.h | 2 +- src/qvi-group-process.h | 2 +- src/qvi-group.h | 4 ++-- src/qvi-scope.cc | 24 ++++++++++++------------ 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/qvi-group-mpi.h b/src/qvi-group-mpi.h index a416c31..851d927 100644 --- a/src/qvi-group-mpi.h +++ b/src/qvi-group-mpi.h @@ -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); } diff --git a/src/qvi-group-omp.h b/src/qvi-group-omp.h index af90e1e..41aec2a 100644 --- a/src/qvi-group-omp.h +++ b/src/qvi-group-omp.h @@ -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); } diff --git a/src/qvi-group-process.h b/src/qvi-group-process.h index 95e21fd..02bbbe4 100644 --- a/src/qvi-group-process.h +++ b/src/qvi-group-process.h @@ -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); } diff --git a/src/qvi-group.h b/src/qvi-group.h index 6ee9d24..eb5d789 100644 --- a/src/qvi-group.h +++ b/src/qvi-group.h @@ -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. */ diff --git a/src/qvi-scope.cc b/src/qvi-scope.cc index 0e75173..154ef86 100644 --- a/src/qvi-scope.cc +++ b/src/qvi-scope.cc @@ -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) { @@ -245,7 +245,7 @@ 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) { @@ -253,7 +253,7 @@ gather_values( } } 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]); @@ -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) { @@ -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]); @@ -330,7 +330,7 @@ scatter_values( std::vector 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. @@ -373,7 +373,7 @@ scatter_hwpools( std::vector 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. @@ -413,7 +413,7 @@ bcast_value( std::vector values{}; - if (root == group->id()) { + if (root == group->rank()) { values.resize(group->size()); std::fill(values.begin(), values.end(), *value); } @@ -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); @@ -573,7 +573,7 @@ qvi_scope_taskid( int *taskid ) { if (!scope) qvi_abort(); - *taskid = scope->group->id(); + *taskid = scope->group->rank(); return QV_SUCCESS; } @@ -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. @@ -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.