From 1357a8938f52ee9af18f7aac2fea88fcb3df75fa Mon Sep 17 00:00:00 2001 From: Jack Bond-Preston Date: Fri, 9 May 2025 12:10:47 +0100 Subject: [PATCH 1/2] examples/looks_like_mpi: fix functions without return statements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These MPI-like functions have int return types, but never return. This throws warnings at build time, for example: gloo/examples/looks_like_mpi.cc: In function ‘int MPI_Barrier(MPI_Comm)’: gloo/examples/looks_like_mpi.cc:62:1: warning: control reaches end of non-void function [-Wreturn-type] 62 | } Fix these warnings by simply returning MPI_SUCCESS (0) from these functions. It seems failure cases are already covered by assertions for this example. --- gloo/examples/looks_like_mpi.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gloo/examples/looks_like_mpi.cc b/gloo/examples/looks_like_mpi.cc index 2254507f4..98d881ab9 100644 --- a/gloo/examples/looks_like_mpi.cc +++ b/gloo/examples/looks_like_mpi.cc @@ -30,6 +30,8 @@ std::shared_ptr kContext; using MPI_Comm = int; const MPI_Comm MPI_COMM_WORLD = 0; +static constexpr int MPI_SUCCESS = 0; + enum MPI_Datatype { MPI_INT, }; @@ -44,6 +46,7 @@ int MPI_Comm_rank(MPI_Comm comm, int* rank) { if (rank) { *rank = kContext->rank; } + return MPI_SUCCESS; } // Same prototype as MPI API. @@ -52,6 +55,7 @@ int MPI_Comm_size(MPI_Comm comm, int* size) { if (size) { *size = kContext->size; } + return MPI_SUCCESS; } // Same prototype as MPI API. @@ -59,6 +63,7 @@ int MPI_Barrier(MPI_Comm comm) { ASSERT(comm == MPI_COMM_WORLD); gloo::BarrierOptions opts(kContext); gloo::barrier(opts); + return MPI_SUCCESS; } // Same prototype @@ -79,6 +84,7 @@ int MPI_Allreduce( static_cast( &gloo::sum)); gloo::allreduce(opts); + return MPI_SUCCESS; } // Actual prototype: @@ -101,6 +107,7 @@ int MPI_Recv(void* buf, ssize_t bytes, int source, int tag, MPI_Comm comm) { auto ubuf = kContext->createUnboundBuffer(buf, bytes); ubuf->recv(source, tag); ubuf->waitRecv(); + return MPI_SUCCESS; } // Actual prototype: @@ -126,6 +133,7 @@ int MPI_Send( auto ubuf = kContext->createUnboundBuffer(const_cast(cbuf), bytes); ubuf->send(dest, tag); ubuf->waitSend(); + return MPI_SUCCESS; } // Entrypoint of this example. @@ -165,6 +173,7 @@ int run() { // Barrier before exit MPI_Barrier(MPI_COMM_WORLD); + return MPI_SUCCESS; } // See example1.cc in this directory for a walkthrough of initialization. From d72f3a6597fb299962e03a17b17a4b33dcda0d2c Mon Sep 17 00:00:00 2001 From: Jack Bond-Preston Date: Tue, 14 Oct 2025 13:32:24 +0000 Subject: [PATCH 2/2] examples/looks_like_mpi: use updated shared_ptr Store API The Store API was changed to use shared_ptrs in 9ba706d63c59295e635a0a4a7fb2586dc2598afc. However, the looks_like_mpi example app was not updated for this new API, and fails to build. Fix this by using shared_ptrs for the {File,Prefix}Store in looks_like_mpi. --- gloo/examples/looks_like_mpi.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gloo/examples/looks_like_mpi.cc b/gloo/examples/looks_like_mpi.cc index 98d881ab9..89f660610 100644 --- a/gloo/examples/looks_like_mpi.cc +++ b/gloo/examples/looks_like_mpi.cc @@ -190,8 +190,9 @@ void init(const std::string& path) { const int size = atoi(getenv("SIZE")); // Initialize store - auto fileStore = gloo::rendezvous::FileStore(path); - auto prefixStore = gloo::rendezvous::PrefixStore(prefix, fileStore); + auto fileStore = std::make_shared(path); + auto prefixStore = + std::make_shared(prefix, fileStore); // Initialize device gloo::transport::tcp::attr attr;