Skip to content

Commit 2f8d863

Browse files
aeblyvegc00
authored andcommitted
Improve readability and commentary
1 parent 05cf4f3 commit 2f8d863

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

mpi-proxy-split/mpi-wrappers/mpi_group_wrappers.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,10 @@ USER_DEFINED_WRAPPER(int, Comm_group, (MPI_Comm) comm, (MPI_Group *) group)
5050
return retval;
5151
}
5252

53+
// Calls MPI_Comm_group to define a new group for internal purposes.
54+
// See: p2p_drain_send_recv.cpp
5355
int
54-
MPI_Comm_internal_vgroup(MPI_Comm comm, MPI_Group *group)
56+
MPI_Comm_internal_virt_group(MPI_Comm comm, MPI_Group *group)
5557
{
5658
int retval;
5759
DMTCP_PLUGIN_DISABLE_CKPT();

mpi-proxy-split/p2p_drain_send_recv.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ extern int MPI_Comm_create_group_internal(MPI_Comm comm, MPI_Group group,
4545
extern int MPI_Comm_free_internal(MPI_Comm *comm);
4646
extern int MPI_Comm_group_internal(MPI_Comm comm, MPI_Group *group);
4747
extern int MPI_Group_free_internal(MPI_Group *group);
48-
extern int MPI_Comm_internal_vgroup(MPI_Comm comm, MPI_Group *group);
48+
extern int MPI_Comm_internal_virt_group(MPI_Comm comm, MPI_Group *group);
4949
int *g_sendBytesByRank; // Number of bytes sent to other ranks
5050
int *g_rsendBytesByRank; // Number of bytes sent to other ranks by MPI_rsend
5151
int *g_bytesSentToUsByRank; // Number of bytes other ranks sent to us
@@ -76,7 +76,7 @@ registerLocalSendsAndRecvs()
7676
// Get a copy of MPI_COMM_WORLD
7777
MPI_Group group_world;
7878
MPI_Comm mana_comm;
79-
MPI_Comm_internal_vgroup(MPI_COMM_WORLD, &group_world);
79+
MPI_Comm_internal_virt_group(MPI_COMM_WORLD, &group_world);
8080
MPI_Comm_create_group_internal(MPI_COMM_WORLD, group_world, 1, &mana_comm);
8181

8282
// broadcast sendBytes and recvBytes
@@ -85,10 +85,13 @@ registerLocalSendsAndRecvs()
8585
g_bytesSentToUsByRank[g_world_rank] = 0;
8686

8787
// Free resources
88-
// Semantics -- although mana_comm IS a real id, and MPI_Comm_free_internal does look up a virtual id to remove, since it cannot find the virtual id, the real id is returned back and freed in the lh. So there is no leak with mana_comm.
88+
// mana_comm is a real id, and MPI_Comm_free_internal expects a
89+
// virtual id, but it works out because virtualToReal(real_id) is
90+
// defined to be real_id.
8991
MPI_Comm_free_internal(&mana_comm);
9092

91-
// Because group_world is a virtual group, we have to free both its virtual and real id to clean up correctly.
93+
// Because group_world is a virtual group, we have to free both its
94+
// virtual and real id to clean up correctly.
9295
MPI_Group_free_internal(&group_world);
9396
REMOVE_OLD_GROUP(group_world);
9497
}

0 commit comments

Comments
 (0)