Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve naming consistency. #268

Merged
merged 1 commit into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading