Skip to content

Commit 5ef5170

Browse files
examples/looks_like_mpi: Fix build errors
Differential Revision: D85094081 Pull Request resolved: #468
1 parent 0e2f566 commit 5ef5170

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

gloo/examples/looks_like_mpi.cc

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ std::shared_ptr<gloo::Context> kContext;
3030
using MPI_Comm = int;
3131
const MPI_Comm MPI_COMM_WORLD = 0;
3232

33+
static constexpr int MPI_SUCCESS = 0;
34+
3335
enum MPI_Datatype {
3436
MPI_INT,
3537
};
@@ -44,6 +46,7 @@ int MPI_Comm_rank(MPI_Comm comm, int* rank) {
4446
if (rank) {
4547
*rank = kContext->rank;
4648
}
49+
return MPI_SUCCESS;
4750
}
4851

4952
// Same prototype as MPI API.
@@ -52,13 +55,15 @@ int MPI_Comm_size(MPI_Comm comm, int* size) {
5255
if (size) {
5356
*size = kContext->size;
5457
}
58+
return MPI_SUCCESS;
5559
}
5660

5761
// Same prototype as MPI API.
5862
int MPI_Barrier(MPI_Comm comm) {
5963
ASSERT(comm == MPI_COMM_WORLD);
6064
gloo::BarrierOptions opts(kContext);
6165
gloo::barrier(opts);
66+
return MPI_SUCCESS;
6267
}
6368

6469
// Same prototype
@@ -79,6 +84,7 @@ int MPI_Allreduce(
7984
static_cast<void (*)(void*, const void*, const void*, size_t)>(
8085
&gloo::sum<int>));
8186
gloo::allreduce(opts);
87+
return MPI_SUCCESS;
8288
}
8389

8490
// Actual prototype:
@@ -101,6 +107,7 @@ int MPI_Recv(void* buf, ssize_t bytes, int source, int tag, MPI_Comm comm) {
101107
auto ubuf = kContext->createUnboundBuffer(buf, bytes);
102108
ubuf->recv(source, tag);
103109
ubuf->waitRecv();
110+
return MPI_SUCCESS;
104111
}
105112

106113
// Actual prototype:
@@ -126,6 +133,7 @@ int MPI_Send(
126133
auto ubuf = kContext->createUnboundBuffer(const_cast<void*>(cbuf), bytes);
127134
ubuf->send(dest, tag);
128135
ubuf->waitSend();
136+
return MPI_SUCCESS;
129137
}
130138

131139
// Entrypoint of this example.
@@ -165,6 +173,7 @@ int run() {
165173

166174
// Barrier before exit
167175
MPI_Barrier(MPI_COMM_WORLD);
176+
return MPI_SUCCESS;
168177
}
169178

170179
// See example1.cc in this directory for a walkthrough of initialization.
@@ -181,8 +190,9 @@ void init(const std::string& path) {
181190
const int size = atoi(getenv("SIZE"));
182191

183192
// Initialize store
184-
auto fileStore = gloo::rendezvous::FileStore(path);
185-
auto prefixStore = gloo::rendezvous::PrefixStore(prefix, fileStore);
193+
auto fileStore = std::make_shared<gloo::rendezvous::FileStore>(path);
194+
auto prefixStore =
195+
std::make_shared<gloo::rendezvous::PrefixStore>(prefix, fileStore);
186196

187197
// Initialize device
188198
gloo::transport::tcp::attr attr;

0 commit comments

Comments
 (0)