Skip to content

Commit 12fe0dd

Browse files
author
David Eberius
committed
Fixed a bug that would not display the user/mpi counters if one or the other was not turned on. Updated some MCA parameter names to be more accurate. Made sure bin counters were initialized even if they aren't turned on at the start.
Signed-off-by: David Eberius <deberius@vols.utk.edu>
1 parent a287bea commit 12fe0dd

2 files changed

Lines changed: 15 additions & 11 deletions

File tree

ompi/runtime/ompi_spc.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -303,15 +303,15 @@ int ompi_spc_register_params()
303303
&ompi_mpi_spc_p2p_message_boundary);
304304

305305
ompi_mpi_spc_collective_message_boundary = 12288;
306-
(void) mca_base_var_register("ompi", "mpi", NULL, "spc_message_boundary",
306+
(void) mca_base_var_register("ompi", "mpi", NULL, "spc_collective_message_boundary",
307307
"An integer value for determining the boundary for whether a message is small/large for collective bin counters (<= this value is small).",
308308
MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
309309
OPAL_INFO_LVL_4,
310310
MCA_BASE_VAR_SCOPE_READONLY,
311311
&ompi_mpi_spc_collective_message_boundary);
312312

313313
ompi_mpi_spc_collective_comm_boundary = 64;
314-
(void) mca_base_var_register("ompi", "mpi", NULL, "spc_comm_boundary",
314+
(void) mca_base_var_register("ompi", "mpi", NULL, "spc_collective_comm_boundary",
315315
"An integer value for determining the boundary for whether a communicator is small/large for collective bin counters (<= this value is small).",
316316
MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
317317
OPAL_INFO_LVL_4,
@@ -918,24 +918,26 @@ void ompi_spc_init(void)
918918
* ###################### Initialize Bin Counters Here ####################
919919
* ########################################################################
920920
*/
921+
/* NOTE: These should be initialized even if they aren't currently turned on.
922+
* This is just in case they are turned on mid-run through MPI_T.
923+
*/
924+
/* STEP 3a: Regular bin counters initialized here. */
921925
int *rules = NULL;
922926
ompi_spc_value_t *bins = NULL;
923927

924-
if(IS_SPC_BIT_SET(ompi_spc_attached_event,OMPI_SPC_P2P_MESSAGE_SIZE)) {
925-
rules = (int*)(ompi_spc_events+ompi_spc_offsets[OMPI_SPC_P2P_MESSAGE_SIZE].rules_offset);
926-
bins = (ompi_spc_value_t*)(ompi_spc_events+ompi_spc_offsets[OMPI_SPC_P2P_MESSAGE_SIZE].bins_offset);
928+
rules = (int*)(ompi_spc_events+ompi_spc_offsets[OMPI_SPC_P2P_MESSAGE_SIZE].rules_offset);
929+
bins = (ompi_spc_value_t*)(ompi_spc_events+ompi_spc_offsets[OMPI_SPC_P2P_MESSAGE_SIZE].bins_offset);
927930

928-
bins[0] = bins[1] = 0;
931+
bins[0] = bins[1] = 0;
929932

930-
rules[0] = 2; /* The number of bins */
931-
rules[1] = ompi_mpi_spc_p2p_message_boundary; /* The number after which counters go in the second bin */
932-
}
933+
rules[0] = 2; /* The number of bins */
934+
rules[1] = ompi_mpi_spc_p2p_message_boundary; /* The number after which counters go in the second bin */
933935

934936
/* Initialize Collective Bin Counters Here */
935937
int num_bins = 4; /* This can be expanded to be more flexible */
936938

937939
for(i = 0; i < OMPI_SPC_NUM_COUNTERS; i++) {
938-
if(IS_SPC_BIT_SET(ompi_spc_attached_event, i) && IS_SPC_BIT_SET(ompi_spc_collective_bin_event,i)) {
940+
if(IS_SPC_BIT_SET(ompi_spc_collective_bin_event,i)) {
939941
rules = (int*)(ompi_spc_events+ompi_spc_offsets[i].rules_offset);
940942
bins = (ompi_spc_value_t*)(ompi_spc_events+ompi_spc_offsets[i].bins_offset);
941943

ompi/runtime/ompi_spc.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ OMPI_DECLSPEC extern int ompi_mpi_spc_collective_comm_boundary;
107107
* bin, or collective bin add its enum name to the logic for
108108
* specialized counters in the ompi_spc_init function in ompi_spc.c
109109
* Search For: 'STEP 3'
110+
* NOTE: If this is a bin counter, and not a collective bin counter,
111+
* you will need to initialize it. Search for: 'STEP 3a'
110112
* 4.) If this counter is a watermark counter, additional logic is required
111113
* for when this counter is read. The standard behavior of watermark
112114
* counters is to keep track of updates to another counter and increase
@@ -367,7 +369,7 @@ bool IS_SPC_BIT_SET(uint32_t* array, int32_t pos);
367369
ompi_spc_timer_stop(event_id, usec)
368370

369371
#define SPC_USER_OR_MPI(tag, value, enum_if_user, enum_if_mpi) \
370-
if( OPAL_UNLIKELY(IS_SPC_BIT_SET(ompi_spc_attached_event, enum_if_user) && IS_SPC_BIT_SET(ompi_spc_attached_event, enum_if_mpi)) ) \
372+
if( OPAL_UNLIKELY(IS_SPC_BIT_SET(ompi_spc_attached_event, enum_if_user) || IS_SPC_BIT_SET(ompi_spc_attached_event, enum_if_mpi)) ) \
371373
ompi_spc_user_or_mpi(tag, value, enum_if_user, enum_if_mpi)
372374

373375
#define SPC_CYCLES_TO_USECS(cycles) \

0 commit comments

Comments
 (0)