Skip to content

Commit

Permalink
Improve naming consistency. (#268)
Browse files Browse the repository at this point in the history
Signed-off-by: Samuel K. Gutierrez <[email protected]>
  • Loading branch information
samuelkgutierrez authored Aug 2, 2024
1 parent 478c59d commit f5cdfe4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
18 changes: 9 additions & 9 deletions src/qvi-omp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ qvi_omp_group::barrier(void)
}

int
qvi_omp_group::subgroup_info(
qvi_omp_group::m_subgroup_info(
int color,
int key,
qvi_subgroup_info_s *sginfo
qvi_subgroup_info *sginfo
) {
qvi_subgroup_color_key_rank_s *ckrs = nullptr;
qvi_subgroup_color_key_rank *ckrs = nullptr;

#pragma omp single copyprivate(ckrs)
ckrs = new qvi_subgroup_color_key_rank_s[m_size];
ckrs = new qvi_subgroup_color_key_rank[m_size];
// Gather colors and keys from ALL threads.
ckrs[m_rank].color = color;
ckrs[m_rank].key = key;
Expand All @@ -89,9 +89,9 @@ qvi_omp_group::subgroup_info(
// Sort the color/key/rank array. First according to color, then by key,
// but in the same color realm. If color and key are identical, sort by
// the rank from given group.
std::sort(ckrs, ckrs + m_size, qvi_subgroup_color_key_rank_s::by_color);
std::sort(ckrs, ckrs + m_size, qvi_subgroup_color_key_rank_s::by_key);
std::sort(ckrs, ckrs + m_size, qvi_subgroup_color_key_rank_s::by_rank);
std::sort(ckrs, ckrs + m_size, qvi_subgroup_color_key_rank::by_color);
std::sort(ckrs, ckrs + m_size, qvi_subgroup_color_key_rank::by_key);
std::sort(ckrs, ckrs + m_size, qvi_subgroup_color_key_rank::by_rank);
// Calculate the number of distinct colors provided.
std::set<int> color_set;
for (int i = 0; i < m_size; ++i) {
Expand Down Expand Up @@ -134,8 +134,8 @@ qvi_omp_group::split(
) {
qvi_omp_group *ichild = nullptr;

qvi_subgroup_info_s sginfo;
int rc = subgroup_info(color, key, &sginfo);
qvi_subgroup_info sginfo;
int rc = m_subgroup_info(color, key, &sginfo);
if (qvi_likely(rc == QV_SUCCESS)) {
rc = qvi_new(&ichild, sginfo.size, sginfo.rank);
}
Expand Down
4 changes: 2 additions & 2 deletions src/qvi-omp.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ struct qvi_omp_group {
int m_rank = 0;
/** */
int
subgroup_info(
m_subgroup_info(
int color,
int key,
qvi_subgroup_info_s *sginfo
qvi_subgroup_info *sginfo
);
public:
/** Constructor. */
Expand Down
16 changes: 8 additions & 8 deletions src/qvi-subgroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* Stores sub-group information for infrastructure that
* doesn't have native support for creating sub-groups.
*/
struct qvi_subgroup_info_s {
struct qvi_subgroup_info {
/** Number of sub-groups created from split. */
int ngroups = 0;
/** Number of members in this sub-group. */
Expand All @@ -39,32 +39,32 @@ struct qvi_subgroup_info_s {
* Provides supporting infrastructure for creating
* sub-groups based on color, key, and rank.
*/
struct qvi_subgroup_color_key_rank_s {
struct qvi_subgroup_color_key_rank {
int color = 0;
int key = 0;
int rank = 0;

static bool
by_color(
const qvi_subgroup_color_key_rank_s &a,
const qvi_subgroup_color_key_rank_s &b
const qvi_subgroup_color_key_rank &a,
const qvi_subgroup_color_key_rank &b
) {
return a.color < b.color;
}

static bool
by_key(
const qvi_subgroup_color_key_rank_s &a,
const qvi_subgroup_color_key_rank_s &b
const qvi_subgroup_color_key_rank &a,
const qvi_subgroup_color_key_rank &b
) {
// If colors are the same, sort by key.
return a.color == b.color && a.key < b.key;
}

static bool
by_rank(
const qvi_subgroup_color_key_rank_s &a,
const qvi_subgroup_color_key_rank_s &b
const qvi_subgroup_color_key_rank &a,
const qvi_subgroup_color_key_rank &b
) {
// If colors and keys are the same, sort by rank.
return a.color == b.color && a.key == b.key && a.rank < b.rank;
Expand Down

0 comments on commit f5cdfe4

Please sign in to comment.