Skip to content

Commit 7518aa2

Browse files
committed
ch4/ofi: Remove unused globals for striping and hashing
There is no use for these global variables tracking the number of communicators with striping or hashing enabled. ThreadSanitizer correctly flagged their accesses as racey. Remove them.
1 parent 54e8cdc commit 7518aa2

File tree

3 files changed

+0
-31
lines changed

3 files changed

+0
-31
lines changed

src/mpid/ch4/netmod/ofi/ofi_comm.c

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ static int update_multi_nic_hints(MPIR_Comm * comm)
1717
if (comm) {
1818
/* If the user set a multi-nic hint, but num_nics = 1, disable multi-nic optimizations. */
1919
if (MPIDI_OFI_global.num_nics > 1) {
20-
int was_enabled_striping = MPIDI_OFI_COMM(comm).enable_striping;
21-
2220
/* Check if we should use striping */
2321
if (HAS_PREF_NIC(comm)) {
2422
/* If the user specified a particular NIC, don't use striping. */
@@ -29,19 +27,10 @@ static int update_multi_nic_hints(MPIR_Comm * comm)
2927
else
3028
MPIDI_OFI_COMM(comm).enable_striping = MPIR_CVAR_CH4_OFI_ENABLE_MULTI_NIC_STRIPING;
3129

32-
/* If striping was on and we disabled it here, decrement the global counter. */
33-
if (was_enabled_striping > 0 && MPIDI_OFI_COMM(comm).enable_striping == 0)
34-
MPIDI_OFI_global.num_comms_enabled_striping--;
35-
/* If striping was off and we enabled it here, increment the global counter. */
36-
else if (was_enabled_striping <= 0 && MPIDI_OFI_COMM(comm).enable_striping != 0)
37-
MPIDI_OFI_global.num_comms_enabled_striping++;
38-
3930
if (MPIDI_OFI_COMM(comm).enable_striping) {
4031
MPIDI_OFI_global.stripe_threshold = MPIR_CVAR_CH4_OFI_MULTI_NIC_STRIPING_THRESHOLD;
4132
}
4233

43-
int was_enabled_hashing = MPIDI_OFI_COMM(comm).enable_hashing;
44-
4534
/* Check if we should use hashing */
4635
if (HAS_PREF_NIC(comm)) {
4736
/* If the user specified a particular NIC, don't use hashing. */
@@ -60,13 +49,6 @@ static int update_multi_nic_hints(MPIR_Comm * comm)
6049
!comm->hints[MPIR_COMM_HINT_NO_ANY_SOURCE])) {
6150
MPIDI_OFI_COMM(comm).enable_hashing = 0;
6251
}
63-
64-
/* If hashing was on and we disabled it here, decrement the global counter. */
65-
if (was_enabled_hashing > 0 && MPIDI_OFI_COMM(comm).enable_hashing == 0)
66-
MPIDI_OFI_global.num_comms_enabled_hashing--;
67-
/* If hashing was off and we enabled it here, increment the global counter. */
68-
else if (was_enabled_hashing <= 0 && MPIDI_OFI_COMM(comm).enable_hashing != 0)
69-
MPIDI_OFI_global.num_comms_enabled_hashing++;
7052
}
7153
}
7254

@@ -145,8 +127,6 @@ int MPIDI_OFI_mpi_comm_commit_pre_hook(MPIR_Comm * comm)
145127
MPIDI_OFI_COMM(comm).conn_id = -1;
146128

147129
/* Initialize the multi-nic optimization values */
148-
MPIDI_OFI_global.num_comms_enabled_striping = 0;
149-
MPIDI_OFI_global.num_comms_enabled_hashing = 0;
150130
MPIDI_OFI_COMM(comm).enable_striping = 0;
151131
MPIDI_OFI_COMM(comm).enable_hashing = 0;
152132
MPIDI_OFI_COMM(comm).pref_nic = NULL;
@@ -192,12 +172,6 @@ int MPIDI_OFI_mpi_comm_free_hook(MPIR_Comm * comm)
192172
int mpi_errno = MPI_SUCCESS;
193173
MPIR_FUNC_ENTER;
194174

195-
/* If we enabled striping or hashing, decrement the counter. */
196-
MPIDI_OFI_global.num_comms_enabled_striping -=
197-
(MPIDI_OFI_COMM(comm).enable_striping != 0 ? 1 : 0);
198-
MPIDI_OFI_global.num_comms_enabled_hashing -=
199-
(MPIDI_OFI_COMM(comm).enable_hashing != 0 ? 1 : 0);
200-
201175
MPL_free(MPIDI_OFI_COMM(comm).pref_nic);
202176

203177
MPIR_FUNC_EXIT;

src/mpid/ch4/netmod/ofi/ofi_init.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -644,9 +644,6 @@ int MPIDI_OFI_init_local(int *tag_bits)
644644
/* Initialize RMA keys allocator */
645645
MPIDI_OFI_mr_key_allocator_init();
646646

647-
MPIDI_OFI_global.num_comms_enabled_striping = 0;
648-
MPIDI_OFI_global.num_comms_enabled_hashing = 0;
649-
650647
mpi_errno = ofi_pvar_init();
651648
MPIR_ERR_CHECK(mpi_errno);
652649

src/mpid/ch4/netmod/ofi/ofi_types.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,8 +489,6 @@ typedef struct {
489489
MPIDI_OFI_per_vci_t per_vci[MPIDI_CH4_MAX_VCIS];
490490
int num_vcis;
491491
int num_nics;
492-
int num_comms_enabled_striping; /* Number of active communicators with striping enabled */
493-
int num_comms_enabled_hashing; /* Number of active communicators with hashingenabled */
494492
bool am_bufs_registered; /* whether active message buffers are GPU registered */
495493

496494
/* Window/RMA Globals */

0 commit comments

Comments
 (0)