From 7f34263f602e36289967909e774ced5a391b662f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20K=2E=20Guti=C3=A9rrez?= Date: Wed, 31 Jul 2024 16:09:17 -0600 Subject: [PATCH] Cleanup some naming and other minor edits. (#266) Signed-off-by: Samuel K. Gutierrez --- include/quo-vadis.h | 4 +- src/quo-vadis-mpi.cc | 4 +- src/quo-vadis-omp.cc | 4 +- src/quo-vadis-process.cc | 4 +- src/quo-vadis-pthread.cc | 4 +- src/quo-vadis.cc | 2 +- src/qvi-bbuff-rmi.h | 82 ++++++++++++++++----------------- src/qvi-bbuff.cc | 24 +++++----- src/qvi-bbuff.h | 20 ++++----- src/qvi-common.h | 10 ++--- src/qvi-group-mpi.cc | 22 ++++----- src/qvi-group-mpi.h | 27 ++++++----- src/qvi-group-omp.cc | 18 ++++---- src/qvi-group-omp.h | 25 +++++------ src/qvi-group-process.cc | 10 ++--- src/qvi-group-process.h | 23 +++++----- src/qvi-group-pthread.cc | 12 ++--- src/qvi-group-pthread.h | 25 +++++------ src/qvi-group.cc | 10 ++--- src/qvi-group.h | 23 +++++----- src/qvi-hwpool.cc | 82 ++++++++++++++++----------------- src/qvi-hwpool.h | 38 ++++++++-------- src/qvi-hwsplit.cc | 54 +++++++++++----------- src/qvi-hwsplit.h | 16 +++---- src/qvi-map.cc | 6 +-- src/qvi-map.h | 4 +- src/qvi-mpi.cc | 16 +++---- src/qvi-mpi.h | 8 ++-- src/qvi-omp.cc | 20 ++++----- src/qvi-omp.h | 8 ++-- src/qvi-process.cc | 12 ++--- src/qvi-process.h | 8 ++-- src/qvi-pthread.cc | 12 ++--- src/qvi-pthread.h | 12 ++--- src/qvi-rmi.cc | 50 ++++++++++----------- src/qvi-rmi.h | 2 +- src/qvi-scope.cc | 97 ++++++++++++++++++---------------------- src/qvi-scope.h | 22 ++++----- src/qvi-task.cc | 20 ++++----- src/qvi-task.h | 8 ++-- src/qvi-utils.h | 4 +- 41 files changed, 418 insertions(+), 434 deletions(-) diff --git a/include/quo-vadis.h b/include/quo-vadis.h index 53138ed..e1acd24 100644 --- a/include/quo-vadis.h +++ b/include/quo-vadis.h @@ -39,8 +39,8 @@ extern "C" { #define QUO_VADIS_API_VERSION 0x00000001 /** Opaque quo-vadis scope. */ -struct qv_scope_s; -typedef struct qv_scope_s qv_scope_t; +struct qv_scope; +typedef struct qv_scope qv_scope_t; /** * Return codes. diff --git a/src/quo-vadis-mpi.cc b/src/quo-vadis-mpi.cc index eefe406..acecd73 100644 --- a/src/quo-vadis-mpi.cc +++ b/src/quo-vadis-mpi.cc @@ -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::make_intrinsic(izgroup, iscope, scope); + return qv_scope::make_intrinsic(izgroup, iscope, scope); } int @@ -87,7 +87,7 @@ qvi_mpi_scope_comm_dup( qv_scope_t *scope, MPI_Comm *comm ) { - return dynamic_cast(scope->group())->comm_dup(comm); + return dynamic_cast(scope->group())->comm_dup(comm); } int diff --git a/src/quo-vadis-omp.cc b/src/quo-vadis-omp.cc index 73e2218..4f0ed36 100644 --- a/src/quo-vadis-omp.cc +++ b/src/quo-vadis-omp.cc @@ -29,13 +29,13 @@ qvi_omp_scope_get( qv_scope_t **scope ) { // Create the base process group. - qvi_group_omp_s *zgroup = nullptr; + qvi_group_omp *zgroup = nullptr; const int rc = qvi_new(&zgroup); if (qvi_unlikely(rc != QV_SUCCESS)) { *scope = nullptr; return rc; } - return qv_scope_s::make_intrinsic(zgroup, iscope, scope); + return qv_scope::make_intrinsic(zgroup, iscope, scope); } int diff --git a/src/quo-vadis-process.cc b/src/quo-vadis-process.cc index 4815125..95a7cc5 100644 --- a/src/quo-vadis-process.cc +++ b/src/quo-vadis-process.cc @@ -22,13 +22,13 @@ qvi_process_scope_get( qv_scope_t **scope ) { // Create the base process group. - qvi_group_process_s *zgroup = nullptr; + qvi_group_process *zgroup = nullptr; const int rc = qvi_new(&zgroup); if (qvi_unlikely(rc != QV_SUCCESS)) { *scope = nullptr; return rc; } - return qv_scope_s::make_intrinsic(zgroup, iscope, scope); + return qv_scope::make_intrinsic(zgroup, iscope, scope); } int diff --git a/src/quo-vadis-pthread.cc b/src/quo-vadis-pthread.cc index 60bd7e9..ad65e09 100644 --- a/src/quo-vadis-pthread.cc +++ b/src/quo-vadis-pthread.cc @@ -108,7 +108,7 @@ qv_pthread_create( // pthread_create(), return a reasonable errno. if (qvi_unlikely(rc != QV_SUCCESS)) return ENOMEM; - auto group = dynamic_cast(scope->group()); + auto group = dynamic_cast(scope->group()); qvi_pthread_group_pthread_create_args_s *cargs = nullptr; rc = qvi_new(&cargs, group->thgroup, qvi_pthread_routine, arg_ptr); if (qvi_unlikely(rc != QV_SUCCESS)) { @@ -129,7 +129,7 @@ qv_pthread_scopes_free( return QV_ERR_INVLD_ARG; } try { - qv_scope_s::thdestroy(&scopes, nscopes); + qv_scope::thdestroy(&scopes, nscopes); return QV_SUCCESS; } qvi_catch_and_return(); diff --git a/src/quo-vadis.cc b/src/quo-vadis.cc index 0cea6fd..676858e 100644 --- a/src/quo-vadis.cc +++ b/src/quo-vadis.cc @@ -82,7 +82,7 @@ qv_scope_free( return QV_ERR_INVLD_ARG; } try { - qv_scope_s::destroy(&scope); + qv_scope::destroy(&scope); return QV_SUCCESS; } qvi_catch_and_return(); diff --git a/src/qvi-bbuff-rmi.h b/src/qvi-bbuff-rmi.h index 1d69966..a087036 100644 --- a/src/qvi-bbuff-rmi.h +++ b/src/qvi-bbuff-rmi.h @@ -18,7 +18,7 @@ * c = hwloc_cpuset_t * c = qvi_hwloc_bitmap_s * d = qv_scope_create_hints_t - * h = qvi_hwpool_s * + * h = qvi_hwpool * * i = int * s = char * * s = std::string @@ -122,7 +122,7 @@ template<> inline void qvi_bbuff_rmi_pack_type_picture( std::string &picture, - const qvi_hwpool_s * + const qvi_hwpool * ) { picture += "h"; } @@ -131,7 +131,7 @@ template<> inline void qvi_bbuff_rmi_pack_type_picture( std::string &picture, - qvi_hwpool_s * + qvi_hwpool * ) { picture += "h"; } @@ -140,7 +140,7 @@ template<> inline void qvi_bbuff_rmi_pack_type_picture( std::string &picture, - qvi_hwpool_s ** + qvi_hwpool ** ) { picture += "h"; } @@ -286,7 +286,7 @@ qvi_bbuff_rmi_get_picture template inline int qvi_bbuff_rmi_pack_item( - qvi_bbuff_t *, + qvi_bbuff *, T ); @@ -295,7 +295,7 @@ qvi_bbuff_rmi_pack_item( */ inline int qvi_bbuff_rmi_pack_item( - qvi_bbuff_t *buff, + qvi_bbuff *buff, size_t data ) { return buff->append(&data, sizeof(data)); @@ -306,7 +306,7 @@ qvi_bbuff_rmi_pack_item( */ inline int qvi_bbuff_rmi_pack_item( - qvi_bbuff_t *buff, + qvi_bbuff *buff, int data ) { return buff->append(&data, sizeof(data)); @@ -317,7 +317,7 @@ qvi_bbuff_rmi_pack_item( */ inline int qvi_bbuff_rmi_pack_item( - qvi_bbuff_t *buff, + qvi_bbuff *buff, qv_scope_create_hints_t data ) { const int dai = (int)data; @@ -329,7 +329,7 @@ qvi_bbuff_rmi_pack_item( */ inline int qvi_bbuff_rmi_pack_item( - qvi_bbuff_t *buff, + qvi_bbuff *buff, qv_hw_obj_type_t data ) { const int dai = (int)data; @@ -341,7 +341,7 @@ qvi_bbuff_rmi_pack_item( */ inline int qvi_bbuff_rmi_pack_item( - qvi_bbuff_t *buff, + qvi_bbuff *buff, qv_device_id_type_t data ) { const int dai = (int)data; @@ -353,7 +353,7 @@ qvi_bbuff_rmi_pack_item( */ inline int qvi_bbuff_rmi_pack_item( - qvi_bbuff_t *buff, + qvi_bbuff *buff, qv_scope_intrinsic_t data ) { const int dai = (int)data; @@ -366,7 +366,7 @@ qvi_bbuff_rmi_pack_item( */ inline int qvi_bbuff_rmi_pack_item( - qvi_bbuff_t *buff, + qvi_bbuff *buff, pid_t data ) { const int dai = (int)data; @@ -376,7 +376,7 @@ qvi_bbuff_rmi_pack_item( inline int qvi_bbuff_rmi_pack_item_impl( - qvi_bbuff_t *buff, + qvi_bbuff *buff, cstr_t data ) { return buff->append(data, strlen(data) + 1); @@ -387,7 +387,7 @@ qvi_bbuff_rmi_pack_item_impl( */ inline int qvi_bbuff_rmi_pack_item( - qvi_bbuff_t *buff, + qvi_bbuff *buff, const std::string &data ) { return qvi_bbuff_rmi_pack_item_impl(buff, data.c_str()); @@ -398,7 +398,7 @@ qvi_bbuff_rmi_pack_item( */ inline int qvi_bbuff_rmi_pack_item( - qvi_bbuff_t *buff, + qvi_bbuff *buff, cstr_t data ) { return qvi_bbuff_rmi_pack_item_impl(buff, data); @@ -409,7 +409,7 @@ qvi_bbuff_rmi_pack_item( */ inline int qvi_bbuff_rmi_pack_item( - qvi_bbuff_t *buff, + qvi_bbuff *buff, char *data ) { return qvi_bbuff_rmi_pack_item_impl(buff, data); @@ -420,7 +420,7 @@ qvi_bbuff_rmi_pack_item( */ inline int qvi_bbuff_rmi_pack_item( - qvi_bbuff_t *, + qvi_bbuff *, qvi_bbuff_rmi_zero_msg_t ) { return QV_SUCCESS; @@ -431,7 +431,7 @@ qvi_bbuff_rmi_pack_item( */ inline int qvi_bbuff_rmi_pack_item( - qvi_bbuff_t *buff, + qvi_bbuff *buff, qvi_bbuff_rmi_bytes_in_t data ) { // We store size then data so unpack has an easier time, but keep @@ -447,7 +447,7 @@ qvi_bbuff_rmi_pack_item( */ inline int qvi_bbuff_rmi_pack_item_impl( - qvi_bbuff_t *buff, + qvi_bbuff *buff, hwloc_const_cpuset_t data ) { // Protect against null data. @@ -472,7 +472,7 @@ qvi_bbuff_rmi_pack_item_impl( */ inline int qvi_bbuff_rmi_pack_item( - qvi_bbuff_t *buff, + qvi_bbuff *buff, hwloc_cpuset_t data ) { return qvi_bbuff_rmi_pack_item_impl(buff, data); @@ -483,7 +483,7 @@ qvi_bbuff_rmi_pack_item( */ inline int qvi_bbuff_rmi_pack_item( - qvi_bbuff_t *buff, + qvi_bbuff *buff, const qvi_hwloc_bitmap_s &bitmap ) { return qvi_bbuff_rmi_pack_item_impl(buff, bitmap.cdata()); @@ -494,7 +494,7 @@ qvi_bbuff_rmi_pack_item( */ inline int qvi_bbuff_rmi_pack_item( - qvi_bbuff_t *buff, + qvi_bbuff *buff, hwloc_const_cpuset_t data ) { return qvi_bbuff_rmi_pack_item_impl(buff, data); @@ -505,8 +505,8 @@ qvi_bbuff_rmi_pack_item( */ inline int qvi_bbuff_rmi_pack_item( - qvi_bbuff_t *buff, - const qvi_hwpool_cpu_s &data + qvi_bbuff *buff, + const qvi_hwpool_cpu &data ) { return data.packinto(buff); } @@ -516,37 +516,37 @@ qvi_bbuff_rmi_pack_item( */ inline int qvi_bbuff_rmi_pack_item( - qvi_bbuff_t *buff, - qvi_hwpool_dev_s *data + qvi_bbuff *buff, + qvi_hwpool_dev *data ) { return data->packinto(buff); } /** - * Packs qvi_hwpool_s * + * Packs qvi_hwpool * */ inline int qvi_bbuff_rmi_pack_item_impl( - qvi_bbuff_t *buff, - const qvi_hwpool_s *data + qvi_bbuff *buff, + const qvi_hwpool *data ) { return data->packinto(buff); } /** - * Packs qvi_hwpool_s * + * Packs qvi_hwpool * */ inline int qvi_bbuff_rmi_pack_item( - qvi_bbuff_t *buff, - qvi_hwpool_s *data + qvi_bbuff *buff, + qvi_hwpool *data ) { return qvi_bbuff_rmi_pack_item_impl(buff, data); } inline int qvi_bbuff_rmi_pack( - qvi_bbuff_t * + qvi_bbuff * ) { // Base case return QV_SUCCESS; @@ -555,7 +555,7 @@ qvi_bbuff_rmi_pack( template inline int qvi_bbuff_rmi_pack( - qvi_bbuff_t *buff, + qvi_bbuff *buff, T&& arg, Types &&...args ) { @@ -817,11 +817,11 @@ qvi_bbuff_rmi_unpack_item( */ inline int qvi_bbuff_rmi_unpack_item( - qvi_hwpool_cpu_s &cpu, + qvi_hwpool_cpu &cpu, byte_t *buffpos, size_t *bytes_written ) { - return qvi_hwpool_cpu_s::unpack(buffpos, bytes_written, cpu); + return qvi_hwpool_cpu::unpack(buffpos, bytes_written, cpu); } /** @@ -829,23 +829,23 @@ qvi_bbuff_rmi_unpack_item( */ inline int qvi_bbuff_rmi_unpack_item( - qvi_hwpool_dev_s &dev, + qvi_hwpool_dev &dev, byte_t *buffpos, size_t *bytes_written ) { - return qvi_hwpool_dev_s::unpack(buffpos, bytes_written, dev); + return qvi_hwpool_dev::unpack(buffpos, bytes_written, dev); } /** - * Unpacks qvi_hwpool_s ** + * Unpacks qvi_hwpool ** */ inline int qvi_bbuff_rmi_unpack_item( - qvi_hwpool_s **hwp, + qvi_hwpool **hwp, byte_t *buffpos, size_t *bytes_written ) { - return qvi_hwpool_s::unpack(buffpos, bytes_written, hwp); + return qvi_hwpool::unpack(buffpos, bytes_written, hwp); } /** diff --git a/src/qvi-bbuff.cc b/src/qvi-bbuff.cc index bf5fff7..b0d7853 100644 --- a/src/qvi-bbuff.cc +++ b/src/qvi-bbuff.cc @@ -17,40 +17,40 @@ #include "qvi-bbuff.h" #include "qvi-utils.h" -qvi_bbuff_s::qvi_bbuff_s(void) +qvi_bbuff::qvi_bbuff(void) { m_capacity = s_min_growth; m_data = calloc(m_capacity, sizeof(byte_t)); if (qvi_unlikely(!m_data)) throw qvi_runtime_error(); } -qvi_bbuff_s::qvi_bbuff_s( - const qvi_bbuff_s &src -) : qvi_bbuff_s() +qvi_bbuff::qvi_bbuff( + const qvi_bbuff &src +) : qvi_bbuff() { const int rc = append(src.m_data, src.m_size); if (qvi_unlikely(rc != QV_SUCCESS)) throw qvi_runtime_error(); } -qvi_bbuff_s::~qvi_bbuff_s(void) +qvi_bbuff::~qvi_bbuff(void) { if (m_data) free(m_data); } size_t -qvi_bbuff_s::size(void) const +qvi_bbuff::size(void) const { return m_size; } void * -qvi_bbuff_s::data(void) +qvi_bbuff::data(void) { return m_data; } int -qvi_bbuff_s::append( +qvi_bbuff::append( const void *const data, size_t size ) { @@ -75,22 +75,22 @@ qvi_bbuff_s::append( int qvi_bbuff_new( - qvi_bbuff_t **buff + qvi_bbuff **buff ) { return qvi_new(buff); } int qvi_bbuff_dup( - const qvi_bbuff_t &src, - qvi_bbuff_t **buff + const qvi_bbuff &src, + qvi_bbuff **buff ) { return qvi_dup(src, buff); } void qvi_bbuff_delete( - qvi_bbuff_t **buff + qvi_bbuff **buff ) { qvi_delete(buff); } diff --git a/src/qvi-bbuff.h b/src/qvi-bbuff.h index b936209..49e2ab2 100644 --- a/src/qvi-bbuff.h +++ b/src/qvi-bbuff.h @@ -21,7 +21,7 @@ #include "qvi-common.h" -struct qvi_bbuff_s { +struct qvi_bbuff { private: /** Minimum growth in bytes for resizes, etc. */ static constexpr size_t s_min_growth = 256; @@ -33,16 +33,16 @@ struct qvi_bbuff_s { void *m_data = nullptr; public: /** Constructor. */ - qvi_bbuff_s(void); + qvi_bbuff(void); /** Copy constructor. */ - qvi_bbuff_s( - const qvi_bbuff_s &src + qvi_bbuff( + const qvi_bbuff &src ); /** Destructor. */ - ~qvi_bbuff_s(void); + ~qvi_bbuff(void); /** Assignment operator. */ void - operator=(const qvi_bbuff_s &src) = delete; + operator=(const qvi_bbuff &src) = delete; /** Returns the size of the data stored in the byte buffer. */ size_t size(void) const; @@ -62,18 +62,18 @@ struct qvi_bbuff_s { int qvi_bbuff_new( - qvi_bbuff_t **buff + qvi_bbuff **buff ); int qvi_bbuff_dup( - const qvi_bbuff_t &src, - qvi_bbuff_t **buff + const qvi_bbuff &src, + qvi_bbuff **buff ); void qvi_bbuff_delete( - qvi_bbuff_t **buff + qvi_bbuff **buff ); #endif diff --git a/src/qvi-common.h b/src/qvi-common.h index b1d14fc..17273a8 100644 --- a/src/qvi-common.h +++ b/src/qvi-common.h @@ -66,19 +66,17 @@ typedef char const * cstr_t; typedef unsigned int uint_t; // Forward declarations. +struct qvi_bbuff; + struct qvi_hwloc_s; typedef struct qvi_hwloc_s qvi_hwloc_t; -struct qvi_hwpool_s; - struct qvi_rmi_client_s; typedef struct qvi_rmi_client_s qvi_rmi_client_t; -struct qvi_bbuff_s; -typedef struct qvi_bbuff_s qvi_bbuff_t; +struct qvi_task; -struct qvi_task_s; -typedef struct qvi_task_s qvi_task_t; +struct qvi_hwpool; #endif diff --git a/src/qvi-group-mpi.cc b/src/qvi-group-mpi.cc index 4f509b7..f0c41a7 100644 --- a/src/qvi-group-mpi.cc +++ b/src/qvi-group-mpi.cc @@ -18,28 +18,28 @@ #include "qvi-task.h" // IWYU pragma: keep #include "qvi-utils.h" -qvi_group_mpi_s::qvi_group_mpi_s(void) +qvi_group_mpi::qvi_group_mpi(void) { const int rc = qvi_new(&m_task); if (qvi_unlikely(rc != QV_SUCCESS)) throw qvi_runtime_error(); } -qvi_group_mpi_s::qvi_group_mpi_s( +qvi_group_mpi::qvi_group_mpi( qvi_mpi_t *mpi_ctx -) : qvi_group_mpi_s() +) : qvi_group_mpi() { assert(mpi_ctx); m_mpi = mpi_ctx; } -qvi_group_mpi_s::~qvi_group_mpi_s(void) +qvi_group_mpi::~qvi_group_mpi(void) { qvi_mpi_group_delete(&m_mpi_group); qvi_delete(&m_task); } int -qvi_group_mpi_s::make_intrinsic( +qvi_group_mpi::make_intrinsic( qv_scope_intrinsic_t scope ) { int rc = QV_SUCCESS; @@ -66,11 +66,11 @@ qvi_group_mpi_s::make_intrinsic( } int -qvi_group_mpi_s::self( - qvi_group_t **child +qvi_group_mpi::self( + qvi_group **child ) { // Create and initialize the child with the parent's MPI context. - qvi_group_mpi_t *ichild = nullptr; + qvi_group_mpi *ichild = nullptr; int rc = qvi_new(&ichild, m_mpi); if (qvi_unlikely(rc != QV_SUCCESS)) goto out; // Create the underlying group using MPI_COMM_SELF. @@ -86,13 +86,13 @@ qvi_group_mpi_s::self( } int -qvi_group_mpi_s::split( +qvi_group_mpi::split( int color, int key, - qvi_group_t **child + qvi_group **child ) { // Create and initialize the child with the parent's MPI context. - qvi_group_mpi_t *ichild = nullptr; + qvi_group_mpi *ichild = nullptr; int rc = qvi_new(&ichild, m_mpi); if (qvi_unlikely(rc != QV_SUCCESS)) goto out; // Split this group using MPI. diff --git a/src/qvi-group-mpi.h b/src/qvi-group-mpi.h index 8722b6c..e86db2c 100644 --- a/src/qvi-group-mpi.h +++ b/src/qvi-group-mpi.h @@ -21,25 +21,25 @@ #include "qvi-group.h" #include "qvi-mpi.h" -struct qvi_group_mpi_s : public qvi_group_s { +struct qvi_group_mpi : public qvi_group { protected: /** Task associated with this group. */ - qvi_task_t *m_task = nullptr; + qvi_task *m_task = nullptr; /** Points to the base MPI context information. */ qvi_mpi_t *m_mpi = nullptr; /** Underlying group instance. */ qvi_mpi_group_t *m_mpi_group = nullptr; public: /** Default constructor. */ - qvi_group_mpi_s(void); + qvi_group_mpi(void); /** Constructor. */ - qvi_group_mpi_s( + qvi_group_mpi( qvi_mpi_t *mpi_ctx ); /** Destructor. */ - virtual ~qvi_group_mpi_s(void); + virtual ~qvi_group_mpi(void); - virtual qvi_task_t * + virtual qvi_task * task(void) { return m_task; @@ -70,22 +70,22 @@ struct qvi_group_mpi_s : public qvi_group_s { virtual int self( - qvi_group_s **child + qvi_group **child ); virtual int split( int color, int key, - qvi_group_s **child + qvi_group **child ); virtual int gather( - qvi_bbuff_t *txbuff, + qvi_bbuff *txbuff, int root, bool *shared, - qvi_bbuff_t ***rxbuffs + qvi_bbuff ***rxbuffs ) { return qvi_mpi_group_gather_bbuffs( m_mpi_group, txbuff, root, shared, rxbuffs @@ -94,9 +94,9 @@ struct qvi_group_mpi_s : public qvi_group_s { virtual int scatter( - qvi_bbuff_t **txbuffs, + qvi_bbuff **txbuffs, int root, - qvi_bbuff_t **rxbuff + qvi_bbuff **rxbuff ) { return qvi_mpi_group_scatter_bbuffs( m_mpi_group, txbuffs, root, rxbuff @@ -110,9 +110,8 @@ struct qvi_group_mpi_s : public qvi_group_s { return qvi_mpi_group_comm_dup(m_mpi_group, comm); } }; -typedef qvi_group_mpi_s qvi_group_mpi_t; -struct qvi_zgroup_mpi_s : public qvi_group_mpi_s { +struct qvi_zgroup_mpi_s : public qvi_group_mpi { /** Default constructor. */ qvi_zgroup_mpi_s(void) = delete; /** Constructor. */ diff --git a/src/qvi-group-omp.cc b/src/qvi-group-omp.cc index 9a7cdcf..5a8e51a 100644 --- a/src/qvi-group-omp.cc +++ b/src/qvi-group-omp.cc @@ -22,20 +22,20 @@ #include "qvi-utils.h" #include -qvi_group_omp_s::qvi_group_omp_s(void) +qvi_group_omp::qvi_group_omp(void) { const int rc = qvi_new(&m_task); if (rc != QV_SUCCESS) throw qvi_runtime_error(); } -qvi_group_omp_s::~qvi_group_omp_s(void) +qvi_group_omp::~qvi_group_omp(void) { qvi_omp_group_delete(&m_ompgroup); qvi_delete(&m_task); } int -qvi_group_omp_s::make_intrinsic( +qvi_group_omp::make_intrinsic( qv_scope_intrinsic_t ) { const int group_size = omp_get_num_threads(); @@ -46,12 +46,12 @@ qvi_group_omp_s::make_intrinsic( } int -qvi_group_omp_s::self( - qvi_group_t **child +qvi_group_omp::self( + qvi_group **child ) { const int group_size = 1; const int group_rank = 0; - qvi_group_omp_t *ichild = nullptr; + qvi_group_omp *ichild = nullptr; int rc = qvi_new(&ichild); if (rc != QV_SUCCESS) goto out; // Create a group containing a single thread. @@ -65,12 +65,12 @@ qvi_group_omp_s::self( } int -qvi_group_omp_s::split( +qvi_group_omp::split( int color, int key, - qvi_group_t **child + qvi_group **child ) { - qvi_group_omp_t *ichild = nullptr; + qvi_group_omp *ichild = nullptr; int rc = qvi_new(&ichild); if (rc != QV_SUCCESS) goto out; diff --git a/src/qvi-group-omp.h b/src/qvi-group-omp.h index 799e7c2..ee41aaf 100644 --- a/src/qvi-group-omp.h +++ b/src/qvi-group-omp.h @@ -24,19 +24,19 @@ #include "qvi-group.h" #include "qvi-omp.h" -struct qvi_group_omp_s : public qvi_group_s { +struct qvi_group_omp : public qvi_group { protected: /** Task associated with this group. */ - qvi_task_t *m_task = nullptr; + qvi_task *m_task = nullptr; /** Underlying group instance. */ qvi_omp_group_t *m_ompgroup = nullptr; public: /** Constructor. */ - qvi_group_omp_s(void); + qvi_group_omp(void); /** Destructor. */ - virtual ~qvi_group_omp_s(void); + virtual ~qvi_group_omp(void); - virtual qvi_task_t * + virtual qvi_task * task(void) { return m_task; @@ -67,13 +67,13 @@ struct qvi_group_omp_s : public qvi_group_s { virtual int self( - qvi_group_s **child + qvi_group **child ); virtual int thsplit( int, - qvi_group_s ** + qvi_group ** ) { // TODO(skg) Need to test this. return QV_ERR_NOT_SUPPORTED; @@ -83,15 +83,15 @@ struct qvi_group_omp_s : public qvi_group_s { split( int color, int key, - qvi_group_s **child + qvi_group **child ); virtual int gather( - qvi_bbuff_t *txbuff, + qvi_bbuff *txbuff, int root, bool *shared, - qvi_bbuff_t ***rxbuffs + qvi_bbuff ***rxbuffs ) { return qvi_omp_group_gather_bbuffs( m_ompgroup, txbuff, root, shared, rxbuffs @@ -100,16 +100,15 @@ struct qvi_group_omp_s : public qvi_group_s { virtual int scatter( - qvi_bbuff_t **txbuffs, + qvi_bbuff **txbuffs, int root, - qvi_bbuff_t **rxbuff + qvi_bbuff **rxbuff ) { return qvi_omp_group_scatter_bbuffs( m_ompgroup, txbuffs, root, rxbuff ); } }; -typedef qvi_group_omp_s qvi_group_omp_t; #endif diff --git a/src/qvi-group-process.cc b/src/qvi-group-process.cc index 1cb69ce..85e0328 100644 --- a/src/qvi-group-process.cc +++ b/src/qvi-group-process.cc @@ -15,23 +15,23 @@ #include "qvi-task.h" // IWYU pragma: keep #include "qvi-utils.h" -qvi_group_process_s::qvi_group_process_s(void) +qvi_group_process::qvi_group_process(void) { const int rc = qvi_new(&m_task); if (rc != QV_SUCCESS) throw qvi_runtime_error(); } -qvi_group_process_s::~qvi_group_process_s(void) +qvi_group_process::~qvi_group_process(void) { qvi_process_group_delete(&m_proc_group); qvi_delete(&m_task); } int -qvi_group_process_s::self( - qvi_group_t **child +qvi_group_process::self( + qvi_group **child ) { - qvi_group_process_t *ichild = nullptr; + qvi_group_process *ichild = nullptr; int rc = qvi_new(&ichild); if (rc != QV_SUCCESS) goto out; // Because this is in the context of a process, the concept of splitting diff --git a/src/qvi-group-process.h b/src/qvi-group-process.h index a4be770..9fb8a96 100644 --- a/src/qvi-group-process.h +++ b/src/qvi-group-process.h @@ -18,19 +18,19 @@ #include "qvi-group.h" #include "qvi-process.h" -struct qvi_group_process_s : public qvi_group_s { +struct qvi_group_process : public qvi_group { protected: /** Task associated with this group. */ - qvi_task_t *m_task = nullptr; + qvi_task *m_task = nullptr; /** Underlying group instance. */ qvi_process_group_t *m_proc_group = nullptr; public: /** Constructor. */ - qvi_group_process_s(void); + qvi_group_process(void); /** Destructor. */ - virtual ~qvi_group_process_s(void); + virtual ~qvi_group_process(void); - virtual qvi_task_t * + virtual qvi_task * task(void) { return m_task; @@ -65,14 +65,14 @@ struct qvi_group_process_s : public qvi_group_s { virtual int self( - qvi_group_s **child + qvi_group **child ); virtual int split( int, int, - qvi_group_s **child + qvi_group **child ) { // NOTE: The concept of coloring with a provided key doesn't apply here, // so ignore. Also, because this is in the context of a process, the @@ -83,10 +83,10 @@ struct qvi_group_process_s : public qvi_group_s { virtual int gather( - qvi_bbuff_t *txbuff, + qvi_bbuff *txbuff, int root, bool *shared, - qvi_bbuff_t ***rxbuffs + qvi_bbuff ***rxbuffs ) { return qvi_process_group_gather_bbuffs( m_proc_group, txbuff, root, shared, rxbuffs @@ -95,16 +95,15 @@ struct qvi_group_process_s : public qvi_group_s { virtual int scatter( - qvi_bbuff_t **txbuffs, + qvi_bbuff **txbuffs, int root, - qvi_bbuff_t **rxbuff + qvi_bbuff **rxbuff ) { return qvi_process_group_scatter_bbuffs( m_proc_group, txbuffs, root, rxbuff ); } }; -typedef qvi_group_process_s qvi_group_process_t; #endif diff --git a/src/qvi-group-pthread.cc b/src/qvi-group-pthread.cc index 2933f43..4a9e1a4 100644 --- a/src/qvi-group-pthread.cc +++ b/src/qvi-group-pthread.cc @@ -14,31 +14,31 @@ #include "qvi-group-pthread.h" #include "qvi-utils.h" -qvi_group_pthread_s::qvi_group_pthread_s( +qvi_group_pthread::qvi_group_pthread( int group_size ) { const int rc = qvi_new(&thgroup, group_size); if (qvi_unlikely(rc != QV_SUCCESS)) throw qvi_runtime_error(); } -qvi_group_pthread_s::~qvi_group_pthread_s(void) +qvi_group_pthread::~qvi_group_pthread(void) { qvi_delete(&thgroup); } int -qvi_group_pthread_s::self( - qvi_group_t ** +qvi_group_pthread::self( + qvi_group ** ) { // TODO(skg) return QV_ERR_NOT_SUPPORTED; } int -qvi_group_pthread_s::split( +qvi_group_pthread::split( int, int, - qvi_group_s ** + qvi_group ** ) { // TODO(skg) return QV_ERR_NOT_SUPPORTED; diff --git a/src/qvi-group-pthread.h b/src/qvi-group-pthread.h index 0edeb32..f02517c 100644 --- a/src/qvi-group-pthread.h +++ b/src/qvi-group-pthread.h @@ -18,19 +18,19 @@ #include "qvi-group.h" #include "qvi-pthread.h" -struct qvi_group_pthread_s : public qvi_group_s { +struct qvi_group_pthread : public qvi_group { /** Underlying group instance. */ qvi_pthread_group_t *thgroup = nullptr; /** Constructor. */ - qvi_group_pthread_s(void) = delete; + qvi_group_pthread(void) = delete; /** Constructor. */ - qvi_group_pthread_s( + qvi_group_pthread( int group_size ); /** Destructor. */ - virtual ~qvi_group_pthread_s(void); + virtual ~qvi_group_pthread(void); - virtual qvi_task_t * + virtual qvi_task * task(void) { return thgroup->task(); @@ -64,13 +64,13 @@ struct qvi_group_pthread_s : public qvi_group_s { virtual int self( - qvi_group_s **child + qvi_group **child ); virtual int thsplit( int, - qvi_group_s ** + qvi_group ** ) { // TODO(skg) return QV_ERR_NOT_SUPPORTED; @@ -80,15 +80,15 @@ struct qvi_group_pthread_s : public qvi_group_s { split( int color, int key, - qvi_group_s **child + qvi_group **child ); virtual int gather( - qvi_bbuff_t *txbuff, + qvi_bbuff *txbuff, int root, bool *shared, - qvi_bbuff_t ***rxbuffs + qvi_bbuff ***rxbuffs ) { return thgroup->gather( txbuff, root, shared, rxbuffs @@ -97,16 +97,15 @@ struct qvi_group_pthread_s : public qvi_group_s { virtual int scatter( - qvi_bbuff_t **txbuffs, + qvi_bbuff **txbuffs, int root, - qvi_bbuff_t **rxbuff + qvi_bbuff **rxbuff ) { return thgroup->scatter( txbuffs, root, rxbuff ); } }; -typedef qvi_group_pthread_s qvi_group_pthread_t; #endif diff --git a/src/qvi-group.cc b/src/qvi-group.cc index f974403..761e6d0 100644 --- a/src/qvi-group.cc +++ b/src/qvi-group.cc @@ -17,17 +17,17 @@ #include "qvi-utils.h" qvi_hwloc_t * -qvi_group_s::hwloc(void) +qvi_group::hwloc(void) { return task()->hwloc(); } int -qvi_group_s::thsplit( +qvi_group::thsplit( int nthreads, - qvi_group_s **child + qvi_group **child ) { - qvi_group_pthread_t *ichild = nullptr; + qvi_group_pthread *ichild = nullptr; const int rc = qvi_new(&ichild, nthreads); if (qvi_unlikely(rc != QV_SUCCESS)) { qvi_delete(&ichild); @@ -37,7 +37,7 @@ qvi_group_s::thsplit( } int -qvi_group_s::next_id( +qvi_group::next_id( qvi_group_id_t *gid ) { // Global group ID. Note that we pad its initial value so that other diff --git a/src/qvi-group.h b/src/qvi-group.h index f9fdaab..ff9d0b6 100644 --- a/src/qvi-group.h +++ b/src/qvi-group.h @@ -26,13 +26,13 @@ using qvi_group_id_t = uint64_t; /** * Virtual base group class. Notice that groups are reference counted. */ -struct qvi_group_s : qvi_refc_s { +struct qvi_group : qvi_refc { /** Constructor. */ - qvi_group_s(void) = default; + qvi_group(void) = default; /** Virtual destructor. */ - virtual ~qvi_group_s(void) = default; + virtual ~qvi_group(void) = default; /** Returns pointer to the caller's task information. */ - virtual qvi_task_t * + virtual qvi_task * task(void) = 0; /** Returns pointer to the task's hwloc information. */ qvi_hwloc_t * @@ -57,7 +57,7 @@ struct qvi_group_s : qvi_refc_s { */ virtual int self( - qvi_group_s **child + qvi_group **child ) = 0; /** * Creates a new thread group by splitting off of the caller's group. @@ -65,7 +65,7 @@ struct qvi_group_s : qvi_refc_s { virtual int thsplit( int nthreads, - qvi_group_s **child + qvi_group **child ); /** * Creates new groups by splitting this group based on color, key. @@ -75,22 +75,22 @@ struct qvi_group_s : qvi_refc_s { split( int color, int key, - qvi_group_s **child + qvi_group **child ) = 0; /** Gathers bbuffs to specified root. */ virtual int gather( - qvi_bbuff_t *txbuff, + qvi_bbuff *txbuff, int root, bool *shared, - qvi_bbuff_t ***rxbuffs + qvi_bbuff ***rxbuffs ) = 0; /** Scatters bbuffs from specified root. */ virtual int scatter( - qvi_bbuff_t **txbuffs, + qvi_bbuff **txbuffs, int root, - qvi_bbuff_t **rxbuff + qvi_bbuff **rxbuff ) = 0; /** Returns a unique group ID after each call. */ static int @@ -98,7 +98,6 @@ struct qvi_group_s : qvi_refc_s { qvi_group_id_t *gid ); }; -typedef struct qvi_group_s qvi_group_t; #endif diff --git a/src/qvi-hwpool.cc b/src/qvi-hwpool.cc index 517f179..7e1c983 100644 --- a/src/qvi-hwpool.cc +++ b/src/qvi-hwpool.cc @@ -18,26 +18,26 @@ #include "qvi-utils.h" qv_scope_create_hints_t -qvi_hwpool_res_s::hints(void) +qvi_hwpool_res::hints(void) { return m_hints; } qvi_hwloc_bitmap_s & -qvi_hwpool_res_s::affinity(void) +qvi_hwpool_res::affinity(void) { return m_affinity; } const qvi_hwloc_bitmap_s & -qvi_hwpool_res_s::affinity(void) const +qvi_hwpool_res::affinity(void) const { return m_affinity; } int -qvi_hwpool_cpu_s::packinto( - qvi_bbuff_t *buff +qvi_hwpool_cpu::packinto( + qvi_bbuff *buff ) const { // Pack hints. const int rc = qvi_bbuff_rmi_pack_item(buff, m_hints); @@ -47,10 +47,10 @@ qvi_hwpool_cpu_s::packinto( } int -qvi_hwpool_cpu_s::unpack( +qvi_hwpool_cpu::unpack( byte_t *buffpos, size_t *bytes_written, - qvi_hwpool_cpu_s &cpu + qvi_hwpool_cpu &cpu ) { size_t bw = 0, total_bw = 0; // Unpack hints. @@ -74,7 +74,7 @@ qvi_hwpool_cpu_s::unpack( return rc; } -qvi_hwpool_dev_s::qvi_hwpool_dev_s( +qvi_hwpool_dev::qvi_hwpool_dev( const qvi_hwloc_device_s &dev ) : m_type(dev.type) , m_affinity(dev.affinity) @@ -82,25 +82,25 @@ qvi_hwpool_dev_s::qvi_hwpool_dev_s( , m_pci_bus_id(dev.pci_bus_id) , m_uuid(dev.uuid) { } -qvi_hwpool_dev_s::qvi_hwpool_dev_s( +qvi_hwpool_dev::qvi_hwpool_dev( const std::shared_ptr &shdev -) : qvi_hwpool_dev_s(*shdev.get()) { } +) : qvi_hwpool_dev(*shdev.get()) { } bool -qvi_hwpool_dev_s::operator==( - const qvi_hwpool_dev_s &x +qvi_hwpool_dev::operator==( + const qvi_hwpool_dev &x ) const { return m_uuid == x.m_uuid; } qv_hw_obj_type_t -qvi_hwpool_dev_s::type(void) +qvi_hwpool_dev::type(void) const { return m_type; } int -qvi_hwpool_dev_s::id( +qvi_hwpool_dev::id( qv_device_id_type_t format, char **result ) const { @@ -128,8 +128,8 @@ qvi_hwpool_dev_s::id( } int -qvi_hwpool_dev_s::packinto( - qvi_bbuff_t *buff +qvi_hwpool_dev::packinto( + qvi_bbuff *buff ) const { // Pack device hints. int rc = qvi_bbuff_rmi_pack_item(buff, m_hints); @@ -151,10 +151,10 @@ qvi_hwpool_dev_s::packinto( } int -qvi_hwpool_dev_s::unpack( +qvi_hwpool_dev::unpack( byte_t *buffpos, size_t *bytes_written, - qvi_hwpool_dev_s &dev + qvi_hwpool_dev &dev ) { size_t bw = 0, total_bw = 0; @@ -207,7 +207,7 @@ qvi_hwpool_dev_s::unpack( } int -qvi_hwpool_s::add_devices_with_affinity( +qvi_hwpool::add_devices_with_affinity( qvi_hwloc_t *hwloc ) { int rc = QV_SUCCESS; @@ -219,7 +219,7 @@ qvi_hwpool_s::add_devices_with_affinity( ); if (qvi_unlikely(rc != QV_SUCCESS)) return rc; for (const auto &dev : devs) { - rc = add_device(qvi_hwpool_dev_s(dev)); + rc = add_device(qvi_hwpool_dev(dev)); if (qvi_unlikely(rc != QV_SUCCESS)) return rc; } } @@ -227,26 +227,26 @@ qvi_hwpool_s::add_devices_with_affinity( } int -qvi_hwpool_s::create( +qvi_hwpool::create( qvi_hwloc_t *hwloc, hwloc_const_cpuset_t cpuset, - qvi_hwpool_s **opool + qvi_hwpool **hwpool ) { - qvi_hwpool_s *ipool = nullptr; - int rc = qvi_new(&ipool); + qvi_hwpool *ihwpool = nullptr; + int rc = qvi_new(&ihwpool); if (qvi_unlikely(rc != QV_SUCCESS)) goto out; // Initialize the hardware pool. - rc = ipool->initialize(hwloc, cpuset); + rc = ihwpool->initialize(hwloc, cpuset); out: if (qvi_unlikely(rc != QV_SUCCESS)) { - qvi_delete(&ipool); + qvi_delete(&ihwpool); } - *opool = ipool; + *hwpool = ihwpool; return rc; } int -qvi_hwpool_s::initialize( +qvi_hwpool::initialize( qvi_hwloc_t *hwloc, hwloc_const_bitmap_t cpuset ) { @@ -257,19 +257,19 @@ qvi_hwpool_s::initialize( } const qvi_hwloc_bitmap_s & -qvi_hwpool_s::cpuset(void) const +qvi_hwpool::cpuset(void) const { return m_cpu.affinity(); } const qvi_hwpool_devs_t & -qvi_hwpool_s::devices(void) const +qvi_hwpool::devices(void) const { return m_devs; } int -qvi_hwpool_s::nobjects( +qvi_hwpool::nobjects( qvi_hwloc_t *hwloc, qv_hw_obj_type_t obj_type, int *result @@ -284,24 +284,24 @@ qvi_hwpool_s::nobjects( } int -qvi_hwpool_s::add_device( - const qvi_hwpool_dev_s &dev +qvi_hwpool::add_device( + const qvi_hwpool_dev &dev ) { - auto shdev = std::make_shared(dev); + auto shdev = std::make_shared(dev); m_devs.insert({dev.type(), shdev}); return QV_SUCCESS; } int -qvi_hwpool_s::release_devices(void) +qvi_hwpool::release_devices(void) { m_devs.clear(); return QV_SUCCESS; } int -qvi_hwpool_s::packinto( - qvi_bbuff_t *buff +qvi_hwpool::packinto( + qvi_bbuff *buff ) const { // Pack the CPU. int rc = qvi_bbuff_rmi_pack_item(buff, m_cpu); @@ -319,14 +319,14 @@ qvi_hwpool_s::packinto( } int -qvi_hwpool_s::unpack( +qvi_hwpool::unpack( byte_t *buffpos, size_t *bytes_written, - qvi_hwpool_s **hwp + qvi_hwpool **hwp ) { size_t bw = 0, total_bw = 0; // Create the new hardware pool. - qvi_hwpool_s *ihwp = nullptr; + qvi_hwpool *ihwp = nullptr; int rc = qvi_new(&ihwp); if (qvi_unlikely(rc != QV_SUCCESS)) goto out; // Unpack the CPU into the hardare pool. @@ -346,7 +346,7 @@ qvi_hwpool_s::unpack( buffpos += bw; // Unpack and add the devices. for (size_t i = 0; i < ndev; ++i) { - qvi_hwpool_dev_s dev; + qvi_hwpool_dev dev; rc = qvi_bbuff_rmi_unpack_item(dev, buffpos, &bw); if (qvi_unlikely(rc != QV_SUCCESS)) break; total_bw += bw; diff --git a/src/qvi-hwpool.h b/src/qvi-hwpool.h index 5e9c608..b63c34e 100644 --- a/src/qvi-hwpool.h +++ b/src/qvi-hwpool.h @@ -22,7 +22,7 @@ /** * Base hardware pool resource class. */ -struct qvi_hwpool_res_s { +struct qvi_hwpool_res { protected: /** Resource hint flags. */ qv_scope_create_hints_t m_hints = QV_SCOPE_CREATE_HINT_NONE; @@ -48,18 +48,18 @@ struct qvi_hwpool_res_s { * Defines a hardware pool CPU. A CPU here may have multiple * processing units (PUs), which are defined as the CPU's affinity. */ -struct qvi_hwpool_cpu_s : qvi_hwpool_res_s { +struct qvi_hwpool_cpu : qvi_hwpool_res { /** Packs the instance into the provided buffer. */ int packinto( - qvi_bbuff_t *buff + qvi_bbuff *buff ) const; /** Unpacks the buffer and creates a new hardware pool instance. */ static int unpack( byte_t *buffpos, size_t *bytes_written, - qvi_hwpool_cpu_s &cpu + qvi_hwpool_cpu &cpu ); }; @@ -67,7 +67,7 @@ struct qvi_hwpool_cpu_s : qvi_hwpool_res_s { * Defines a hardware pool device. This differs from a qvi_hwloc_device_s * because we only maintain information relevant for user-facing operations. */ -struct qvi_hwpool_dev_s : qvi_hwpool_res_s { +struct qvi_hwpool_dev : qvi_hwpool_res { private: /** Device type. */ qv_hw_obj_type_t m_type = QV_HW_OBJ_LAST; @@ -81,21 +81,21 @@ struct qvi_hwpool_dev_s : qvi_hwpool_res_s { std::string m_uuid; public: /** Default constructor. */ - qvi_hwpool_dev_s(void) = default; + qvi_hwpool_dev(void) = default; /** Constructor using qvi_hwloc_device_s. */ - explicit qvi_hwpool_dev_s( + explicit qvi_hwpool_dev( const qvi_hwloc_device_s &dev ); /** Constructor using std::shared_ptr. */ - explicit qvi_hwpool_dev_s( + explicit qvi_hwpool_dev( const std::shared_ptr &shdev ); /** Destructor. */ - virtual ~qvi_hwpool_dev_s(void) = default; + virtual ~qvi_hwpool_dev(void) = default; /** Equality operator. */ bool operator==( - const qvi_hwpool_dev_s &x + const qvi_hwpool_dev &x ) const; /** Returns the device's type. */ qv_hw_obj_type_t @@ -109,14 +109,14 @@ struct qvi_hwpool_dev_s : qvi_hwpool_res_s { /** Packs the instance into the provided buffer. */ int packinto( - qvi_bbuff_t *buff + qvi_bbuff *buff ) const; /** Unpacks the buffer and creates a new hardware pool device instance. */ static int unpack( byte_t *buffpos, size_t *bytes_written, - qvi_hwpool_dev_s &dev + qvi_hwpool_dev &dev ); }; @@ -124,13 +124,13 @@ struct qvi_hwpool_dev_s : qvi_hwpool_res_s { * Maintains a mapping between device types and devices of those types. */ using qvi_hwpool_devs_t = std::multimap< - qv_hw_obj_type_t, std::shared_ptr + qv_hw_obj_type_t, std::shared_ptr >; -struct qvi_hwpool_s { +struct qvi_hwpool { private: /** The hardware pool's CPU. */ - qvi_hwpool_cpu_s m_cpu; + qvi_hwpool_cpu m_cpu; /** The hardware pool's devices. */ qvi_hwpool_devs_t m_devs; /** @@ -150,7 +150,7 @@ struct qvi_hwpool_s { create( qvi_hwloc_t *hwloc, hwloc_const_cpuset_t cpuset, - qvi_hwpool_s **opool + qvi_hwpool **hwpool ); /** * Initializes a hardware pool from the given @@ -185,7 +185,7 @@ struct qvi_hwpool_s { */ int add_device( - const qvi_hwpool_dev_s &dev + const qvi_hwpool_dev &dev ); /** * Releases all devices in the hwpool. @@ -195,14 +195,14 @@ struct qvi_hwpool_s { /** Packs the instance into the provided buffer. */ int packinto( - qvi_bbuff_t *buff + qvi_bbuff *buff ) const; /** Unpacks the buffer and creates a new hardware pool instance. */ static int unpack( byte_t *buffpos, size_t *bytes_written, - qvi_hwpool_s **hwp + qvi_hwpool **hwp ); }; diff --git a/src/qvi-hwsplit.cc b/src/qvi-hwsplit.cc index 9eba903..5e81d42 100644 --- a/src/qvi-hwsplit.cc +++ b/src/qvi-hwsplit.cc @@ -57,7 +57,7 @@ cpus_available( #if 0 static int pool_obtain_cpus_by_cpuset( - qvi_hwpool_s *pool, + qvi_hwpool *pool, hwloc_const_cpuset_t request ) { #if 0 @@ -83,7 +83,7 @@ pool_obtain_cpus_by_cpuset( #if 0 static int pool_release_cpus_by_cpuset( - qvi_hwpool_s *pool, + qvi_hwpool *pool, hwloc_const_cpuset_t release ) { int hwrc = hwloc_bitmap_andnot( @@ -126,7 +126,7 @@ pool_release_cpus_by_cpuset( // approach using the device IDs instead of the bit positions. /** Maintains a mapping between IDs to device information. */ -using id2devs_t = std::multimap; +using id2devs_t = std::multimap; qvi_hwsplit_s::qvi_hwsplit_s( qv_scope_t *parent, @@ -293,7 +293,7 @@ qvi_hwsplit_s::split_devices_user_defined(void) // Get the number of devices. const uint_t ndevs = dinfos.count(devt); // Store device infos. - std::vector devs; + std::vector devs; for (const auto &dinfo : dinfos) { // Not the type we are currently dealing with. if (devt != dinfo.first) continue; @@ -339,7 +339,7 @@ qvi_hwsplit_s::split_devices_affinity_preserving(void) // Iterate over the supported device types and split them up. for (const auto devt : qvi_hwloc_supported_devices()) { // Store device infos. - std::vector devs; + std::vector devs; for (const auto &dinfo : dinfos) { // Not the type we are currently dealing with. if (devt != dinfo.first) continue; @@ -376,7 +376,7 @@ apply_cpuset_mapping( qvi_hwloc_t *hwloc, const qvi_map_t &map, const qvi_hwloc_cpusets_t cpusets, - std::vector &hwpools, + std::vector &hwpools, std::vector &colors ) { int rc = QV_SUCCESS; @@ -549,7 +549,7 @@ qvi_hwsplit_coll_s::qvi_hwsplit_coll_s( ) : m_parent(parent) , m_color(color) { - const qvi_group_t *const pgroup = m_parent->group(); + const qvi_group *const pgroup = m_parent->group(); if (pgroup->rank() == qvi_hwsplit_coll_s::s_rootid) { m_hwsplit = qvi_hwsplit_s( m_parent, pgroup->size(), npieces, split_at_type @@ -566,10 +566,10 @@ qvi_hwsplit_coll_s::scatter_values( static_assert(std::is_trivially_copyable::value, ""); int rc = QV_SUCCESS; - qvi_bbuff_t *rxbuff = nullptr; + qvi_bbuff *rxbuff = nullptr; - qvi_group_t *const group = m_parent->group(); - std::vector txbuffs(0); + qvi_group *const group = m_parent->group(); + std::vector txbuffs(0); if (group->rank() == s_rootid) { const uint_t group_size = group->size(); txbuffs.resize(group_size); @@ -606,7 +606,7 @@ qvi_hwsplit_coll_s::bcast_value( TYPE *value ) { static_assert(std::is_trivially_copyable::value, ""); - qvi_group_t *const group = m_parent->group(); + qvi_group *const group = m_parent->group(); std::vector values; if (group->rank() == s_rootid) { @@ -623,10 +623,10 @@ qvi_hwsplit_coll_s::gather_values( std::vector &outvals ) { static_assert(std::is_trivially_copyable::value, ""); - qvi_group_t *const group = m_parent->group(); + qvi_group *const group = m_parent->group(); const uint_t group_size = group->size(); - qvi_bbuff_t *txbuff = nullptr; + qvi_bbuff *txbuff = nullptr; int rc = qvi_bbuff_new(&txbuff); if (qvi_unlikely(rc != QV_SUCCESS)) return rc; @@ -637,7 +637,7 @@ qvi_hwsplit_coll_s::gather_values( } // Gather the values to the root. bool shared = false; - qvi_bbuff_t **bbuffs = nullptr; + qvi_bbuff **bbuffs = nullptr; rc = group->gather(txbuff, s_rootid, &shared, &bbuffs); if (qvi_unlikely(rc != QV_SUCCESS)) goto out; // The root fills in the output. @@ -667,18 +667,18 @@ qvi_hwsplit_coll_s::gather_values( int qvi_hwsplit_coll_s::gather_hwpools( - qvi_hwpool_s *txpool, - std::vector &rxpools + qvi_hwpool *txpool, + std::vector &rxpools ) { - qvi_group_t *const group = m_parent->group(); + qvi_group *const group = m_parent->group(); const uint_t group_size = group->size(); // Pack the hardware pool into a buffer. - qvi_bbuff_t txbuff; + qvi_bbuff txbuff; int rc = txpool->packinto(&txbuff); if (qvi_unlikely(rc != QV_SUCCESS)) return rc; // Gather the values to the root. bool shared = false; - qvi_bbuff_t **bbuffs = nullptr; + qvi_bbuff **bbuffs = nullptr; rc = group->gather(&txbuff, s_rootid, &shared, &bbuffs); if (rc != QV_SUCCESS) goto out; @@ -711,7 +711,7 @@ qvi_hwsplit_coll_s::gather_hwpools( int qvi_hwsplit_coll_s::gather(void) { - int rc = gather_values(qvi_task_t::mytid(), m_hwsplit.m_group_tids); + int rc = gather_values(qvi_task::mytid(), m_hwsplit.m_group_tids); if (qvi_unlikely(rc != QV_SUCCESS)) return rc; rc = gather_values(m_color, m_hwsplit.m_colors); if (qvi_unlikely(rc != QV_SUCCESS)) return rc; @@ -739,14 +739,14 @@ qvi_hwsplit_coll_s::gather(void) int qvi_hwsplit_coll_s::scatter_hwpools( - const std::vector &pools, - qvi_hwpool_s **pool + const std::vector &pools, + qvi_hwpool **pool ) { int rc = QV_SUCCESS; - std::vector txbuffs(0); - qvi_bbuff_t *rxbuff = nullptr; + std::vector txbuffs(0); + qvi_bbuff *rxbuff = nullptr; - qvi_group_t *const group = m_parent->group(); + qvi_group *const group = m_parent->group(); if (group->rank() == s_rootid) { const uint_t group_size = group->size(); @@ -780,7 +780,7 @@ qvi_hwsplit_coll_s::scatter_hwpools( int qvi_hwsplit_coll_s::scatter( int *colorp, - qvi_hwpool_s **result + qvi_hwpool **result ) { const int rc = scatter_values(m_hwsplit.m_colors, colorp); if (qvi_unlikely(rc != QV_SUCCESS)) return rc; @@ -796,7 +796,7 @@ qvi_hwsplit_coll_s::barrier(void) int qvi_hwsplit_coll_s::split( int *colorp, - qvi_hwpool_s **result + qvi_hwpool **result ) { // First consolidate the provided information, as this is coming from a // SPMD-like context (e.g., splitting a resource shared by MPI processes). diff --git a/src/qvi-hwsplit.h b/src/qvi-hwsplit.h index 7392c6e..0caab61 100644 --- a/src/qvi-hwsplit.h +++ b/src/qvi-hwsplit.h @@ -34,7 +34,7 @@ struct qvi_hwsplit_s { /** A pointer to my RMI. */ qvi_rmi_client_t *m_rmi = nullptr; /** The base hardware pool we are splitting. */ - qvi_hwpool_s *m_hwpool = nullptr; + qvi_hwpool *m_hwpool = nullptr; /** The number of members that are part of the split. */ uint_t m_group_size = 0; /** The number of pieces in the split. */ @@ -58,7 +58,7 @@ struct qvi_hwsplit_s { * number of hardware pools will always match the group size and that their * array index corresponds to a task ID: 0 ... group_size - 1. */ - std::vector m_hwpools; + std::vector m_hwpools; /** * Vector of colors, one for each member of the group. Note that the number * of colors will always match the group size and that their array index @@ -208,8 +208,8 @@ struct qvi_hwsplit_coll_s { /** */ int gather_hwpools( - qvi_hwpool_s *txpool, - std::vector &rxpools + qvi_hwpool *txpool, + std::vector &rxpools ); /** Gathers. */ int @@ -217,14 +217,14 @@ struct qvi_hwsplit_coll_s { /** */ int scatter_hwpools( - const std::vector &pools, - qvi_hwpool_s **pool + const std::vector &pools, + qvi_hwpool **pool ); /** */ int scatter( int *colorp, - qvi_hwpool_s **result + qvi_hwpool **result ); /** */ int @@ -238,7 +238,7 @@ struct qvi_hwsplit_coll_s { int split( int *colorp, - qvi_hwpool_s **result + qvi_hwpool **result ); }; diff --git a/src/qvi-map.cc b/src/qvi-map.cc index a749e79..6da88c8 100644 --- a/src/qvi-map.cc +++ b/src/qvi-map.cc @@ -92,8 +92,8 @@ make_shared_affinity_map_disjoint( uint_t qvi_map_maxfit( - uint_t space_left, - uint_t max_chunk + uint_t max_chunk, + uint_t space_left ) { uint_t result = max_chunk; while (result > space_left) { @@ -178,7 +178,7 @@ qvi_map_packed( uint_t nmapped = qvi_map_nfids_mapped(map); for (uint_t tid = 0; tid < ntres; ++tid) { // Number of consumer IDs to map. - const uint_t nmap = qvi_map_maxfit(nfids - nmapped, maxcpr); + const uint_t nmap = qvi_map_maxfit(maxcpr, nfids - nmapped); for (uint_t i = 0; i < nmap; ++i, ++fid) { // Already mapped (potentially by some other mapper). if (qvi_map_fid_mapped(map, fid)) continue; diff --git a/src/qvi-map.h b/src/qvi-map.h index 91aef19..4a1e4e0 100644 --- a/src/qvi-map.h +++ b/src/qvi-map.h @@ -38,8 +38,8 @@ using qvi_map_shaffinity_t = std::map>; */ uint_t qvi_map_maxfit( - uint_t space_left, - uint_t max_chunk + uint_t max_chunk, + uint_t space_left ); /** diff --git a/src/qvi-mpi.cc b/src/qvi-mpi.cc index a7a2790..fa66e4e 100644 --- a/src/qvi-mpi.cc +++ b/src/qvi-mpi.cc @@ -98,7 +98,7 @@ struct qvi_mpi_s { qvi_group_id_t gid = given_id; // Marker used to differentiate between intrinsic and automatic IDs. if (given_id == QVI_MPI_GROUP_NULL) { - const int rc = qvi_group_t::next_id(&gid); + const int rc = qvi_group::next_id(&gid); if (qvi_unlikely(rc != QV_SUCCESS)) return rc; } group_tab.insert({gid, group}); @@ -363,10 +363,10 @@ qvi_mpi_group_barrier( int qvi_mpi_group_gather_bbuffs( qvi_mpi_group_t *group, - qvi_bbuff_t *txbuff, + qvi_bbuff *txbuff, int root, bool *shared_alloc, - qvi_bbuff_t ***rxbuffs + qvi_bbuff ***rxbuffs ) { const int send_count = (int)txbuff->size(); const int group_id = group->qvcomm.rank; @@ -375,7 +375,7 @@ qvi_mpi_group_gather_bbuffs( int rc = QV_SUCCESS, mpirc = MPI_SUCCESS; std::vector rxcounts, displs; std::vector allbytes; - qvi_bbuff_t **bbuffs = nullptr; + qvi_bbuff **bbuffs = nullptr; if (group_id == root) { rxcounts.resize(group_size); @@ -413,7 +413,7 @@ qvi_mpi_group_gather_bbuffs( } // Root creates new buffers from data gathered from each participant. if (group_id == root) { - bbuffs = new qvi_bbuff_t *[group_size]; + bbuffs = new qvi_bbuff *[group_size]; byte_t *bytepos = allbytes.data(); for (int i = 0; i < group_size; ++i) { rc = qvi_bbuff_new(&bbuffs[i]); @@ -441,9 +441,9 @@ qvi_mpi_group_gather_bbuffs( int qvi_mpi_group_scatter_bbuffs( qvi_mpi_group_t *group, - qvi_bbuff_t **txbuffs, + qvi_bbuff **txbuffs, int root, - qvi_bbuff_t **rxbuff + qvi_bbuff **rxbuff ) { const int group_size = group->qvcomm.size; const int group_id = group->qvcomm.rank; @@ -452,7 +452,7 @@ qvi_mpi_group_scatter_bbuffs( int total_bytes = 0; std::vector txcounts, displs; std::vector mybytes, txbytes; - qvi_bbuff_t *mybbuff = nullptr; + qvi_bbuff *mybbuff = nullptr; // Root sets up relevant Scatterv data structures. if (group_id == root) { txcounts.resize(group_size); diff --git a/src/qvi-mpi.h b/src/qvi-mpi.h index d6c59d4..b131042 100644 --- a/src/qvi-mpi.h +++ b/src/qvi-mpi.h @@ -149,10 +149,10 @@ qvi_mpi_group_barrier( int qvi_mpi_group_gather_bbuffs( qvi_mpi_group_t *group, - qvi_bbuff_t *txbuff, + qvi_bbuff *txbuff, int root, bool *shared_alloc, - qvi_bbuff_t ***rxbuffs + qvi_bbuff ***rxbuffs ); /** @@ -161,9 +161,9 @@ qvi_mpi_group_gather_bbuffs( int qvi_mpi_group_scatter_bbuffs( qvi_mpi_group_t *group, - qvi_bbuff_t **txbuffs, + qvi_bbuff **txbuffs, int root, - qvi_bbuff_t **rxbuff + qvi_bbuff **rxbuff ); /** diff --git a/src/qvi-omp.cc b/src/qvi-omp.cc index b9fcc7e..d1109a1 100644 --- a/src/qvi-omp.cc +++ b/src/qvi-omp.cc @@ -168,17 +168,17 @@ qvi_omp_group_create_from_split( int qvi_omp_group_gather_bbuffs( qvi_omp_group_t *group, - qvi_bbuff_t *txbuff, + qvi_bbuff *txbuff, int, bool *shared_alloc, - qvi_bbuff_t ***rxbuffs + qvi_bbuff ***rxbuffs ) { const int group_size = group->size; const int group_rank = group->rank; - qvi_bbuff_t **bbuffs = nullptr; + qvi_bbuff **bbuffs = nullptr; #pragma omp single copyprivate(bbuffs) - bbuffs = new qvi_bbuff_t *[group_size](); + bbuffs = new qvi_bbuff *[group_size](); const int rc = qvi_bbuff_dup(*txbuff, &bbuffs[group_rank]); // Need to ensure that all threads have contributed to bbuffs. @@ -201,18 +201,18 @@ qvi_omp_group_gather_bbuffs( int qvi_omp_group_scatter_bbuffs( qvi_omp_group_t *group, - qvi_bbuff_t **txbuffs, + qvi_bbuff **txbuffs, int, - qvi_bbuff_t **rxbuff + qvi_bbuff **rxbuff ) { - qvi_bbuff_t ***tmp = nullptr; + qvi_bbuff ***tmp = nullptr; #pragma omp single copyprivate(tmp) - tmp = new qvi_bbuff_t**(); + tmp = new qvi_bbuff**(); #pragma omp master *tmp = txbuffs; #pragma omp barrier - qvi_bbuff_t *inbuff = (*tmp)[group->rank]; - qvi_bbuff_t *mybbuff = nullptr; + qvi_bbuff *inbuff = (*tmp)[group->rank]; + qvi_bbuff *mybbuff = nullptr; const int rc = qvi_bbuff_dup(*inbuff, &mybbuff); #pragma omp barrier #pragma omp single diff --git a/src/qvi-omp.h b/src/qvi-omp.h index 62bee9f..cca9dba 100644 --- a/src/qvi-omp.h +++ b/src/qvi-omp.h @@ -91,18 +91,18 @@ qvi_omp_group_create_from_split( int qvi_omp_group_gather_bbuffs( qvi_omp_group_t *group, - qvi_bbuff_t *txbuff, + qvi_bbuff *txbuff, int, bool *shared_alloc, - qvi_bbuff_t ***rxbuffs + qvi_bbuff ***rxbuffs ); int qvi_omp_group_scatter_bbuffs( qvi_omp_group_t *group, - qvi_bbuff_t **txbuffs, + qvi_bbuff **txbuffs, int root, - qvi_bbuff_t **rxbuff + qvi_bbuff **rxbuff ); #endif diff --git a/src/qvi-process.cc b/src/qvi-process.cc index d898d50..60eab12 100644 --- a/src/qvi-process.cc +++ b/src/qvi-process.cc @@ -61,10 +61,10 @@ qvi_process_group_barrier( int qvi_process_group_gather_bbuffs( qvi_process_group_t *group, - qvi_bbuff_t *txbuff, + qvi_bbuff *txbuff, int root, bool *shared, - qvi_bbuff_t ***rxbuffs + qvi_bbuff ***rxbuffs ) { const int group_size = qvi_process_group_size(group); // Make sure that we are dealing with a valid process group. @@ -73,7 +73,7 @@ qvi_process_group_gather_bbuffs( qvi_abort(); } // Zero initialize array of pointers to nullptr. - qvi_bbuff_t **bbuffs = new qvi_bbuff_t *[group_size](); + qvi_bbuff **bbuffs = new qvi_bbuff *[group_size](); const int rc = qvi_bbuff_dup(*txbuff, &bbuffs[0]); if (rc != QV_SUCCESS) { @@ -91,9 +91,9 @@ qvi_process_group_gather_bbuffs( int qvi_process_group_scatter_bbuffs( qvi_process_group_t *group, - qvi_bbuff_t **txbuffs, + qvi_bbuff **txbuffs, int root, - qvi_bbuff_t **rxbuff + qvi_bbuff **rxbuff ) { const int group_size = qvi_process_group_size(group); // Make sure that we are dealing with a valid process group. @@ -102,7 +102,7 @@ qvi_process_group_scatter_bbuffs( qvi_abort(); } // There should always be only one at the root (us). - qvi_bbuff_t *mybbuff = nullptr; + qvi_bbuff *mybbuff = nullptr; const int rc = qvi_bbuff_dup(*txbuffs[root], &mybbuff); if (rc != QV_SUCCESS) { qvi_bbuff_delete(&mybbuff); diff --git a/src/qvi-process.h b/src/qvi-process.h index 04f17e5..b0f091b 100644 --- a/src/qvi-process.h +++ b/src/qvi-process.h @@ -66,10 +66,10 @@ qvi_process_group_barrier( int qvi_process_group_gather_bbuffs( qvi_process_group_t *group, - qvi_bbuff_t *txbuff, + qvi_bbuff *txbuff, int root, bool *shared, - qvi_bbuff_t ***rxbuffs + qvi_bbuff ***rxbuffs ); /** @@ -78,9 +78,9 @@ qvi_process_group_gather_bbuffs( int qvi_process_group_scatter_bbuffs( qvi_process_group_t *group, - qvi_bbuff_t **txbuffs, + qvi_bbuff **txbuffs, int root, - qvi_bbuff_t **rxbuff + qvi_bbuff **rxbuff ); #endif diff --git a/src/qvi-pthread.cc b/src/qvi-pthread.cc index 4cfa227..1a63474 100644 --- a/src/qvi-pthread.cc +++ b/src/qvi-pthread.cc @@ -61,7 +61,7 @@ qvi_pthread_group_s::call_first_from_pthread_create( // Everyone can now create their task and populate the mapping table. { std::lock_guard guard(group->m_mutex); - qvi_task_t *task = nullptr; + qvi_task *task = nullptr; const int rc = qvi_new(&task); if (qvi_unlikely(rc != QV_SUCCESS)) throw qvi_runtime_error(); group->m_tid2task.insert({mytid, task}); @@ -97,7 +97,7 @@ qvi_pthread_group_s::rank(void) return m_tid2rank.at(qvi_gettid()); } -qvi_task_t * +qvi_task * qvi_pthread_group_s::task(void) { std::lock_guard guard(m_mutex); @@ -126,10 +126,10 @@ qvi_pthread_group_s::split( int qvi_pthread_group_s::gather( - qvi_bbuff_t *, + qvi_bbuff *, int, bool *, - qvi_bbuff_t *** + qvi_bbuff *** ) { // TODO(skg) return QV_ERR_NOT_SUPPORTED; @@ -137,9 +137,9 @@ qvi_pthread_group_s::gather( int qvi_pthread_group_s::scatter( - qvi_bbuff_t **, + qvi_bbuff **, int, - qvi_bbuff_t ** + qvi_bbuff ** ) { // TODO(skg) return QV_ERR_NOT_SUPPORTED; diff --git a/src/qvi-pthread.h b/src/qvi-pthread.h index d14bc63..06b9b77 100644 --- a/src/qvi-pthread.h +++ b/src/qvi-pthread.h @@ -49,7 +49,7 @@ struct qvi_pthread_group_s { /** Holds TID to rank mapping. */ std::map m_tid2rank; /** Holds TID to task mapping. */ - std::map m_tid2task; + std::map m_tid2task; /** Used for mutexy things. */ std::mutex m_mutex; /** Used for barrier things. */ @@ -78,7 +78,7 @@ struct qvi_pthread_group_s { /** Destructor. */ ~qvi_pthread_group_s(void); - qvi_task_t * + qvi_task * task(void); int @@ -99,17 +99,17 @@ struct qvi_pthread_group_s { int gather( - qvi_bbuff_t *txbuff, + qvi_bbuff *txbuff, int root, bool *shared, - qvi_bbuff_t ***rxbuffs + qvi_bbuff ***rxbuffs ); int scatter( - qvi_bbuff_t **txbuffs, + qvi_bbuff **txbuffs, int root, - qvi_bbuff_t **rxbuff + qvi_bbuff **rxbuff ); }; typedef struct qvi_pthread_group_s qvi_pthread_group_t; diff --git a/src/qvi-rmi.cc b/src/qvi-rmi.cc index bebb58c..342000f 100644 --- a/src/qvi-rmi.cc +++ b/src/qvi-rmi.cc @@ -82,7 +82,7 @@ typedef int (*qvi_rpc_fun_ptr_t)( qvi_rmi_server_t *, qvi_msg_header_t *, void *, - qvi_bbuff_t ** + qvi_bbuff ** ); static void @@ -124,7 +124,7 @@ struct qvi_rmi_server_s { /** Server configuration. */ qvi_rmi_config_s config; /** The base resource pool maintained by the server. */ - qvi_hwpool_s *hwpool = nullptr; + qvi_hwpool *hwpool = nullptr; /** ZMQ context. */ void *zctx = nullptr; /** Loopback socket for managerial messages. */ @@ -265,13 +265,13 @@ msg_free_byte_buffer_cb( void *, void *hint ) { - qvi_bbuff_t *buff = (qvi_bbuff_t *)hint; + qvi_bbuff *buff = (qvi_bbuff *)hint; qvi_bbuff_delete(&buff); } static int buffer_append_header( - qvi_bbuff_t *buff, + qvi_bbuff *buff, qvi_rpc_funid_t fid, cstr_t picture ) { @@ -310,7 +310,7 @@ unpack_msg_header( static inline int zmsg_init_from_bbuff( - qvi_bbuff_t *bbuff, + qvi_bbuff *bbuff, zmq_msg_t *zmsg ) { const size_t buffer_size = bbuff->size(); @@ -367,13 +367,13 @@ zmsg_recv( template static int rpc_pack( - qvi_bbuff_t **buff, + qvi_bbuff **buff, qvi_rpc_funid_t fid, Types &&...args ) { std::string picture; - qvi_bbuff_t *ibuff = nullptr; + qvi_bbuff *ibuff = nullptr; int rc = qvi_bbuff_new(&ibuff); if (qvi_unlikely(rc != QV_SUCCESS)) goto out; // Get the picture based on the types passed. @@ -427,7 +427,7 @@ rpc_req( ) { int buffer_size = 0; - qvi_bbuff_t *buff = nullptr; + qvi_bbuff *buff = nullptr; int rc = rpc_pack(&buff, fid, std::forward(args)...); if (qvi_unlikely(rc != QV_SUCCESS)) { qvi_bbuff_delete(&buff); @@ -476,7 +476,7 @@ rpc_ssi_invalid( qvi_rmi_server_t *, qvi_msg_header_t *, void *, - qvi_bbuff_t ** + qvi_bbuff ** ) { qvi_log_error("Something bad happened in RPC dispatch."); qvi_abort(); @@ -488,7 +488,7 @@ rpc_ssi_shutdown( qvi_rmi_server_t *, qvi_msg_header_t *hdr, void *, - qvi_bbuff_t **output + qvi_bbuff **output ) { (void)rpc_pack(output, hdr->fid, QVI_BBUFF_RMI_ZERO_MSG); return QV_SUCCESS_SHUTDOWN; @@ -499,7 +499,7 @@ rpc_ssi_hello( qvi_rmi_server_t *server, qvi_msg_header_t *hdr, void *input, - qvi_bbuff_t **output + qvi_bbuff **output ) { // TODO(skg) This will go into some registry somewhere. pid_t whoisit; @@ -518,7 +518,7 @@ rpc_ssi_gbye( qvi_rmi_server_t *, qvi_msg_header_t *, void *, - qvi_bbuff_t ** + qvi_bbuff ** ) { return QV_ERR_INVLD_ARG; } @@ -528,7 +528,7 @@ rpc_ssi_cpubind( qvi_rmi_server_t *server, qvi_msg_header_t *hdr, void *input, - qvi_bbuff_t **output + qvi_bbuff **output ) { pid_t who; int qvrc = qvi_bbuff_rmi_unpack(input, &who); @@ -549,7 +549,7 @@ rpc_ssi_set_cpubind( qvi_rmi_server_t *server, qvi_msg_header_t *hdr, void *input, - qvi_bbuff_t **output + qvi_bbuff **output ) { pid_t who; hwloc_cpuset_t cpuset = nullptr; @@ -568,7 +568,7 @@ rpc_ssi_obj_type_depth( qvi_rmi_server_t *server, qvi_msg_header_t *hdr, void *input, - qvi_bbuff_t **output + qvi_bbuff **output ) { qv_hw_obj_type_t obj; const int qvrc = qvi_bbuff_rmi_unpack( @@ -589,7 +589,7 @@ rpc_ssi_get_nobjs_in_cpuset( qvi_rmi_server_t *server, qvi_msg_header_t *hdr, void *input, - qvi_bbuff_t **output + qvi_bbuff **output ) { qv_hw_obj_type_t target_obj; hwloc_cpuset_t cpuset = nullptr; @@ -614,7 +614,7 @@ rpc_ssi_get_device_in_cpuset( qvi_rmi_server_t *server, qvi_msg_header_t *hdr, void *input, - qvi_bbuff_t **output + qvi_bbuff **output ) { qv_hw_obj_type_t dev_obj; int dev_i; @@ -641,10 +641,10 @@ static int get_intrinsic_scope_user( qvi_rmi_server_t *server, pid_t, - qvi_hwpool_s **hwpool + qvi_hwpool **hwpool ) { // TODO(skg) Is the cpuset the best way to do this? - return qvi_hwpool_s::create( + return qvi_hwpool::create( server->config.hwloc, qvi_hwloc_topo_get_cpuset(server->config.hwloc), hwpool @@ -655,7 +655,7 @@ static int get_intrinsic_scope_proc( qvi_rmi_server_t *server, pid_t who, - qvi_hwpool_s **hwpool + qvi_hwpool **hwpool ) { hwloc_cpuset_t cpuset = nullptr; int rc = qvi_hwloc_task_get_cpubind( @@ -663,7 +663,7 @@ get_intrinsic_scope_proc( ); if (rc != QV_SUCCESS) goto out; - rc = qvi_hwpool_s::create( + rc = qvi_hwpool::create( server->config.hwloc, cpuset, hwpool ); out: @@ -680,7 +680,7 @@ rpc_ssi_scope_get_intrinsic_hwpool( qvi_rmi_server_t *server, qvi_msg_header_t *hdr, void *input, - qvi_bbuff_t **output + qvi_bbuff **output ) { // Get requestor task id (type and pid) and intrinsic scope as integers // from client request. @@ -691,7 +691,7 @@ rpc_ssi_scope_get_intrinsic_hwpool( int rpcrc = QV_SUCCESS; // TODO(skg) Implement the rest. - qvi_hwpool_s *hwpool = nullptr; + qvi_hwpool *hwpool = nullptr; switch (iscope) { case QV_SCOPE_SYSTEM: case QV_SCOPE_USER: @@ -752,7 +752,7 @@ server_rpc_dispatch( goto out; } - qvi_bbuff_t *res; + qvi_bbuff *res; rc = fidfunp->second(server, &hdr, body, &res); if (rc != QV_SUCCESS && rc != QV_SUCCESS_SHUTDOWN) { cstr_t ers = "RPC dispatch failed"; @@ -988,7 +988,7 @@ qvi_rmi_get_intrinsic_hwpool( qvi_rmi_client_t *client, pid_t who, qv_scope_intrinsic_t iscope, - qvi_hwpool_s **hwpool + qvi_hwpool **hwpool ) { *hwpool = nullptr; diff --git a/src/qvi-rmi.h b/src/qvi-rmi.h index 6c9ae88..0740aea 100644 --- a/src/qvi-rmi.h +++ b/src/qvi-rmi.h @@ -117,7 +117,7 @@ qvi_rmi_get_intrinsic_hwpool( qvi_rmi_client_t *client, pid_t task_id, qv_scope_intrinsic_t iscope, - qvi_hwpool_s **hwpool + qvi_hwpool **hwpool ); /** diff --git a/src/qvi-scope.cc b/src/qvi-scope.cc index 65a7ae0..b89e805 100644 --- a/src/qvi-scope.cc +++ b/src/qvi-scope.cc @@ -21,51 +21,42 @@ #include "qvi-hwsplit.h" #include "qvi-utils.h" -qv_scope_s::qv_scope_s( - qvi_group_t *group, - qvi_hwpool_s *hwpool +qv_scope::qv_scope( + qvi_group *group, + qvi_hwpool *hwpool ) : m_group(group) , m_hwpool(hwpool) { } -qv_scope_s::~qv_scope_s(void) +qv_scope::~qv_scope(void) { qvi_delete(&m_hwpool); m_group->release(); } void -qv_scope_s::destroy( +qv_scope::destroy( qv_scope_t **scope ) { qvi_delete(scope); } void -qv_scope_s::thdestroy( +qv_scope::thdestroy( qv_scope_t ***kscopes, uint_t k ) { if (!kscopes) return; qv_scope_t **ikscopes = *kscopes; for (uint_t i = 0; i < k; ++i) { - qv_scope_s::destroy(&ikscopes[i]); + qv_scope::destroy(&ikscopes[i]); } delete[] ikscopes; *kscopes = nullptr; } -static int -scope_new( - qvi_group_t *group, - qvi_hwpool_s *hwpool, - qv_scope_t **scope -) { - return qvi_new(scope, group, hwpool); -} - int -qv_scope_s::make_intrinsic( - qvi_group_t *group, +qv_scope::make_intrinsic( + qvi_group *group, qv_scope_intrinsic_t iscope, qv_scope_t **scope ) { @@ -74,22 +65,22 @@ qv_scope_s::make_intrinsic( int rc = group->make_intrinsic(iscope); if (qvi_unlikely(rc != QV_SUCCESS)) return rc; // Get the requested intrinsic hardware pool. - qvi_hwpool_s *hwpool = nullptr; + qvi_hwpool *hwpool = nullptr; rc = qvi_rmi_get_intrinsic_hwpool( - group->task()->rmi(), qvi_task_s::mytid(), iscope, &hwpool + group->task()->rmi(), qvi_task::mytid(), iscope, &hwpool ); if (qvi_unlikely(rc != QV_SUCCESS)) return rc; // Create and initialize the scope. - rc = scope_new(group, hwpool, scope); + rc = qvi_new(scope, group, hwpool); if (qvi_unlikely(rc != QV_SUCCESS)) { - qv_scope_s::destroy(scope); + qv_scope::destroy(scope); } return rc; } // TODO(skg) Implement use of hints. int -qv_scope_s::create( +qv_scope::create( qv_hw_obj_type_t type, int nobjs, qv_scope_create_hints_t, @@ -97,11 +88,11 @@ qv_scope_s::create( ) { *child = nullptr; // Create underlying group. Notice the use of self here. - qvi_group_t *group = nullptr; + qvi_group *group = nullptr; int rc = m_group->self(&group); if (rc != QV_SUCCESS) return rc; // Create the hardware pool. - qvi_hwpool_s *hwpool = nullptr; + qvi_hwpool *hwpool = nullptr; rc = qvi_new(&hwpool); if (rc != QV_SUCCESS) { qvi_delete(&group); @@ -131,40 +122,40 @@ qv_scope_s::create( qvi_hwloc_bitmap_delete(&cpuset); // Create and initialize the new scope. qv_scope_t *ichild = nullptr; - rc = scope_new(group, hwpool, &ichild); + rc = qvi_new(&ichild, group, hwpool); if (rc != QV_SUCCESS) { - qv_scope_s::destroy(&ichild); + qv_scope::destroy(&ichild); } *child = ichild; return rc; } -qvi_group_t * -qv_scope_s::group(void) const +qvi_group * +qv_scope::group(void) const { return m_group; } -qvi_hwpool_s * -qv_scope_s::hwpool(void) const +qvi_hwpool * +qv_scope::hwpool(void) const { return m_hwpool; } int -qv_scope_s::group_size(void) const +qv_scope::group_size(void) const { return m_group->size(); } int -qv_scope_s::group_rank(void) const +qv_scope::group_rank(void) const { return m_group->rank(); } int -qv_scope_s::hwpool_nobjects( +qv_scope::hwpool_nobjects( qv_hw_obj_type_t obj ) const { int result = 0; @@ -173,7 +164,7 @@ qv_scope_s::hwpool_nobjects( } int -qv_scope_s::device_id( +qv_scope::device_id( qv_hw_obj_type_t dev_type, int dev_index, qv_device_id_type_t format, @@ -182,7 +173,7 @@ qv_scope_s::device_id( *result = nullptr; // Look for the requested device. int id = 0; - qvi_hwpool_dev_s *finfo = nullptr; + qvi_hwpool_dev *finfo = nullptr; for (const auto &dinfo : m_hwpool->devices()) { if (dev_type != dinfo.first) continue; if (id++ == dev_index) { @@ -196,13 +187,13 @@ qv_scope_s::device_id( } int -qv_scope_s::group_barrier(void) +qv_scope::group_barrier(void) { return m_group->barrier(); } int -qv_scope_s::bind_push(void) +qv_scope::bind_push(void) { return m_group->task()->bind_push( m_hwpool->cpuset().cdata() @@ -210,13 +201,13 @@ qv_scope_s::bind_push(void) } int -qv_scope_s::bind_pop(void) +qv_scope::bind_pop(void) { return m_group->task()->bind_pop(); } int -qv_scope_s::bind_string( +qv_scope::bind_string( qv_bind_string_format_t format, char **result ) { @@ -230,15 +221,15 @@ qv_scope_s::bind_string( } int -qv_scope_s::split( +qv_scope::split( int npieces, int color, qv_hw_obj_type_t maybe_obj_type, qv_scope_t **child ) { int rc = QV_SUCCESS, colorp = 0; - qvi_hwpool_s *hwpool = nullptr; - qvi_group_t *group = nullptr; + qvi_hwpool *hwpool = nullptr; + qvi_group *group = nullptr; qv_scope_t *ichild = nullptr; // Split the hardware resources based on the provided split parameters. qvi_hwsplit_coll_s chwsplit( @@ -252,19 +243,19 @@ qv_scope_s::split( ); if (rc != QV_SUCCESS) goto out; // Create and initialize the new scope. - rc = scope_new(group, hwpool, &ichild); + rc = qvi_new(&ichild, group, hwpool); out: if (rc != QV_SUCCESS) { qvi_delete(&hwpool); qvi_delete(&group); - qv_scope_s::destroy(&ichild); + qv_scope::destroy(&ichild); } *child = ichild; return rc; } int -qv_scope_s::split_at( +qv_scope::split_at( qv_hw_obj_type_t type, int color, qv_scope_t **child @@ -273,7 +264,7 @@ qv_scope_s::split_at( } int -qv_scope_s::thsplit( +qv_scope::thsplit( uint_t npieces, int *kcolors, uint_t k, @@ -291,7 +282,7 @@ qv_scope_s::thsplit( // hardware affinity here, and replicate them in the following loop // that populates splitagg. //No point in doing this in a loop. - const pid_t taskid = qvi_task_t::mytid(); + const pid_t taskid = qvi_task::mytid(); hwloc_cpuset_t task_affinity = nullptr; // Get the task's current affinity. int rc = m_group->task()->bind_top(&task_affinity); @@ -317,25 +308,25 @@ qv_scope_s::thsplit( // Split off from our parent group. This call is called from a context in // which a process is splitting its resources across threads, so create a // new thread group for each child. - qvi_group_t *thgroup = nullptr; + qvi_group *thgroup = nullptr; rc = m_group->thsplit(group_size, &thgroup); if (rc != QV_SUCCESS) return rc; // Now create and populate the children. qv_scope_t **ithchildren = new qv_scope_t *[group_size]; for (uint_t i = 0; i < group_size; ++i) { // Copy out, since the hardware pools in splitagg will get freed. - qvi_hwpool_s *hwpool = nullptr; + qvi_hwpool *hwpool = nullptr; rc = qvi_dup(*hwsplit.m_hwpools[i], &hwpool); if (rc != QV_SUCCESS) break; // Create and initialize the new scope. qv_scope_t *child = nullptr; - rc = scope_new(thgroup, hwpool, &child); + rc = qvi_new(&child, thgroup, hwpool); if (rc != QV_SUCCESS) break; thgroup->retain(); ithchildren[i] = child; } if (rc != QV_SUCCESS) { - qv_scope_s::thdestroy(&ithchildren, k); + qv_scope::thdestroy(&ithchildren, k); } else { // Subtract one to account for the parent's @@ -347,7 +338,7 @@ qv_scope_s::thsplit( } int -qv_scope_s::thsplit_at( +qv_scope::thsplit_at( qv_hw_obj_type_t type, int *kgroup_ids, uint_t k, diff --git a/src/qvi-scope.h b/src/qvi-scope.h index 4ac03af..986b066 100644 --- a/src/qvi-scope.h +++ b/src/qvi-scope.h @@ -21,24 +21,24 @@ #include "qvi-group.h" #include "qvi-hwpool.h" -struct qv_scope_s { +struct qv_scope { private: /** Task group associated with this scope instance. */ - qvi_group_t *m_group = nullptr; + qvi_group *m_group = nullptr; /** Hardware resource pool. */ - qvi_hwpool_s *m_hwpool = nullptr; + qvi_hwpool *m_hwpool = nullptr; public: /** Constructor */ - qv_scope_s(void) = delete; + qv_scope(void) = delete; /** Constructor */ - qv_scope_s( - qvi_group_t *group, - qvi_hwpool_s *hwpool + qv_scope( + qvi_group *group, + qvi_hwpool *hwpool ); /** Takes the provided group and creates a new intrinsic scope from it. */ static int make_intrinsic( - qvi_group_t *group, + qvi_group *group, qv_scope_intrinsic_t iscope, qv_scope_t **scope ); @@ -54,7 +54,7 @@ struct qv_scope_s { qv_scope_t **child ); /** Destructor */ - ~qv_scope_s(void); + ~qv_scope(void); /** Destroys a scope. */ static void destroy( @@ -67,10 +67,10 @@ struct qv_scope_s { uint_t k ); /** Returns a pointer to the scope's underlying group. */ - qvi_group_t * + qvi_group * group(void) const; /** Returns a pointer to the scope's underlying hardware pool. */ - qvi_hwpool_s * + qvi_hwpool * hwpool(void) const; /** Returns the scope's group size. */ int diff --git a/src/qvi-task.cc b/src/qvi-task.cc index 7b6b2fc..6b67cb8 100644 --- a/src/qvi-task.cc +++ b/src/qvi-task.cc @@ -19,13 +19,13 @@ #include "qvi-utils.h" pid_t -qvi_task_s::mytid(void) +qvi_task::mytid(void) { return qvi_gettid(); } int -qvi_task_s::connect_to_server(void) +qvi_task::connect_to_server(void) { std::string url; const int rc = qvi_url(url); @@ -37,7 +37,7 @@ qvi_task_s::connect_to_server(void) } int -qvi_task_s::init_bind_stack(void) +qvi_task::init_bind_stack(void) { // Cache current binding. hwloc_cpuset_t current_bind = nullptr; @@ -51,7 +51,7 @@ qvi_task_s::init_bind_stack(void) return rc; } -qvi_task_s::qvi_task_s(void) +qvi_task::qvi_task(void) { int rc = qvi_rmi_client_new(&m_rmi); if (qvi_unlikely(rc != QV_SUCCESS)) throw qvi_runtime_error(); @@ -63,7 +63,7 @@ qvi_task_s::qvi_task_s(void) if (qvi_unlikely(rc != QV_SUCCESS)) throw qvi_runtime_error(); } -qvi_task_s::~qvi_task_s(void) +qvi_task::~qvi_task(void) { while (!m_stack.empty()) { m_stack.pop(); @@ -72,21 +72,21 @@ qvi_task_s::~qvi_task_s(void) } qvi_rmi_client_t * -qvi_task_s::rmi(void) +qvi_task::rmi(void) { assert(m_rmi); return m_rmi; } qvi_hwloc_t * -qvi_task_s::hwloc(void) +qvi_task::hwloc(void) { assert(m_rmi); return qvi_rmi_client_hwloc(m_rmi); } int -qvi_task_s::bind_push( +qvi_task::bind_push( hwloc_const_cpuset_t cpuset ) { // Copy input bitmap because we don't want to directly modify it. @@ -102,7 +102,7 @@ qvi_task_s::bind_push( } int -qvi_task_s::bind_pop(void) +qvi_task::bind_pop(void) { m_stack.pop(); @@ -112,7 +112,7 @@ qvi_task_s::bind_pop(void) } int -qvi_task_s::bind_top( +qvi_task::bind_top( hwloc_cpuset_t *result ) { return qvi_hwloc_bitmap_dup(m_stack.top().cdata(), result); diff --git a/src/qvi-task.h b/src/qvi-task.h index a52e016..954d56b 100644 --- a/src/qvi-task.h +++ b/src/qvi-task.h @@ -22,7 +22,7 @@ using qvi_task_bind_stack_t = std::stack; -struct qvi_task_s { +struct qvi_task { private: /** Client-side connection to the RMI. */ qvi_rmi_client_t *m_rmi = nullptr; @@ -39,11 +39,11 @@ struct qvi_task_s { static pid_t mytid(void); /** Constructor. */ - qvi_task_s(void); + qvi_task(void); /** Copy constructor. */ - qvi_task_s(const qvi_task_s &src) = delete; + qvi_task(const qvi_task &src) = delete; /** Destructor. */ - ~qvi_task_s(void); + ~qvi_task(void); /** Returns a pointer to the task's RMI. */ qvi_rmi_client_t * rmi(void); diff --git a/src/qvi-utils.h b/src/qvi-utils.h index 36e351d..6c257ca 100644 --- a/src/qvi-utils.h +++ b/src/qvi-utils.h @@ -24,11 +24,11 @@ /** * Reference counting base class that provides retain/release semantics. */ -struct qvi_refc_s { +struct qvi_refc { private: mutable std::atomic refc = {1}; public: - virtual ~qvi_refc_s(void) = default; + virtual ~qvi_refc(void) = default; void retain(void) const