From 6ae32e02bfcbc34dfb0573253dc1068a224bd16b Mon Sep 17 00:00:00 2001 From: ryan-dozier Date: Mon, 10 Jun 2024 13:47:40 -0400 Subject: [PATCH] changed from byte[] to vector on recv side to mirror sends --- include/ygm/comm.hpp | 4 ++-- include/ygm/detail/comm.ipp | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/ygm/comm.hpp b/include/ygm/comm.hpp index 05909585..986eae58 100644 --- a/include/ygm/comm.hpp +++ b/include/ygm/comm.hpp @@ -173,7 +173,7 @@ class comm { void flush_to_capacity(); - void post_new_irecv(std::shared_ptr &recv_buffer); + void post_new_irecv(std::shared_ptr> &recv_buffer); template size_t pack_lambda(std::vector &packed, Lambda l, @@ -189,7 +189,7 @@ class comm { void queue_message_bytes(const std::vector &packed, const int dest); - void handle_next_receive(std::shared_ptr buffer, + void handle_next_receive(std::shared_ptr> buffer, const size_t buffer_size); bool process_receive_queue(); diff --git a/include/ygm/detail/comm.ipp b/include/ygm/detail/comm.ipp index 40ec4c51..12244112 100644 --- a/include/ygm/detail/comm.ipp +++ b/include/ygm/detail/comm.ipp @@ -10,8 +10,8 @@ namespace ygm { struct comm::mpi_irecv_request { - std::shared_ptr buffer; - MPI_Request request; + std::shared_ptr> buffer; + MPI_Request request; }; struct comm::mpi_isend_request { @@ -55,7 +55,7 @@ inline void comm::comm_setup(MPI_Comm c) { } for (size_t i = 0; i < config.num_irecvs; ++i) { - std::shared_ptr recv_buffer{new std::byte[config.irecv_size]}; + std::shared_ptr> recv_buffer{new std::vector(config.irecv_size)}; post_new_irecv(recv_buffer); } } @@ -626,12 +626,12 @@ inline void comm::flush_to_capacity() { } } -inline void comm::post_new_irecv(std::shared_ptr &recv_buffer) { +inline void comm::post_new_irecv(std::shared_ptr> &recv_buffer) { mpi_irecv_request recv_req; recv_req.buffer = recv_buffer; //::madvise(recv_req.buffer.get(), config.irecv_size, MADV_DONTNEED); - ASSERT_MPI(MPI_Irecv(recv_req.buffer.get(), config.irecv_size, MPI_BYTE, + ASSERT_MPI(MPI_Irecv(recv_req.buffer.get()->data(), config.irecv_size, MPI_BYTE, MPI_ANY_SOURCE, MPI_ANY_TAG, m_comm_async, &(recv_req.request))); m_recv_queue.push_back(recv_req); @@ -862,9 +862,9 @@ inline void comm::queue_message_bytes(const std::vector &packed, m_send_buffer_bytes += packed.size(); } -inline void comm::handle_next_receive(std::shared_ptr buffer, +inline void comm::handle_next_receive(std::shared_ptr> buffer, const size_t buffer_size) { - cereal::YGMInputArchive iarchive(buffer.get(), buffer_size); + cereal::YGMInputArchive iarchive(buffer.get()->data(), buffer_size); while (!iarchive.empty()) { if (config.routing != detail::routing_type::NONE) { header_t h;