Skip to content

Commit 33ca28b

Browse files
committed
Several small improvements
* Makesure distclean can cleanup everything in mpi-proxy-split * Check error returns * Make some functions static when applicable * Free pointers in `g_async_calls` * Remove unsued function & variable definitions
1 parent 60de7c6 commit 33ca28b

6 files changed

Lines changed: 13 additions & 10 deletions

File tree

contrib/Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ LDFLAGS += -m32 -Wl,-m32 -Wl,-melf_i386 -Wa,--32
2626
endif
2727

2828
plugins =
29-
plugins_distclean = ckptfile infiniband
29+
plugins_distclean = ckptfile infiniband mpi-proxy-split
3030

3131
ifeq ($(INFINIBAND_SUPPORT),yes)
3232
plugins += infiniband # ib2tcp
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
mana_p2p_update_logs
2+
p2p-deterministic.h

contrib/mpi-proxy-split/p2p_drain_send_recv.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,11 @@ recvMsgIntoInternalBuffer(MPI_Status status, MPI_Comm comm)
9797
MPI_Type_size(MPI_BYTE, &size);
9898
JASSERT(size == 1);
9999
void *buf = JALLOC_HELPER_MALLOC(count);
100-
MPI_Recv(buf, count, MPI_BYTE, status.MPI_SOURCE, status.MPI_TAG,
100+
int rc = MPI_Recv(buf, count, MPI_BYTE, status.MPI_SOURCE, status.MPI_TAG,
101101
comm, MPI_STATUS_IGNORE);
102+
if (rc != MPI_SUCCESS) {
103+
fprintf(stderr, "MPI_Recv failed\n");
104+
}
102105

103106
mpi_message_t *message = (mpi_message_t *)JALLOC_HELPER_MALLOC(sizeof(mpi_message_t));
104107
message->buf = buf;
@@ -116,7 +119,7 @@ recvMsgIntoInternalBuffer(MPI_Status status, MPI_Comm comm)
116119

117120
// Go through each MPI_Irecv in the g_async_calls map and try to complete
118121
// the MPI_Irecv before checkpointing.
119-
int
122+
static int
120123
completePendingIrecvs()
121124
{
122125
int bytesReceived = 0;
@@ -135,6 +138,7 @@ completePendingIrecvs()
135138
call->comm);
136139
g_recvBytesByRank[worldRank] += call->count * size;
137140
bytesReceived += call->count * size;
141+
JALLOC_HELPER_FREE(call);
138142
it = g_async_calls.erase(it);
139143
} else {
140144
/* We update the iterator even if the MPI_Test fails.
@@ -162,7 +166,7 @@ completePendingIrecvs()
162166
return bytesReceived;
163167
}
164168

165-
int
169+
static int
166170
recvFromAllComms()
167171
{
168172
int bytesReceived = 0;
@@ -190,17 +194,16 @@ recvFromAllComms()
190194
return bytesReceived;
191195
}
192196

193-
void
197+
static void
194198
removePendingSendRequests()
195199
{
196200
dmtcp::map<MPI_Request, mpi_async_call_t*>::iterator it;
197201
for (it = g_async_calls.begin(); it != g_async_calls.end();) {
198202
MPI_Request request = it->first;
199203
mpi_async_call_t *call = it->second;
200-
int flag = 0;
201204
if (call->type == ISEND_REQUEST) {
202205
UPDATE_REQUEST_MAP(request, MPI_REQUEST_NULL);
203-
// FIXME: We should free `call' to avoid memory leak
206+
JALLOC_HELPER_FREE(call);
204207
it = g_async_calls.erase(it);
205208
} else {
206209
it++;

contrib/mpi-proxy-split/p2p_drain_send_recv.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,12 @@ extern dmtcp::vector<mpi_message_t*> g_message_queue;
3737
void initialize_drain_send_recv();
3838
void registerLocalSendsAndRecvs();
3939
void drainSendRecv();
40-
int recvFromAllComms(int source);
4140
int recvMsgIntoInternalBuffer(MPI_Status status);
4241
bool isBufferedPacket(int source, int tag, MPI_Comm comm, int *flag,
4342
MPI_Status *status);
4443
int consumeBufferedPacket(void *buf, int count, MPI_Datatype datatype,
4544
int source, int tag, MPI_Comm comm,
4645
MPI_Status *mpi_status, int size);
47-
void removePendingSendRequests();
4846
void resetDrainCounters();
4947
int localRankToGlobalRank(int localRank, MPI_Comm localComm);
5048
#endif

contrib/mpi-proxy-split/p2p_log_replay.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ logRequestInfo(MPI_Request request, mpi_req_t req_type)
128128
request_info_t*
129129
lookupRequestInfo(MPI_Request request)
130130
{
131-
request_info_t *req_info;
132131
std::unordered_map<MPI_Request, request_info_t*>::iterator it;
133132
it = request_log.find(request);
134133
if (it != request_log.end()) {

contrib/mpi-proxy-split/split_process.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ read_lh_proxy_bits(pid_t childpid)
247247
// NOTE: This requires same privilege as ptrace_attach (valid for child).
248248
// Anecdotally, in containers, we've seen a case where this errors out
249249
// with ESRCH (no such proc.); it may need CAP_SYS_PTRACE privilege??
250+
//TODO: why use loop since process_vm_readv can support passing array?
250251
for (int i = 0; i < IOV_SZ; i++) {
251252
JTRACE("Reading segment from lh_proxy")
252253
(remote_iov[i].iov_base)(remote_iov[i].iov_len);

0 commit comments

Comments
 (0)