Skip to content

Commit

Permalink
Cleanup some code. (#263)
Browse files Browse the repository at this point in the history
Signed-off-by: Samuel K. Gutierrez <samuel@lanl.gov>
  • Loading branch information
samuelkgutierrez committed Jul 29, 2024
1 parent 5c4f257 commit fdfcc6c
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 36 deletions.
27 changes: 14 additions & 13 deletions include/quo-vadis.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,16 +163,6 @@ qv_version(
int *patch
);

/**
*
*/
int
qv_scope_nobjs(
qv_scope_t *scope,
qv_hw_obj_type_t obj,
int *nobjs
);

/**
*
*/
Expand All @@ -188,17 +178,20 @@ qv_scope_group_rank(
int
qv_scope_group_size(
qv_scope_t *scope,
int *ntasks
int *group_size
);

/**
*
*/
int
qv_scope_barrier(
qv_scope_t *scope
qv_scope_nobjs(
qv_scope_t *scope,
qv_hw_obj_type_t obj,
int *nobjs
);

// TODO(skg) Rename to qv_scope_device_id_get?
/**
*
*/
Expand All @@ -211,6 +204,14 @@ qv_scope_get_device_id(
char **dev_id
);

/**
*
*/
int
qv_scope_barrier(
qv_scope_t *scope
);

/**
*
*/
Expand Down
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ add_library(
qvi-subgroup.h
qvi-group-pthread.h
qvi-map.h
qvi-split.h
qvi-hwsplit.h
qvi-scope.h
qvi-log.cc
qvi-utils.cc
Expand All @@ -49,7 +49,7 @@ add_library(
qvi-pthread.cc
qvi-group-pthread.cc
qvi-map.cc
qvi-split.cc
qvi-hwsplit.cc
qvi-scope.cc
quo-vadis.cc
quo-vadis-pthread.cc
Expand Down
2 changes: 1 addition & 1 deletion src/quo-vadis-mpi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ qvi_mpi_scope_get(
const int rc = qvi_new(&izgroup, comm);
if (qvi_unlikely(rc != QV_SUCCESS)) return rc;

return qv_scope_s::makei(izgroup, iscope, scope);
return qv_scope_s::make_intrinsic(izgroup, iscope, scope);
}

int
Expand Down
2 changes: 1 addition & 1 deletion src/quo-vadis-omp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ qvi_omp_scope_get(
*scope = nullptr;
return rc;
}
return qv_scope_s::makei(zgroup, iscope, scope);
return qv_scope_s::make_intrinsic(zgroup, iscope, scope);
}

int
Expand Down
2 changes: 1 addition & 1 deletion src/quo-vadis-process.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ qvi_process_scope_get(
*scope = nullptr;
return rc;
}
return qv_scope_s::makei(zgroup, iscope, scope);
return qv_scope_s::make_intrinsic(zgroup, iscope, scope);
}

int
Expand Down
7 changes: 3 additions & 4 deletions src/quo-vadis.cc
Original file line number Diff line number Diff line change
Expand Up @@ -119,17 +119,16 @@ qv_scope_group_rank(
qvi_catch_and_return();
}

// TODO(skg) Rename to qv_scope_group_size.
int
qv_scope_group_size(
qv_scope_t *scope,
int *ntasks
int *group_size
) {
if (qvi_unlikely(!scope || !ntasks)) {
if (qvi_unlikely(!scope || !group_size)) {
return QV_ERR_INVLD_ARG;
}
try {
*ntasks = scope->group_size();
*group_size = scope->group_size();
return QV_SUCCESS;
}
qvi_catch_and_return();
Expand Down
12 changes: 6 additions & 6 deletions src/qvi-group-mpi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
qvi_group_mpi_s::qvi_group_mpi_s(void)
{
const int rc = qvi_new(&m_task);
if (rc != QV_SUCCESS) throw qvi_runtime_error();
if (qvi_unlikely(rc != QV_SUCCESS)) throw qvi_runtime_error();
}

qvi_group_mpi_s::qvi_group_mpi_s(
qvi_mpi_t *mpi_ctx
) : qvi_group_mpi_s()
{
if (!mpi_ctx) throw qvi_runtime_error();
assert(mpi_ctx);
m_mpi = mpi_ctx;
}

Expand Down Expand Up @@ -72,13 +72,13 @@ qvi_group_mpi_s::self(
// Create and initialize the child with the parent's MPI context.
qvi_group_mpi_t *ichild = nullptr;
int rc = qvi_new(&ichild, m_mpi);
if (rc != QV_SUCCESS) goto out;
if (qvi_unlikely(rc != QV_SUCCESS)) goto out;
// Create the underlying group using MPI_COMM_SELF.
rc = qvi_mpi_group_create_from_mpi_comm(
m_mpi, MPI_COMM_SELF, &ichild->m_mpi_group
);
out:
if (rc != QV_SUCCESS) {
if (qvi_unlikely(rc != QV_SUCCESS)) {
qvi_delete(&ichild);
}
*child = ichild;
Expand All @@ -94,14 +94,14 @@ qvi_group_mpi_s::split(
// Create and initialize the child with the parent's MPI context.
qvi_group_mpi_t *ichild = nullptr;
int rc = qvi_new(&ichild, m_mpi);
if (rc != QV_SUCCESS) goto out;
if (qvi_unlikely(rc != QV_SUCCESS)) goto out;
// Split this group using MPI.
rc = qvi_mpi_group_create_from_split(
m_mpi, m_mpi_group, color,
key, &ichild->m_mpi_group
);
out:
if (rc != QV_SUCCESS) {
if (qvi_unlikely(rc != QV_SUCCESS)) {
qvi_delete(&ichild);
}
*child = ichild;
Expand Down
4 changes: 2 additions & 2 deletions src/qvi-split.cc → src/qvi-hwsplit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
*/

/**
* @file qvi-split.cc
* @file qvi-hwsplit.cc
*/

#include "qvi-split.h"
#include "qvi-hwsplit.h"
#include "qvi-bbuff.h"
#include "qvi-rmi.h"
#include "qvi-bbuff-rmi.h"
Expand Down
6 changes: 3 additions & 3 deletions src/qvi-split.h → src/qvi-hwsplit.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
*/

/**
* @file qvi-split.h
* @file qvi-hwsplit.h
*/

#ifndef QVI_SPLIT_H
#define QVI_SPLIT_H
#ifndef QVI_HWSPLIT_H
#define QVI_HWSPLIT_H

#include "qvi-common.h"
#include "qvi-hwloc.h"
Expand Down
4 changes: 2 additions & 2 deletions src/qvi-scope.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "qvi-rmi.h"
#include "qvi-task.h"
#include "qvi-hwpool.h"
#include "qvi-split.h"
#include "qvi-hwsplit.h"
#include "qvi-utils.h"

qv_scope_s::qv_scope_s(
Expand Down Expand Up @@ -67,7 +67,7 @@ scope_new(
}

int
qv_scope_s::makei(
qv_scope_s::make_intrinsic(
qvi_group_t *group,
qv_scope_intrinsic_t iscope,
qv_scope_t **scope
Expand Down
2 changes: 1 addition & 1 deletion src/qvi-scope.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct qv_scope_s {
);
/** Takes the provided group and creates a new intrinsic scope from it. */
static int
makei(
make_intrinsic(
qvi_group_t *group,
qv_scope_intrinsic_t iscope,
qv_scope_t **scope
Expand Down

0 comments on commit fdfcc6c

Please sign in to comment.