Skip to content

Commit

Permalink
Conduct even more housekeeping. (#246)
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 25, 2024
1 parent afc8d5d commit da522d0
Show file tree
Hide file tree
Showing 28 changed files with 252 additions and 286 deletions.
4 changes: 2 additions & 2 deletions src/quo-vadis.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ qv_scope_free(
return QV_ERR_INVLD_ARG;
}
try {
qvi_scope_free(&scope);
qvi_scope_delete(&scope);
return QV_SUCCESS;
}
qvi_catch_and_return();
Expand All @@ -98,7 +98,7 @@ qv_scope_nobjs(
return QV_ERR_INVLD_ARG;
}
try {
return qvi_scope_nobjs(scope, obj, nobjs);
return qvi_scope_nobjects(scope, obj, nobjs);
}
qvi_catch_and_return();
}
Expand Down
4 changes: 2 additions & 2 deletions src/quo-vadisd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ struct context_s {
/** Destructor */
~context_s(void)
{
qvi_rmi_server_free(&rmi);
qvi_hwloc_free(&hwloc);
qvi_rmi_server_delete(&rmi);
qvi_hwloc_delete(&hwloc);
}
};

Expand Down
4 changes: 2 additions & 2 deletions src/qvi-bbuff-rmi.h
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ qvi_bbuff_rmi_unpack_item(
*bytes_written = strlen(cpusets) + 1;
out:
if (rc != QV_SUCCESS) {
qvi_hwloc_bitmap_free(cpuset);
qvi_hwloc_bitmap_delete(cpuset);
}
return rc;
}
Expand All @@ -814,7 +814,7 @@ qvi_bbuff_rmi_unpack_item(
if (rc != QV_SUCCESS) return rc;

rc = bitmap.set(raw_cpuset);
qvi_hwloc_bitmap_free(&raw_cpuset);
qvi_hwloc_bitmap_delete(&raw_cpuset);
return rc;
}

Expand Down
2 changes: 1 addition & 1 deletion src/qvi-bbuff.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ qvi_bbuff_dup(
}

void
qvi_bbuff_free(
qvi_bbuff_delete(
qvi_bbuff_t **buff
) {
qvi_delete(buff);
Expand Down
2 changes: 1 addition & 1 deletion src/qvi-bbuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ qvi_bbuff_dup(
*
*/
void
qvi_bbuff_free(
qvi_bbuff_delete(
qvi_bbuff_t **buff
);

Expand Down
11 changes: 5 additions & 6 deletions src/qvi-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,24 +60,23 @@
#endif
// IWYU pragma: end_keep

// Internal types.
// Internal type aliases.
typedef uint8_t byte_t;
typedef char const* cstr_t;
typedef char const * cstr_t;
typedef unsigned int uint_t;

/** Opaque hwloc instance. */
// Forward declarations.
struct qvi_hwloc_s;
typedef struct qvi_hwloc_s qvi_hwloc_t;

/** Opaque RMI client. */
struct qvi_hwpool_s;

struct qvi_rmi_client_s;
typedef struct qvi_rmi_client_s qvi_rmi_client_t;

/** Opaque byte buffer. */
struct qvi_bbuff_s;
typedef struct qvi_bbuff_s qvi_bbuff_t;

/** Opaque task. */
struct qvi_task_s;
typedef struct qvi_task_s qvi_task_t;

Expand Down
2 changes: 1 addition & 1 deletion src/qvi-group-mpi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ qvi_group_mpi_s::qvi_group_mpi_s(

qvi_group_mpi_s::~qvi_group_mpi_s(void)
{
qvi_mpi_group_free(&m_mpi_group);
qvi_mpi_group_delete(&m_mpi_group);
qvi_delete(&m_task);
}

Expand Down
4 changes: 2 additions & 2 deletions src/qvi-group-mpi.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ struct qvi_group_mpi_s : public qvi_group_s {
virtual int
rank(void)
{
return qvi_mpi_group_id(m_mpi_group);
return qvi_mpi_group_rank(m_mpi_group);
}

virtual int
Expand Down Expand Up @@ -128,7 +128,7 @@ struct qvi_zgroup_mpi_s : public qvi_group_mpi_s {
/** Destructor. */
virtual ~qvi_zgroup_mpi_s(void)
{
qvi_mpi_free(&m_mpi);
qvi_mpi_delete(&m_mpi);
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/qvi-group-omp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ qvi_group_omp_s::qvi_group_omp_s(void)

qvi_group_omp_s::~qvi_group_omp_s(void)
{
qvi_omp_group_free(&m_ompgroup);
qvi_omp_group_delete(&m_ompgroup);
qvi_delete(&m_task);
}

Expand Down
2 changes: 1 addition & 1 deletion src/qvi-group-process.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ qvi_group_process_s::qvi_group_process_s(void)

qvi_group_process_s::~qvi_group_process_s(void)
{
qvi_process_group_free(&m_proc_group);
qvi_process_group_delete(&m_proc_group);
qvi_delete(&m_task);
}

Expand Down
20 changes: 10 additions & 10 deletions src/qvi-hwloc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ qvi_hwloc_new(
}

void
qvi_hwloc_free(
qvi_hwloc_delete(
qvi_hwloc_t **hwl
) {
qvi_delete(hwl);
Expand Down Expand Up @@ -620,7 +620,7 @@ qvi_hwloc_bitmap_calloc(
}

void
qvi_hwloc_bitmap_free(
qvi_hwloc_bitmap_delete(
hwloc_cpuset_t *cpuset
) {
if (!cpuset) return;
Expand Down Expand Up @@ -653,7 +653,7 @@ qvi_hwloc_bitmap_dup(
rc = qvi_hwloc_bitmap_copy(src, idest);
out:
if (qvi_unlikely(rc != QV_SUCCESS)) {
qvi_hwloc_bitmap_free(&idest);
qvi_hwloc_bitmap_delete(&idest);
}
*dest = idest;
return rc;
Expand Down Expand Up @@ -824,7 +824,7 @@ qvi_hwloc_emit_cpubind(
getpid(), task_id, cpusets
);
out:
qvi_hwloc_bitmap_free(&cpuset);
qvi_hwloc_bitmap_delete(&cpuset);
if (cpusets) free(cpusets);
return rc;
}
Expand Down Expand Up @@ -928,7 +928,7 @@ qvi_hwloc_task_get_cpubind(
rc = get_proc_cpubind(hwl, task_id, cur_bind);
out:
if (rc != QV_SUCCESS) {
qvi_hwloc_bitmap_free(&cur_bind);
qvi_hwloc_bitmap_delete(&cur_bind);
}
*out_cpuset = cur_bind;
return rc;
Expand Down Expand Up @@ -958,7 +958,7 @@ qvi_hwloc_task_get_cpubind_as_string(
if (rc != QV_SUCCESS) return rc;

rc = qvi_hwloc_bitmap_asprintf(cpuset, cpusets);
qvi_hwloc_bitmap_free(&cpuset);
qvi_hwloc_bitmap_delete(&cpuset);
return rc;
}

Expand Down Expand Up @@ -992,7 +992,7 @@ task_obj_xop_by_type_id(
break;
}
}
qvi_hwloc_bitmap_free(&cur_bind);
qvi_hwloc_bitmap_delete(&cur_bind);
return QV_SUCCESS;
}

Expand Down Expand Up @@ -1155,7 +1155,7 @@ qvi_hwloc_device_new(
}

void
qvi_hwloc_device_free(
qvi_hwloc_device_delete(
qvi_hwloc_device_t **dev
) {
qvi_delete(dev);
Expand Down Expand Up @@ -1389,7 +1389,7 @@ qvi_hwloc_get_cpuset_for_nobjs(
}
out:
if (rc != QV_SUCCESS) {
qvi_hwloc_bitmap_free(&iresult);
qvi_hwloc_bitmap_delete(&iresult);
}
*result = iresult;
return rc;
Expand Down Expand Up @@ -1450,7 +1450,7 @@ qvi_hwloc_get_device_affinity(
if (!icpuset) rc = QV_ERR_NOT_FOUND;
out:
if (rc != QV_SUCCESS) {
qvi_hwloc_bitmap_free(cpuset);
qvi_hwloc_bitmap_delete(cpuset);
}
*cpuset = icpuset;
return rc;
Expand Down
8 changes: 4 additions & 4 deletions src/qvi-hwloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ qvi_hwloc_new(
*
*/
void
qvi_hwloc_free(
qvi_hwloc_delete(
qvi_hwloc_t **hwl
);

Expand Down Expand Up @@ -132,7 +132,7 @@ qvi_hwloc_bitmap_calloc(
*
*/
void
qvi_hwloc_bitmap_free(
qvi_hwloc_bitmap_delete(
hwloc_cpuset_t *cpuset
);

Expand Down Expand Up @@ -327,7 +327,7 @@ qvi_hwloc_device_new(
*
*/
void
qvi_hwloc_device_free(
qvi_hwloc_device_delete(
qvi_hwloc_device_t **dev
);

Expand Down Expand Up @@ -449,7 +449,7 @@ struct qvi_hwloc_bitmap_s {
/** Destructor. */
~qvi_hwloc_bitmap_s(void)
{
qvi_hwloc_bitmap_free(&m_data);
qvi_hwloc_bitmap_delete(&m_data);
}
/** Assignment operator. */
void
Expand Down
4 changes: 2 additions & 2 deletions src/qvi-hwpool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,10 @@ qvi_hwpool_s::add_devices_with_affinity(
rc = qvi_hwloc_get_devices_in_bitmap(
hwloc, devt, m_cpu.cpuset, devs
);
if (rc != QV_SUCCESS) return rc;
if (qvi_unlikely(rc != QV_SUCCESS)) return rc;
for (const auto &dev : devs) {
rc = add_device(qvi_hwpool_dev_s(dev));
if (rc != QV_SUCCESS) return rc;
if (qvi_unlikely(rc != QV_SUCCESS)) return rc;
}
}
return rc;
Expand Down
2 changes: 1 addition & 1 deletion src/qvi-hwpool.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/**
* @file qvi-hwpool.h
*
* Hardware Resource Pool
* Hardware resource pool.
*/

#ifndef QVI_HWPOOL_H
Expand Down
12 changes: 6 additions & 6 deletions src/qvi-mpi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ qvi_mpi_new(
}

void
qvi_mpi_free(
qvi_mpi_delete(
qvi_mpi_t **mpi
) {
qvi_delete(mpi);
Expand Down Expand Up @@ -228,7 +228,7 @@ qvi_mpi_group_new(
}

void
qvi_mpi_group_free(
qvi_mpi_group_delete(
qvi_mpi_group_t **group
) {
qvi_delete(group);
Expand All @@ -242,7 +242,7 @@ qvi_mpi_group_size(
}

int
qvi_mpi_group_id(
qvi_mpi_group_rank(
const qvi_mpi_group_t *group
) {
return group->qvcomm.rank;
Expand Down Expand Up @@ -321,7 +321,7 @@ qvi_mpi_group_create_from_mpi_comm(
rc = mpi->add_group(**new_group);
out:
if (rc != QV_SUCCESS) {
qvi_mpi_group_free(new_group);
qvi_mpi_group_delete(new_group);
if (node_comm != MPI_COMM_NULL) {
MPI_Comm_free(&node_comm);
}
Expand Down Expand Up @@ -427,7 +427,7 @@ qvi_mpi_group_gather_bbuffs(
if (rc != QV_SUCCESS) {
if (bbuffs) {
for (int i = 0; i < group_size; ++i) {
qvi_bbuff_free(&bbuffs[i]);
qvi_bbuff_delete(&bbuffs[i]);
}
delete[] bbuffs;
}
Expand Down Expand Up @@ -499,7 +499,7 @@ qvi_mpi_group_scatter_bbuffs(
rc = qvi_bbuff_append(mybbuff, mybytes.data(), rxcount);
out:
if (rc != QV_SUCCESS) {
qvi_bbuff_free(&mybbuff);
qvi_bbuff_delete(&mybbuff);
}
*rxbuff = mybbuff;
return rc;
Expand Down
6 changes: 3 additions & 3 deletions src/qvi-mpi.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ qvi_mpi_new(
*
*/
void
qvi_mpi_free(
qvi_mpi_delete(
qvi_mpi_t **mpi
);

Expand All @@ -73,7 +73,7 @@ qvi_mpi_group_new(
*
*/
void
qvi_mpi_group_free(
qvi_mpi_group_delete(
qvi_mpi_group_t **group
);

Expand All @@ -89,7 +89,7 @@ qvi_mpi_group_size(
*
*/
int
qvi_mpi_group_id(
qvi_mpi_group_rank(
const qvi_mpi_group_t *group
);

Expand Down
6 changes: 3 additions & 3 deletions src/qvi-omp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ qvi_omp_group_new(
}

void
qvi_omp_group_free(
qvi_omp_group_delete(
qvi_omp_group_t **group
) {
#pragma omp barrier
Expand Down Expand Up @@ -185,7 +185,7 @@ qvi_omp_group_gather_bbuffs(
#pragma omp single
if (bbuffs) {
for (int i = 0; i < group_size; ++i) {
qvi_bbuff_free(&bbuffs[i]);
qvi_bbuff_delete(&bbuffs[i]);
}
delete[] bbuffs;
}
Expand Down Expand Up @@ -216,7 +216,7 @@ qvi_omp_group_scatter_bbuffs(
#pragma omp single
delete tmp;
if (rc != QV_SUCCESS) {
qvi_bbuff_free(&mybbuff);
qvi_bbuff_delete(&mybbuff);
}
*rxbuff = mybbuff;
return rc;
Expand Down
Loading

0 comments on commit da522d0

Please sign in to comment.