diff --git a/libs/core/lci_base/src/lci_environment.cpp b/libs/core/lci_base/src/lci_environment.cpp index 20ab90d800a3..f3e51a29eb30 100644 --- a/libs/core/lci_base/src/lci_environment.cpp +++ b/libs/core/lci_base/src/lci_environment.cpp @@ -233,7 +233,8 @@ namespace hpx { namespace util { } void lci_environment::log([[maybe_unused]] log_level_t level, - [[maybe_unused]] const char* tag, [[maybe_unused]] const char* format, ...) + [[maybe_unused]] const char* tag, [[maybe_unused]] const char* format, + ...) { #ifdef HPX_HAVE_PARCELPORT_LCI_LOG if (level > log_level) @@ -263,20 +264,26 @@ namespace hpx { namespace util { return 0; } - void lci_environment::pcounter_add([[maybe_unused]] LCT_pcounter_handle_t handle, [[maybe_unused]] int64_t val) + void lci_environment::pcounter_add( + [[maybe_unused]] LCT_pcounter_handle_t handle, + [[maybe_unused]] int64_t val) { #ifdef HPX_HAVE_PARCELPORT_LCI_PCOUNTER LCT_pcounter_add(pcounter_ctx, handle, val); #endif } - void lci_environment::pcounter_start([[maybe_unused]] LCT_pcounter_handle_t handle) { + void lci_environment::pcounter_start( + [[maybe_unused]] LCT_pcounter_handle_t handle) + { #ifdef HPX_HAVE_PARCELPORT_LCI_PCOUNTER LCT_pcounter_start(pcounter_ctx, handle); #endif } - void lci_environment::pcounter_end([[maybe_unused]] LCT_pcounter_handle_t handle) { + void lci_environment::pcounter_end( + [[maybe_unused]] LCT_pcounter_handle_t handle) + { #ifdef HPX_HAVE_PARCELPORT_LCI_PCOUNTER LCT_pcounter_end(pcounter_ctx, handle); #endif diff --git a/libs/full/parcelport_lci/include/hpx/parcelport_lci/parcelport_lci.hpp b/libs/full/parcelport_lci/include/hpx/parcelport_lci/parcelport_lci.hpp index 65e1c8ae9510..94d975437ce7 100644 --- a/libs/full/parcelport_lci/include/hpx/parcelport_lci/parcelport_lci.hpp +++ b/libs/full/parcelport_lci/include/hpx/parcelport_lci/parcelport_lci.hpp @@ -132,19 +132,18 @@ namespace hpx::parcelset { LCI_device_t device; LCI_endpoint_t endpoint_new; LCI_endpoint_t endpoint_followup; - completion_manager_t *completion_manager_p; + completion_manager_t* completion_manager_p; }; std::vector devices; // Parcelport objects static std::atomic prg_thread_flag; std::unique_ptr prg_thread_p; - struct completion_manager_t { + struct completion_manager_t + { std::shared_ptr send; - std::shared_ptr - recv_new; - std::shared_ptr - recv_followup; + std::shared_ptr recv_new; + std::shared_ptr recv_followup; }; std::vector completion_managers; diff --git a/libs/full/parcelport_lci/include/hpx/parcelport_lci/putva/receiver_putva.hpp b/libs/full/parcelport_lci/include/hpx/parcelport_lci/putva/receiver_putva.hpp index 9e7773e86399..09fbc87f52fd 100644 --- a/libs/full/parcelport_lci/include/hpx/parcelport_lci/putva/receiver_putva.hpp +++ b/libs/full/parcelport_lci/include/hpx/parcelport_lci/putva/receiver_putva.hpp @@ -94,7 +94,8 @@ namespace hpx::parcelset::policies::lci { hpx::chrono::high_resolution_timer timer_; parcelset::data_point& data = buffer.data_point_; #endif - util::lci_environment::pcounter_add(util::lci_environment::recv_conn_start, 1); + util::lci_environment::pcounter_add( + util::lci_environment::recv_conn_start, 1); // decode header header header_ = header((char*) address); header_.assert_valid(); @@ -109,7 +110,8 @@ namespace hpx::parcelset::policies::lci { int num_non_zero_copy_chunks = header_.num_non_zero_copy_chunks(); buffer.num_chunks_.first = num_zero_copy_chunks; buffer.num_chunks_.second = num_non_zero_copy_chunks; - util::lci_environment::pcounter_add(util::lci_environment::recv_conn_end, 1); + util::lci_environment::pcounter_add( + util::lci_environment::recv_conn_end, 1); #if defined(HPX_HAVE_PARCELPORT_COUNTERS) data.bytes_ = static_cast(header_.numbytes()); data.time_ = timer_.elapsed_nanoseconds() - data.time_; @@ -124,7 +126,8 @@ namespace hpx::parcelset::policies::lci { parcelset::data_point& data = buffer.data_point_; data.time_ = timer_.elapsed_nanoseconds(); #endif - util::lci_environment::pcounter_add(util::lci_environment::recv_conn_start, 1); + util::lci_environment::pcounter_add( + util::lci_environment::recv_conn_start, 1); // decode header header header_ = header((char*) iovec.piggy_back.address); header_.assert_valid(); @@ -183,7 +186,8 @@ namespace hpx::parcelset::policies::lci { } } HPX_ASSERT(i == iovec.count); - util::lci_environment::pcounter_add(util::lci_environment::recv_conn_end, 1); + util::lci_environment::pcounter_add( + util::lci_environment::recv_conn_end, 1); #if defined(HPX_HAVE_PARCELPORT_COUNTERS) data.bytes_ = static_cast(header_.numbytes()); data.time_ = timer_.elapsed_nanoseconds(); diff --git a/libs/full/parcelport_lci/include/hpx/parcelport_lci/sendrecv/receiver_connection_sendrecv.hpp b/libs/full/parcelport_lci/include/hpx/parcelport_lci/sendrecv/receiver_connection_sendrecv.hpp index 3a1348daf466..c2194c7bfe68 100644 --- a/libs/full/parcelport_lci/include/hpx/parcelport_lci/sendrecv/receiver_connection_sendrecv.hpp +++ b/libs/full/parcelport_lci/include/hpx/parcelport_lci/sendrecv/receiver_connection_sendrecv.hpp @@ -32,8 +32,7 @@ namespace hpx::parcelset::policies::lci { }; public: - receiver_connection_sendrecv( - int dst, parcelset::parcelport* pp); + receiver_connection_sendrecv(int dst, parcelset::parcelport* pp); ~receiver_connection_sendrecv() {} void load(char* header_buffer); return_t receive(); diff --git a/libs/full/parcelport_lci/include/hpx/parcelport_lci/sendrecv/receiver_sendrecv.hpp b/libs/full/parcelport_lci/include/hpx/parcelport_lci/sendrecv/receiver_sendrecv.hpp index c764faca6ef4..a67c4550e428 100644 --- a/libs/full/parcelport_lci/include/hpx/parcelport_lci/sendrecv/receiver_sendrecv.hpp +++ b/libs/full/parcelport_lci/include/hpx/parcelport_lci/sendrecv/receiver_sendrecv.hpp @@ -47,9 +47,9 @@ namespace hpx::parcelset::policies::lci { auto& device = pp->devices[i]; for (int j = 0; j < config_t::prepost_recv_num; ++j) { - LCI_comp_t completion = device.completion_manager_p - ->recv_new - ->alloc_completion(); + LCI_comp_t completion = + device.completion_manager_p->recv_new + ->alloc_completion(); LCI_recvmn(device.endpoint_new, LCI_RANK_ANY, 0, completion, (void*) i); device.completion_manager_p->recv_new @@ -61,8 +61,7 @@ namespace hpx::parcelset::policies::lci { ~receiver_sendrecv() {} - connection_ptr create_connection( - int dest, parcelset::parcelport* pp); + connection_ptr create_connection(int dest, parcelset::parcelport* pp); bool background_work() noexcept; diff --git a/libs/full/parcelport_lci/src/config.cpp b/libs/full/parcelport_lci/src/config.cpp index 28d0147cb07a..6d527cf14f23 100644 --- a/libs/full/parcelport_lci/src/config.cpp +++ b/libs/full/parcelport_lci/src/config.cpp @@ -120,18 +120,22 @@ namespace hpx::parcelset::policies::lci { fprintf(stderr, "WARNING: set progress_type to pthread!\n"); } #ifndef LCI_ENABLE_MULTITHREAD_PROGRESS - if (progress_type == progress_type_t::worker - || progress_thread_num > ndevices) { - fprintf(stderr, "WARNING: Thread-safe LCI_progress is needed " - "but not enabled during compilation!\n"); + if (progress_type == progress_type_t::worker || + progress_thread_num > ndevices) + { + fprintf(stderr, + "WARNING: Thread-safe LCI_progress is needed " + "but not enabled during compilation!\n"); } #endif - if (ncomps > ndevices) { + if (ncomps > ndevices) + { int old_ncomps = ncomps; ncomps = ndevices; - fprintf(stderr, "WARNING: the number of completion managers (%d) " - "cannot exceed the number of devices (%d). " - "ncomps is adjusted accordingly (%d).", + fprintf(stderr, + "WARNING: the number of completion managers (%d) " + "cannot exceed the number of devices (%d). " + "ncomps is adjusted accordingly (%d).", old_ncomps, ndevices, ncomps); } } diff --git a/libs/full/parcelport_lci/src/parcelport_lci.cpp b/libs/full/parcelport_lci/src/parcelport_lci.cpp index 1110c80838ce..c6d47958f928 100644 --- a/libs/full/parcelport_lci/src/parcelport_lci.cpp +++ b/libs/full/parcelport_lci/src/parcelport_lci.cpp @@ -35,6 +35,7 @@ #include #include #include +#include namespace hpx::parcelset::policies::lci { @@ -216,9 +217,10 @@ namespace hpx::parcelset::policies::lci { do_progress_local(); if (config_t::enable_lci_backlog_queue) // try to send pending messages - has_work = backlog_queue::background_work( - get_tls_device().completion_manager_p - ->send.get(), num_thread) || + has_work = + backlog_queue::background_work( + get_tls_device().completion_manager_p->send.get(), + num_thread) || has_work; } if (mode & parcelport_background_mode_receive) @@ -307,7 +309,7 @@ namespace hpx::parcelset::policies::lci { // Create completion managers completion_managers.resize(config_t::ncomps); - for (auto &completion_manager : completion_managers) + for (auto& completion_manager : completion_managers) { if (config_t::protocol == config_t::protocol_t::sendrecv && config_t::completion_type == LCI_COMPLETION_SYNC) diff --git a/libs/full/parcelport_lci/src/sender_base.cpp b/libs/full/parcelport_lci/src/sender_base.cpp index da2bcfc24b30..5eef8fb8c4c9 100644 --- a/libs/full/parcelport_lci/src/sender_base.cpp +++ b/libs/full/parcelport_lci/src/sender_base.cpp @@ -50,8 +50,7 @@ namespace hpx::parcelset::policies::lci { else if (ret.status == sender_connection_base::return_status_t::wait) { - completion_manager_p->send->enqueue_completion( - ret.completion); + completion_manager_p->send->enqueue_completion(ret.completion); } util::lci_environment::pcounter_add( util::lci_environment::useful_bg_work, diff --git a/libs/full/parcelport_lci/src/sender_connection_base.cpp b/libs/full/parcelport_lci/src/sender_connection_base.cpp index 3dc06ad2452c..db78212232ee 100644 --- a/libs/full/parcelport_lci/src/sender_connection_base.cpp +++ b/libs/full/parcelport_lci/src/sender_connection_base.cpp @@ -30,7 +30,8 @@ namespace hpx::parcelset::policies::lci { sender_connection_base::handler_type&& handler, sender_connection_base::postprocess_handler_type&& parcel_postprocess) { - LCT_time_t async_write_start_time = util::lci_environment::pcounter_now(); + LCT_time_t async_write_start_time = + util::lci_environment::pcounter_now(); device_p = &pp_->get_tls_device(); load(HPX_FORWARD(handler_type, handler), HPX_FORWARD(postprocess_handler_type, parcel_postprocess)); @@ -41,8 +42,8 @@ namespace hpx::parcelset::policies::lci { } else if (ret.status == return_status_t::wait) { - device_p->completion_manager_p->send - ->enqueue_completion(ret.completion); + device_p->completion_manager_p->send->enqueue_completion( + ret.completion); } util::lci_environment::pcounter_add( util::lci_environment::async_write_timer, @@ -106,7 +107,8 @@ namespace hpx::parcelset::policies::lci { void sender_connection_base::profile_start_hook(const header& header_) { - util::lci_environment::pcounter_add(util::lci_environment::send_conn_start, 1); + util::lci_environment::pcounter_add( + util::lci_environment::send_conn_start, 1); if (util::lci_environment::log_level < util::lci_environment::log_level_t::profile) return; @@ -138,7 +140,8 @@ namespace hpx::parcelset::policies::lci { util::lci_environment::log(util::lci_environment::log_level_t::profile, "send", "%d:%lf:send_connection(%p) end\n", LCI_RANK, hpx::chrono::high_resolution_clock::now() / 1e9, (void*) this); - util::lci_environment::pcounter_add(util::lci_environment::send_conn_end, 1); + util::lci_environment::pcounter_add( + util::lci_environment::send_conn_end, 1); } } // namespace hpx::parcelset::policies::lci diff --git a/libs/full/parcelport_lci/src/sendrecv/receiver_connection_sendrecv.cpp b/libs/full/parcelport_lci/src/sendrecv/receiver_connection_sendrecv.cpp index dbd8f7acd4ff..9dd683db0df1 100644 --- a/libs/full/parcelport_lci/src/sendrecv/receiver_connection_sendrecv.cpp +++ b/libs/full/parcelport_lci/src/sendrecv/receiver_connection_sendrecv.cpp @@ -33,7 +33,8 @@ namespace hpx::parcelset::policies::lci { void receiver_connection_sendrecv::load(char* header_buffer) { conn_start_time = util::lci_environment::pcounter_now(); - util::lci_environment::pcounter_add(util::lci_environment::recv_conn_start, 1); + util::lci_environment::pcounter_add( + util::lci_environment::recv_conn_start, 1); header header_ = header(header_buffer); header_.assert_valid(); #if defined(HPX_HAVE_PARCELPORT_COUNTERS) @@ -148,8 +149,8 @@ namespace hpx::parcelset::policies::lci { HPX_UNUSED(ret); util::lci_environment::log( util::lci_environment::log_level_t::debug, "recv", - "recvm (%d, %d, %d) device %d tag %d size %d\n", dst_rank, LCI_RANK, - original_tag, device_p->idx, tag, length); + "recvm (%d, %d, %d) device %d tag %d size %d\n", dst_rank, + LCI_RANK, original_tag, device_p->idx, tag, length); tag = (tag + 1) % LCI_MAX_TAG; } else @@ -172,8 +173,8 @@ namespace hpx::parcelset::policies::lci { HPX_UNUSED(ret); util::lci_environment::log( util::lci_environment::log_level_t::debug, "recv", - "recvl (%d, %d, %d) device %d tag %d size %d\n", dst_rank, LCI_RANK, - original_tag, device_p->idx, tag, length); + "recvl (%d, %d, %d) device %d tag %d size %d\n", dst_rank, + LCI_RANK, original_tag, device_p->idx, tag, length); tag = (tag + 1) % LCI_MAX_TAG; if (segment_used != LCI_SEGMENT_ALL) { @@ -353,7 +354,8 @@ namespace hpx::parcelset::policies::lci { void receiver_connection_sendrecv::done() { - util::lci_environment::pcounter_add(util::lci_environment::recv_conn_end, 1); + util::lci_environment::pcounter_add( + util::lci_environment::recv_conn_end, 1); util::lci_environment::log(util::lci_environment::log_level_t::debug, "recv", "recv connection (%d, %d, %d, %d) done!\n", dst_rank, LCI_RANK, original_tag, tag - original_tag + 1); diff --git a/libs/full/parcelport_lci/src/sendrecv/receiver_sendrecv.cpp b/libs/full/parcelport_lci/src/sendrecv/receiver_sendrecv.cpp index 6e46962a98e2..bad98c15a1fa 100644 --- a/libs/full/parcelport_lci/src/sendrecv/receiver_sendrecv.cpp +++ b/libs/full/parcelport_lci/src/sendrecv/receiver_sendrecv.cpp @@ -17,14 +17,14 @@ #include #include +#include #include namespace hpx::parcelset::policies::lci { receiver_sendrecv::connection_ptr receiver_sendrecv::create_connection( int dest, parcelset::parcelport* pp) { - return std::make_shared( - dest, pp); + return std::make_shared(dest, pp); } bool receiver_sendrecv::background_work() noexcept diff --git a/libs/full/parcelport_lci/src/sendrecv/sender_connection_sendrecv.cpp b/libs/full/parcelport_lci/src/sendrecv/sender_connection_sendrecv.cpp index fcccfdc84b1c..8614ad5e7cb6 100644 --- a/libs/full/parcelport_lci/src/sendrecv/sender_connection_sendrecv.cpp +++ b/libs/full/parcelport_lci/src/sendrecv/sender_connection_sendrecv.cpp @@ -185,8 +185,8 @@ namespace hpx::parcelset::policies::lci { { util::lci_environment::log( util::lci_environment::log_level_t::debug, "send", - "sendm (%d, %d, %d) device %d tag %d size %d\n", LCI_RANK, dst_rank, - original_tag, device_p->idx, tag, length); + "sendm (%d, %d, %d) device %d tag %d size %d\n", LCI_RANK, + dst_rank, original_tag, device_p->idx, tag, length); tag = (tag + 1) % LCI_MAX_TAG; return {return_status_t::done, nullptr}; } @@ -218,8 +218,8 @@ namespace hpx::parcelset::policies::lci { { util::lci_environment::log( util::lci_environment::log_level_t::debug, "send", - "sendl (%d, %d, %d) device %d, tag %d size %d\n", LCI_RANK, dst_rank, - original_tag, device_p->idx, tag, length); + "sendl (%d, %d, %d) device %d, tag %d size %d\n", LCI_RANK, + dst_rank, original_tag, device_p->idx, tag, length); tag = (tag + 1) % LCI_MAX_TAG; if (segment_used != LCI_SEGMENT_ALL) {